fix(agents): stream phased text deltas incrementally#88771
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 1, 2026, 2:44 AM ET / 06:44 UTC. Summary PR surface: Source +43, Tests +135. Total +178 across 3 files. Reproducibility: yes. for the narrow subscriber defect from source inspection and branch regression tests; no direct live Windows/Ollama reproduction was established in this review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land after maintainer signoff that the focused subscriber tests and Crabbox changed gate are enough for this narrow stream-density fix, or request one redacted live local-provider proof before merge. Do we have a high-confidence way to reproduce the issue? Yes for the narrow subscriber defect from source inspection and branch regression tests; no direct live Windows/Ollama reproduction was established in this review. Is this the best way to solve the issue? Yes for the narrow fix: the patch follows the Codex/OpenAI incremental-delta contract while preserving authoritative full reads at item boundaries and text end. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 01124cfca90e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +43, Tests +135. Total +178 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
25830b2 to
0dbf38c
Compare
|
Rebased and revalidated on current Behavior addressed: same-item phased Real environment tested: clean linked worktree plus AWS Crabbox changed gate. Exact steps or command run after this patch: node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.handlers.messages.test.ts --reporter=dot
node_modules/.bin/oxfmt --check --threads=1 src/agents/embedded-agent-subscribe.handlers.messages.ts src/agents/embedded-agent-subscribe.handlers.messages.test.ts src/agents/embedded-agent-utils.ts
node scripts/run-oxlint.mjs src/agents/embedded-agent-subscribe.handlers.messages.ts src/agents/embedded-agent-subscribe.handlers.messages.test.ts src/agents/embedded-agent-utils.ts
git diff --check origin/main...HEAD
node scripts/crabbox-wrapper.mjs run --provider aws --label pr88771-check-changed --shell -- "pnpm check:changed"Evidence after fix: focused Vitest passed 1 file / 38 tests; oxfmt passed; oxlint passed; diff check passed; AWS Crabbox changed gate passed with provider Observed result after fix: What was not tested: full GitHub CI is still red on this head because current |
0dcd8f1 to
8cc28f2
Compare
8cc28f2 to
da2e177
Compare
|
Attribution note: this phased-delta PR continues the split-out stream subscriber work from the broader #87558 / #86599 dense-stream effort. The shared production direction is to consume incremental deltas on hot paths and reserve full partial reads for boundaries or cases where authoritative final text is required. #87558 is being closed in favor of smaller focused PRs. Please keep the #87558 context linked for attribution and reviewer history. |
|
Pre-merge verification for head
Known proof gap: no fresh local test rerun in this turn because the main machine is at ~200 MiB free disk and cannot create a new review worktree safely. The PR already has focused local and AWS Crabbox proof recorded on the same head. |
Summary
final_answerdeltatext_end, where the stream needs authoritative final textRefs #86599.
Verification
node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.handlers.messages.test.ts src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.emits-block-replies-text-end-does-not.test.ts src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.filters-final-suppresses-output-without-start-tag.test.ts --reporter=dot: passed 1 shard / 69 tests after rebasing ontoorigin/maine8f3bce9f0bnode_modules/.bin/oxfmt --check --threads=1 src/agents/embedded-agent-utils.ts src/agents/embedded-agent-subscribe.handlers.messages.ts src/agents/embedded-agent-subscribe.handlers.messages.test.ts: passednode scripts/run-oxlint.mjs src/agents/embedded-agent-utils.ts src/agents/embedded-agent-subscribe.handlers.messages.ts src/agents/embedded-agent-subscribe.handlers.messages.test.ts: passedgit diff --check origin/main...HEAD: passed.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main: clean, no accepted/actionable findingsnode scripts/crabbox-wrapper.mjs run --provider aws --label delta-stream-refresh-check-changed-20260601 --shell -- "env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed"(provider=aws,lease=cbx_edcabced29f2,slug=jade-krill,run=run_f0ac5fd87be3, exit 0)da2e177396f743a2e2fa66800091f1a946257562: pending after force-push when this body was refreshedReal behavior proof
Behavior addressed: same-item phased OpenAI Responses final-answer deltas stream incrementally without rereading full partial assistant text, while sanitizer context is preserved for hidden split tool-call payloads.
Real environment tested: linked OpenClaw gwt worktree, focused local Vitest wrapper, structured branch autoreview, AWS Crabbox Linux changed gate, and GitHub PR CI on the pushed head.
Exact steps or command run after this patch: rebased on current
origin/main, reran focused subscriber regression tests, formatter, lint, diff check, structured autoreview, remotepnpm check:changed, and pushed the refreshed PR head.Evidence after fix: local subscriber tests passed 69 tests; Crabbox run
run_f0ac5fd87be3selectedcore, coreTests, including core/core-test typecheck, changed-file lint, import-cycle checks, and guards, then exited 0.Observed result after fix: repeated same-item final-answer deltas emit appended user-visible text without touching the full partial text getter; split hidden tool-call XML does not leak arguments into assistant events.
What was not tested: true live Ollama UI repro; this PR covers the deterministic subscriber hot path behind the reported #86599 stream-density issue.