feat(effects): recorded-stream API S1 — adopt @arniwesth's prototype, shared core, fail-loud bounded drain (#546) - #577
Merged
Conversation
…1_M2 part 1) Applied verbatim from arniwesth#2 (arni-546-dev.patch, sha256 4605a631): _ai_call_stream_recorded_ builtin returning { chunks: [StreamChunk], outcome: Result[StepResult, AIError] }, chunks preserved on BOTH outcomes, plus the author's four tests. Refs #546 Co-Authored-By: arniwesth <arniwesth@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ode.go + ai_encode.go (S1_M1) Behaviour-free move — zero logic change. ai_step.go 778 -> 525 lines (800-line CI gate headroom restored). NOTE: plan ordered the split BEFORE the patch; reordered because the verbatim patch's context lines reference the pre-split file — patch-first preserves verbatim reviewability, split content is identical (reused from the executor's first pass). Refs #546 Co-Authored-By: codex gpt-5.6-sol <noreply@openai.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ruct (S1_M2 part 2)
One private core in ai_stream_core.go, policy {record bool; failLoud bool}.
aiStepWithStream = core + {false,false} (behavior unchanged, incl. the
shipped silent skip); aiStepWithStreamRecorded = core + {true,true}.
Full internal/effects suite green at this commit (SKIP_NET_TESTS=1).
Refs #546
Co-Authored-By: codex gpt-5.6-sol <noreply@openai.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n for recorded streams (S1_M3) Active only under failLoud: first unencodable chunk latches non-retryable Internal error (PUBLIC-CONTRACT prefix 'unencodable stream chunk' in a named constant); latch never overwritten by a later terminal outcome; drain records/encodes/delivers nothing, budgets recordedDrainMaxChunks=256 / recordedDrainMaxBytes=1MiB; on exhaustion drain goes INERT (no panic, no recover, no sentinel — planner ruling on js&&wasm goroutine soundness); trace metadata: provider_chunks, delivered_chunks, drain_exhausted. Refs #546 Co-Authored-By: codex gpt-5.6-sol <noreply@openai.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TestAIStreamCoreMatrix rows 01-14 per the sprint plan: failure parity, typed no-handler/no-FnCaller errors, fail-soft callback, all three chunk variants + Usage fields, unencodable first/middle, both drain budgets independently, latch not overwritten, empty streams, order/identity/no duplicates, capability+budget parity, trace contract, registry+metadata, nested RecordedStream VM shape, ADR-009 ordering gate. Author's four tests untouched. Refs #546 Co-Authored-By: codex gpt-5.6-sol <noreply@openai.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…g credit (S1_M5) LongDesc now states all four contract points: linear unbounded retention; log exact w.r.t. adapter-EMITTED chunks (tool-call input_json never emitted by design); unencodable chunk -> typed Internal with stable prefix 'unencodable stream chunk' + explicitly incomplete prefix, bounded per-chunk work but the call returns only when the provider stream ends; deliberate divergence from stepWithStream's silent skip. CHANGELOG credits @arniwesth (#546, arniwesth#2). Refs #546 Co-Authored-By: codex gpt-5.6-sol <noreply@openai.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l (S1_M4 hardening) Controller mutation probe: recordedDrainMaxChunks 256->2 survived the matrix — the budget test fed recordedDrainMaxChunks+10 chunks, verifying exhaustion for WHATEVER the budget is (self-referential). Now the row pins both contract constants and adds an under-budget control proving the exhaustion assertion is informative. Mutation re-run: caught. Refs #546 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eam_recorded (S1_M2 follow-up) Only delta: the one new builtin signature; 336 signatures unchanged (verified from the golden test's own diff before regenerating). Refs #546 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ded (evaluator NB-2) Refs #546 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This was referenced Aug 3, 2026
sunholo-voight-kampff
added a commit
that referenced
this pull request
Aug 4, 2026
Carries: recorded-stream API S1 (#546, adopted from @arniwesth's prototype, PR #577) + serve-api embeddable contract #498 Lane B M1 (PR #585) + v0.32.0 benchmark curation cycle. Greenlit by Mark (attended, 2026-08-04). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Sprint M-RECORDED-STREAM-API-S1 (mission iter-135)
Adopts the recorded-stream API prototype from @arniwesth (arniwesth#2) and productionizes it per the quorum-cleared design doc + Mark's option-(c) ruling.
Commits (one per milestone):
fd838911f— @arniwesth's patch applied verbatim (5 files, +452, sha256-verified), credited198506afa— splitai_step.godecode/encode helpers →ai_decode.go/ai_encode.go(reordered after the patch: the verbatim patch's context references the pre-split file; split content identical)0b34e5218— ONE shared core (ai_stream_core.go) with policy{record, failLoud};stepWithStreambehavior unchanged incl. its shipped silent skipdf0cbb841— fail-loud unencodable-chunk latch (stable public prefixunencodable stream chunk) + bounded inert drain (256 chunks / 1 MiB) — no panic/recover/sentinel (planner ruling: unsound on js&&wasm)9e2af445b— 14-rowTestAIStreamCoreMatrix; author's four tests untouched1ed9e8b5d— controller mutation probe found the budget test self-referential (256→2 survived); budgets now pinned + under-budget control; mutation re-run caughtb0ad7b842— LongDesc contract text (all four points),Since: v0.32.0, CHANGELOG creditfb357bfb2— pipeline builtin-types golden: +1 signature, 336 unchangedWhat this PR may NOT claim (per the sprint plan): ADR-009 is not thereby unblocked; nothing about the
js && wasmbuild changes.Gates (controller, outside the codex sandbox): full
make testgreen except the pipeline golden (intentional new-builtin delta, regenerated);check-file-sizesgreen (ai_step.go 379, core 165);gofmt/go vetclean; zeropanic(/recover(in new code.Refs #546
🤖 Generated with Claude Code