Skip to content

fix(retained): clamp over-bound strings in the retained delta copy - #192

Merged
drewstone merged 3 commits into
mainfrom
fix/retained-clamp-oversize-delta
Aug 31, 2026
Merged

fix(retained): clamp over-bound strings in the retained delta copy#192
drewstone merged 3 commits into
mainfrom
fix/retained-clamp-oversize-delta

Conversation

@drewstone

Copy link
Copy Markdown
Owner

Codex directors at xhigh emit single events with megabyte strings (measured: 1,048,547 chars vs the contract's 16,384). The retained-store refusal killed the live stream via commitDelta → every codex director husked at 0 iterations after three 10-minute dead attempts. Fix: clamp the RETAINED copy per string (marked truncation with original length), keep the live/in-memory replay full, let the schema still validate post-clamp. Regression test included; tsc clean; the 10 pre-existing retained Agent Interface sessions failures reproduce on the pre-edit tree (verified by stash-rerun).

🤖 Generated with Claude Code

…stead of killing the stream

A codex director at xhigh effort emits legitimate single events holding a
whole charter or ledger (measured 2026-08-31: strings to 1,048,547 chars in
one rollout event, against the envelope contract's 16,384). The retained
write threw from RuntimeEventEnvelopeSchema inside commitDelta, and the
throw propagated through RunReplayLog.append into DeltaRunStream.pump —
the LIVE stream died with the caller's work: three 10-minute director
attempts lost per run, every codex director husked.

The retained copy is now clamped per string to the contract bound with a
marked truncation carrying the original length; the schema still validates
after the clamp, so a contract drift fails loudly. The in-memory replay log
keeps the full delta. Regression test appends a 1.12M-char content string:
the append succeeds, reasoning is untouched, the marker names the length.

The 10 pre-existing 'retained Agent Interface sessions' failures (409 vs
202) reproduce identically on the pre-edit tree — tree-state, not this
change.
@drewstone
drewstone merged commit 0299595 into main Aug 31, 2026
1 check passed
@drewstone
drewstone deleted the fix/retained-clamp-oversize-delta branch August 31, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant