Skip to content

Commit a2c3f6c

Browse files
wip v28
1 parent ee14816 commit a2c3f6c

20 files changed

Lines changed: 675 additions & 57 deletions

BITCODE_SPEC_V28.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,10 @@ Read/Fit result review remains fail-closed:
474474
incremental telemetry artifact lines while the detached sandbox command is
475475
still running. Browser-only Network inspection is not sufficient; the
476476
operator-visible stream must show phase, agent, generation/tool, parsed
477-
output, and failsafe context as first-class Read/Fit run evidence.
477+
output, and failsafe context as first-class Read/Fit run evidence. Terminal
478+
must render these events through the canonical Bitcode execution stream panel
479+
shape so Read/Fit live runs are visually consistent with persisted execution
480+
activity and retain expandable raw metadata per line.
478481
- the harness must enforce an internal runtime budget before the caller's host
479482
timeout, producing a `blocked_readiness` artifact rather than allowing the
480483
host to terminate without evidence.

BITCODE_V28_QA.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,10 @@ First-run execution boundary:
929929
- The Terminal live-run panel must show the active Read id, Deposit id,
930930
source commit, sandbox id when available, pipeline run id when available, and
931931
incremental `telemetry.jsonl` line summaries while the sandbox command is
932-
still running. A state visible only in browser Network logs fails V28 QA.
932+
still running. It must use the canonical Bitcode execution stream component,
933+
with run identifiers in the header metadata and each host/telemetry event as
934+
an expandable line carrying raw payload metadata. A state visible only in
935+
browser Network logs fails V28 QA.
933936
- Depository vector recall uses `text-embedding-3-small` by default with
934937
`encoding_format='float'`, `dimensions=1536`, Supabase
935938
`deliverable_vectors.embedding vector(1536)`, `ivfflat`,
@@ -1239,7 +1242,9 @@ After either harness run:
12391242
and phase/agent/step/failsafe/generation correlation.
12401243
4. Inspect the Terminal live-run panel for the same run id and sandbox id. The
12411244
panel must include host lifecycle events and incremental telemetry artifact
1242-
event summaries, not only the final harness completion payload.
1245+
event summaries, not only the final harness completion payload. Read/Fit
1246+
live harness streams should render in the same execution stream UX used by
1247+
persisted Bitcode activity.
12431248
5. Run saved query
12441249
`supabase/queries/v28_qa_terminal_07_pipeline_harness_after_fit.sql`.
12451250
6. Rerun `v28_qa_terminal_06_read_fit_quality_after_read` and
@@ -1324,6 +1329,30 @@ Observed staging-testnet harness evidence on 2026-05-17:
13241329
harness changes are deployed in the deposited source revision. Only a clean
13251330
no-overlay run may write and read back ledger settlement rows.
13261331
1332+
Later staging-testnet evidence on 2026-05-17 after the no-overlay deployment:
1333+
1334+
- A new Deposit/Read/Fit harness run against
1335+
`engineeredsoftware/ENGI@main:ee1481634c985afbc349f8d8b837cd1c43a254ac`
1336+
reached real model-backed setup execution. Umbrella pipeline run
1337+
`44a05fd7-f337-42cf-ad3c-d4a607d54a2b` and deliverable pipeline run
1338+
`b1b04a2d-0376-4200-b08c-7936076f2566` failed before candidate recall or
1339+
AssetPack synthesis.
1340+
- Database readback showed real execution progress: 2 setup phase delegation
1341+
rows, 16 agent-step rows, 72 model-generation rows, 1634 deliverable pipeline
1342+
events, and 0 tool-execution rows. This confirms real inference and telemetry
1343+
persistence were active, but the run did not reach depository search,
1344+
synthesis, Finish, shipping, or ledger settlement.
1345+
- Failure root cause was a setup risk-admission output contract mismatch:
1346+
`asset-pack-danger-wall-agent.ts` read `finalAssessment.safe` directly from
1347+
the PTRR envelope, while the full PTRR path returns the typed risk result
1348+
under `output`/`finalOutput`. The fix is to normalize the risk-admission
1349+
envelope before safety evaluation and fail closed if the typed final
1350+
assessment is absent.
1351+
- Terminal live-run visibility must now render harness lifecycle events and
1352+
`telemetry.jsonl` events through the canonical execution stream component so
1353+
future failures show the same phase/agent/step/generation metadata operators
1354+
already use for persisted Bitcode activity.
1355+
13271356
## 2026-05-13 Staging Deployment Readiness Gate
13281357
13291358
Purpose:

packages/generic-agents/read-comprehension/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Bitcode Read Comprehension Agent
22

3-
## V26 Boundary
3+
## Active Boundary
44

55
`@bitcode/generic-agents-read-comprehension` is the PTRR agent owner for Bitcode setup-phase Read comprehension.
66
It composes the callable tools from `@bitcode/generic-tools-read-comprehension`; it does not redefine those tool contracts.
@@ -22,7 +22,7 @@ Its canonical fifth-gate role is `setup` / `pre-danger-wall`: synthesize a revie
2222
- Plans how to understand the expressed Read, attachments, repository context, AssetPack expectation, proof reads, delivery-mechanism boundary, and source-to-shares service questions.
2323
- Uses Read-comprehension tools to analyze semantics, extract requirements, identify constraints, generate satisfaction criteria, validate the model, and estimate implementation complexity.
2424
- Refines ambiguity before risk admission rather than allowing danger-wall to infer canonical Read meaning.
25-
- Emits active Bitcode fields: `read`, `writtenAssetTypes`, `assetPackContext`, `deliveryMechanismBoundaries`, `sourceToSharesServiceQuestions`, `commercialAccountability`, and `readSatisfactionCriteria`.
25+
- Emits active Bitcode fields: `read`, `writtenAssetTypes`, `assetPackContext`, `deliveryMechanismBoundaries`, `sourceToSharesServiceQuestions`, `serviceAccountability`, and `readSatisfactionCriteria`.
2626

2727
## Verification
2828

