You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workflows: handoff can exceed maxTotalBytes via mandatory headers (unvalidated impossible config) #117
Verified by read-only audit (seal/gpt-5.6-sol subagent, verdict: CONFIRMED — real component-contract defect, low production impact).
Mechanism
Minimum maxTotalBytes is 256 bytes (handoff.ts:14-27, 108-113); defaults are 64 refs / 16 KiB each / 48 KiB total (handoff.ts:5-7).
payloadCap = Math.max(0, maxTotalBytes - fixedBytes) (handoff.ts:193) — negative remaining capacity collapses to zero, but every result still emits a full header and projected body (handoff.ts:205-222).
Worse, projectText(..., { maxBytes: 0 }) still emits projection text rather than zero bytes (extensions/shared/text-projection.ts:31-55).
Quantified worst case
64 production-shaped refs: prefix 163 B + 64 headers 6,199 B = 6,362 B fixed. With maxTotalBytes: 256, headers alone exceed the cap by 6,106 B. Since maxRefs has no upper ceiling and artifact paths allow arbitrarily many digits (handoff.ts:143-146), the configurable worst case is not meaningfully bounded.
Production impact
Low: production constructs the registry with defaults only (index.ts:1191), and the 48 KiB default leaves ~42.8 KiB after normal 64-ref overhead. The 256-byte value is not exposed through setup config. But neither validation nor rendering rejects impossible configurations — a genuine contract violation, not acceptable-by-design.
Suggested fix
Validate at construction that configured total capacity can hold the mandatory metadata (prefix + per-ref headers) for the configured maxRefs, or reject/refuse configs that cannot.
Budget/truncate prefix and section headers within the same UTF-8 byte budget.
handoff.test.ts:224-267 covers 4 and 64 refs only at the 48 KiB default — no test of minimum maxTotalBytes with multiple refs (assert final UTF-8 byte length).
Found by automated workflow audit (run wf_56028a5b018b).
Activity
fix(workflows): bound handoff metadata budgets (openpi-dev#143)