packages/generic-agents/read-comprehension/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ export const BitcodeSetupReadComprehensionResultSchema = z.object({
8585
asset_pack_context: z.any().optional(),
8686
delivery_mechanism_boundaries: z.array(z.string()).default([]),
8787
source_to_shares_service_questions: z.record(z.string()).optional(),
88-
commercial_accountability: z.object({
88+
service_accountability: z.object({
8989
provider: z.string().optional(),
90-
customer_outcome: z.string().optional(),
91-
market_infrastructure_standard: z.string().optional()
90+
reader_outcome: z.string().optional(),
91+
infrastructure_standard: z.string().optional()
9292
}).optional(),
9393
comprehension: z.object({
9494
intent: z.string().optional(),

packages/generic-tools/read-comprehension/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Read Comprehension Tools
22

3-
## V26 Posture
3+
## Active Posture
44

55
`@bitcode/generic-tools-read-comprehension` is the canonical generic-tool package for Bitcode Read comprehension.
66
The package path and package name are canonical Bitcode tool owners.
@@ -40,7 +40,7 @@ Expected output includes:
4040
- `semantic_analysis.scope_boundaries`
4141
- `written_asset_expectations`
4242
- `source_to_shares_service_questions`
43-
- `commercial_accountability`
43+
- `service_accountability`
4444
- `asset_pack_context`
4545
- `delivery_mechanism_boundaries`
4646

@@ -55,7 +55,7 @@ Expected output includes:
5555
- `functional_requirements`
5656
- `non_functional_requirements`
5757
- `proof_requirements`
58-
- `commercial_service_requirements`
58+
- `service_requirements`
5959
- `interface_requirements`
6060
- `written_asset_requirement_map`
6161
- `extraction_metadata`
@@ -85,7 +85,7 @@ Expected output includes:
8585
- `performance_criteria`
8686
- `quality_criteria`
8787
- `proof_criteria`
88-
- `commercial_accountability_criteria`
88+
- `service_accountability_criteria`
8989
- `persistence_criteria`
9090
- `interface_criteria`
9191
- `blocking_criteria`
@@ -100,7 +100,7 @@ Expected output includes:
100100
- `validation_results`
101101
- `validation_details`
102102
- `terminology_findings`
103-
- `commercial_accountability_findings`
103+
- `service_accountability_findings`
104104
- `read_comprehension`
105105
- `written_asset_coherence`
106106
- `proof_coverage`

packages/generic-tools/read-comprehension/src/read-comprehension-primitives.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export async function analyzeReadSemantics({
6262
},
6363
written_asset_expectations: ['source-bearing written asset', 'verification evidence'],
6464
source_to_shares_service_questions: buildSourceToSharesServiceQuestions(expressedRead),
65-
commercial_accountability: {
65+
service_accountability: {
6666
provider: 'Advanced Engineered Software, Inc.',
6767
customer_outcome: 'source-to-shares system use',
6868
market_infrastructure_standard: 'auditable engineering-knowledge market infrastructure'
@@ -133,7 +133,7 @@ export async function extractReadRequirements({
133133
business_requirements: [],
134134
technical_requirements: [],
135135
proof_requirements: ['Spec/proof witnesses updated when semantics change'],
136-
commercial_service_requirements: [
136+
service_requirements: [
137137
'Read answer explains why/how/when/where/what/who the work serves source-to-shares',
138138
'Proof evidence supports customer-facing audit and market-infrastructure acceptance'
139139
],
@@ -264,7 +264,7 @@ export async function generateReadSatisfactionCriteria({
264264
}
265265
],
266266
proof_criteria: ['Generated V26 proof artifacts include the changed prompt surface'],
267-
commercial_accountability_criteria: [
267+
service_accountability_criteria: [
268268
'Critical source-to-shares service questions are answered before fit search or settlement',
269269
'The answer is reviewable by the customer/operator using canonical Bitcode terminology'
270270
],
@@ -321,7 +321,7 @@ export async function validateReadComprehension({
321321
written_asset_coherence: 0.9,
322322
proof_coverage: 0.86
323323
},
324-
commercial_accountability_findings: [
324+
service_accountability_findings: [
325325
'Read comprehension must explain why/how/when/where/what/who this code serves Bitcode source-to-shares'
326326
],
327327
terminology_findings: [
@@ -366,7 +366,7 @@ export async function analyzeReadSatisfactionImplementationComplexity({
366366
testing_complexity: 'medium' as const,
367367
proof_complexity: 'medium' as const,
368368
delivery_mechanism_complexity: 'low' as const,
369-
commercial_accountability_complexity: 'medium' as const
369+
service_accountability_complexity: 'medium' as const
370370
},
371371
risk_analysis: {
372372
technical_risks: ['Package boundary drift', 'Prompt runtime carry-through drift'],

packages/pipelines/asset-pack/src/__tests__/depository-search.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ function asset(overrides: Partial<DepositoryAsset> = {}): DepositoryAsset {
5959
githubBoundary: { sourceProvider: 'github', sourceRepo: 'engineeredsoftware/ENGI' },
6060
assetMeasurement: { targetKindCount: 5 },
6161
measurementProvenance: [{ stage: 'deposit-measurement' }],
62+
verificationEvidence: {
63+
proofRoot: 'sha256:test-proof-root',
64+
measurementRoot: 'sha256:test-measurement-root',
65+
reconciliationReadbackRoot: 'sha256:test-reconciliation-readback-root',
66+
},
6267
...overrides,
6368
};
6469
}
@@ -140,6 +145,25 @@ describe('AssetPack depository search', () => {
140145
);
141146
});
142147

148+
it('blocks readiness when a read requires proof and reconciliation readback roots that are not present', async () => {
149+
const result = await searchDepositoryAssetSpace({
150+
read,
151+
assets: [
152+
asset({
153+
verificationEvidence: null,
154+
hasWalletOrAttestationProof: true,
155+
hasAssetMeasurementEvidence: true,
156+
}),
157+
],
158+
});
159+
160+
expect(result.resultState).toBe('blocked_readiness');
161+
expect(result.selectedCandidates[0].verification.warnings).toEqual(
162+
expect.arrayContaining(['proof_root_readback_missing', 'reconciliation_readback_missing'])
163+
);
164+
expect(result.selectedCandidates[0].useTier).toBe('context-only');
165+
});
166+
143167
it('returns no-worthy-fit for unrelated reads instead of relying on repository match alone', async () => {
144168
const result = await searchDepositoryAssetSpace({
145169
read: {
@@ -240,10 +264,16 @@ describe('AssetPack depository search', () => {
240264
proofEvidence: {
241265
hasWalletOrAttestationProof: true,
242266
signingSurfacePresent: true,
267+
proofRoot: 'sha256:test-proof-root',
243268
},
244269
measurementEvidence: {
245270
hasAssetMeasurementEvidence: true,
246271
assetMeasurementPresent: true,
272+
measurementRoot: 'sha256:test-measurement-root',
273+
},
274+
readbackEvidence: {
275+
reconciliationReadbackPresent: true,
276+
reconciliationReadbackRoot: 'sha256:test-reconciliation-readback-root',
247277
},
248278
});
249279
expect(findStored(exec, 'fit', 'selectionTrace')?.selectedCandidates[0].selectedUnits[0]).toMatchObject({

packages/pipelines/asset-pack/src/__tests__/setup-agents.test.ts

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import cloneRepositoryAgent from '../agents/setup/asset-pack-clone-vcs-repository-agent';
33
import setupPlanAgent from '../agents/setup/asset-pack-setup-plan-agent';
44
import runComprehendReadAgent from '../agents/setup/asset-pack-comprehend-read-agent';
5-
import dangerWallAgent from '../agents/setup/asset-pack-danger-wall-agent';
5+
import dangerWallAgent, {
6+
normalizeRiskAdmissionResult,
7+
} from '../agents/setup/asset-pack-danger-wall-agent';
68

79
function executionStub() {
810
const stores: Array<{ namespace: string; key: string; value: unknown }> = [];
@@ -137,4 +139,66 @@ describe('AssetPack setup agents', () => {
137139
])
138140
);
139141
});
142+
143+
it('normalizes the full PTRR risk admission envelope before checking setup safety', () => {
144+
const result = normalizeRiskAdmissionResult({
145+
context: {},
146+
output: {
147+
finalAssessment: {
148+
safe: true,
149+
maxSeverity: 'none',
150+
confidence: 0.91,
151+
verdict: {
152+
approved: true,
153+
reason: 'Full risk admission passed.',
154+
flags: [],
155+
recommendations: [],
156+
},
157+
auditTrail: [
158+
{
159+
check: 'read boundary',
160+
result: true,
161+
details: ['source-bound read'],
162+
severity: 'none',
163+
},
164+
],
165+
},
166+
riskInsights: {
167+
riskProfile: 'bounded',
168+
threatLevel: 'minimal',
169+
riskRecommendations: [],
170+
proofObligations: [],
171+
admissionBoundary: 'setup',
172+
},
173+
readAlignment: {
174+
alignmentScore: 0.94,
175+
readSafeToMeasure: true,
176+
assetPackSafeToSynthesize: true,
177+
deliveryMechanismSafeToAttempt: true,
178+
},
179+
recommendations: ['continue'],
180+
success: true,
181+
validationMessage: 'passed',
182+
},
183+
finalOutput: {},
184+
});
185+
186+
expect(result.finalAssessment.safe).toBe(true);
187+
expect(result.finalAssessment.maxSeverity).toBe('none');
188+
expect(result.readAlignment.assetPackSafeToSynthesize).toBe(true);
189+
});
190+
191+
it('fails closed when risk admission returns an untyped output shape', () => {
192+
const result = normalizeRiskAdmissionResult({
193+
step: 'Retry',
194+
agent: 'bitcode-read-risk-admission',
195+
phase: 'setup',
196+
});
197+
198+
expect(result.finalAssessment.safe).toBe(false);
199+
expect(result.finalAssessment.maxSeverity).toBe('high');
200+
expect(result.finalAssessment.verdict.flags).toContain(
201+
'risk-admission-output-missing-final-assessment',
202+
);
203+
});
140204
});

packages/pipelines/asset-pack/src/agents/setup/asset-pack-comprehend-read-agent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ function buildDeterministicReadComprehension(input: any, execution: any) {
139139
'BTC fee handling is a settlement/finality concern and cannot be attributed to the depositor without recorded authorization.'
140140
],
141141
source_to_shares_service_questions: {},
142-
commercial_accountability: {
142+
service_accountability: {
143143
provider: 'Bitcode pipeline harness',
144-
customer_outcome: 'A high-quality, proof-bearing AssetPack fit or explicit blocked/no-worthy-fit evidence.',
145-
market_infrastructure_standard: 'Source-bound read satisfaction with auditable telemetry and ledger synchronization.'
144+
reader_outcome: 'A high-quality, proof-bearing AssetPack fit or explicit blocked/no-worthy-fit evidence.',
145+
infrastructure_standard: 'Source-bound read satisfaction with auditable telemetry and ledger synchronization.'
146146
},
147147
comprehension: {
148148
intent: 'Synthesize a Read-satisfying AssetPack from deposited repository evidence.',

0 commit comments

Comments
 (0)