Repository navigation
Skip empty chunks in streamed agent text - #21142
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe coalescer now skips empty deltas when appending retained chunks. New tests cover empty retention, snapshots, flushing, disposal, and backpressure. The pull request also adds source-overlay audit tooling, reproduction scenarios, hash manifests, Node and Electron results, validation records, and documentation for baseline and fixed behavior. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The audit evidence should be regenerated under the repository’s supported Node 24 runtime before relying on its standalone reproduction result. This is a bounded validation-record mismatch rather than a demonstrated product failure. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description clearly explains the problem, implementation, impact, and validation. However, it omits several required template sections, including the linked issue, visual proof or an explicit N/A statement, testing checkboxes and platform details, AI disclosure, review, boundary confirmation, notes, and the checklist. Resolution Add the required template sections. Include a valid issue reference after "Fixes #", add visual proof or state N/A with a reason, document manual and automated testing with platforms, complete the AI Disclosure and Agent skill upstream boundary sections, address the Notes items, and complete the final checklist. Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 373a30e8-13d1-427a-b1ad-fe27c50538c4
📒 Files selected for processing (13)
docs/audits/empty-streamed-delta-retention/README.mddocs/audits/empty-streamed-delta-retention/before.config.mjsdocs/audits/empty-streamed-delta-retention/electron-results.jsondocs/audits/empty-streamed-delta-retention/fix.patchdocs/audits/empty-streamed-delta-retention/node-results.jsondocs/audits/empty-streamed-delta-retention/reported.patchdocs/audits/empty-streamed-delta-retention/reproduce.cjsdocs/audits/empty-streamed-delta-retention/scenario.cjsdocs/audits/empty-streamed-delta-retention/source-versions.jsondocs/audits/empty-streamed-delta-retention/sources.cjsdocs/audits/empty-streamed-delta-retention/validation.jsonsrc/main/native-chat/agent-session-wire/agent-session-delta-coalescer.tssrc/main/native-chat/agent-session-wire/agent-session-empty-delta-retention.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| @@ -0,0 +1,864 @@ | |||
| { | |||
| "runtime": { | |||
| "node": "26.6.0", | |||
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n --glob 'package.json' --glob '.nvmrc' --glob '.node-version' --glob 'mise.toml' --glob '.tool-versions' '"node"|engines|NODE_VERSION|node-version' .
sed -n '1,100p' docs/audits/empty-streamed-delta-retention/README.md
sed -n '1,90p' docs/audits/empty-streamed-delta-retention/reproduce.cjs
sed -n '1,20p' docs/audits/empty-streamed-delta-retention/node-results.jsonRepository: stablyai/orca
Length of output: 7694
🏁 Script executed:
#!/bin/sh
printf '%s\n' '--- package runtime and scripts ---'
sed -n '300,370p' package.json
printf '%s\n' '--- audit files ---'
find docs/audits/empty-streamed-delta-retention -maxdepth 1 -type f -printf '%f\n' | sort
printf '%s\n' '--- audit README references ---'
rg -n -C 3 'Node|node|runtime|report|record|support|version|engine|reproduce' docs/audits/empty-streamed-delta-retention/README.md docs/audits/empty-streamed-delta-retention/*.cjs docs/audits/empty-streamed-delta-retention/*.json
printf '%s\n' '--- other checked-in runtime declarations ---'
for f in .nvmrc .node-version mise.toml .tool-versions cloud/package.json docs/site/package.json; do
if [ -f "$f" ]; then
echo "[$f]"
sed -n '1,70p' "$f"
fi
doneRepository: stablyai/orca
Length of output: 43780
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/architecture /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 47877
🏁 Script executed:
#!/bin/sh
printf '%s\n' '--- root package scripts and package identity ---'
sed -n '1,180p' package.json
printf '%s\n' '--- audit validation metadata ---'
sed -n '1,55p' docs/audits/empty-streamed-delta-retention/validation.json
printf '%s\n' '--- audit README opening and runtime statements ---'
sed -n '1,28p' docs/audits/empty-streamed-delta-retention/README.mdRepository: stablyai/orca
Length of output: 25686
Regenerate the standalone result with Node 24.
The root package.json restricts the standalone runtime to Node 24. validation.json lists node-results.json as a proof report, and the README states that each recorded runtime executes the audit phases. Node 26.6.0 does not validate the supported standalone Node runtime. The README provides no version-independent exception.
There was a problem hiding this comment.
Important
CI's static_analysis job will fail on this PR. pnpm run check:code-quality:changed reports eslint(curly) at docs/audits/empty-streamed-delta-retention/scenario.cjs:76 and exits non-zero — one brace fix is inline below. The production change itself is correct and well tested.
Reviewed changes
- Coalescer empty-delta guard —
appendWithinUtf8ByteLimitnow only pushes a chunk whendelta.length > 0, so repeated empty Codex deltas no longer grow the per-streamchunksarray while both byte counters stay at zero (agent-session-delta-coalescer.ts:233). Snapshot text,dirty, scheduling, eviction, backpressure, and truncation are untouched. - Regression test —
agent-session-empty-delta-retention.test.tsdrives the real Codex stream caller through 4×16384 empty deltas, then measures retained slots via a synchronousArray.prototype.joinspy duringsnapshot. The assertion is exact (toBe(1)), and I ablated the guard locally: it fails withexpected 65537 to be 1while the two control tests still pass. - Audit evidence —
docs/audits/empty-streamed-delta-retention/adds the reproduction scripts, current/main and v1.4.198 overlay patches, hash-pinned source loaders, and Node/Electron result reports. I verified thevalidation.jsonproduct hashes match the shipped files.
ℹ️ Nitpicks
node-results.jsonwas recorded on Node 26.6.0, butpackage.jsonpinsengines.nodeto24. The Electron report already covers Node 24.21.0, so this is only an evidence-hygiene note, not a blocker.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const deps = { | ||
| emit(key, text, snapshot) { | ||
| assert.equal(this, deps) | ||
| if (!accepting) return false |
There was a problem hiding this comment.
Brace this if: the changed-code quality gate reports eslint(curly) here and fails the PR's static_analysis job.
The repo-wide pnpm exec oxlint step skips docs/** (gitignore), which is why the PR's own validation only linted the two product .ts files and missed this. But config/scripts/check-changed-code-quality.mjs collects changed source-like paths from git diff --name-only (only cloud/ is excluded) and passes them explicitly to oxlint, overriding ignore — so all four audit scripts are scanned by CI.
Technical details
# Changed-code quality gate fails on the new audit script
## Affected sites
- `docs/audits/empty-streamed-delta-retention/scenario.cjs:76` — `if (!accepting) return false` violates `eslint(curly)` (error under the root oxlint config); the only violation across the four new `.cjs`/`.mjs` audit scripts.
## Reproduction
- `node config/scripts/check-changed-code-quality.mjs 631b51f508` → `::error file=docs/audits/empty-streamed-delta-retention/scenario.cjs,line=76,title=eslint(curly)` then `Changed-code quality gate failed with 1 finding(s)`.
- `pr-code-change-scope.mjs` returns `static_analysis=true` for this diff, so `.github/workflows/pr.yml` runs `pnpm run check:code-quality:changed -- <base>`.
## Required outcome
- `node config/scripts/check-changed-code-quality.mjs <base>` exits 0.| if (!accepting) return false | |
| if (!accepting) { | |
| return false | |
| } |
* fix: skip empty chunks in streamed agent text * test: lint empty-delta retention reproducer --------- Co-authored-by: m4air <[email protected]>

Problem and change
The streamed-text coalescer appended an array entry for every empty delta while charging zero bytes. The Codex notification path accepts these updates, and publishing the text leaves the entries retained. A bounded reproduction retains 65,536 empty entries in one live stream.
Skip only the empty array append. The same reproduction retains zero entries afterward; stream creation, snapshots, scheduled publications, backpressure, eviction, UTF-8 limits and cleanup retain their existing behavior.
Validation
ORCA_BACKGROUND_LAUNCH=1.docs/audits/empty-streamed-delta-retention/. The 23 bundled dependencies and six current caller modules match the independent main base.The historical proof overlays the reported coalescer onto current dependencies; it does not replay the historical application. Ordinary Claude input filters empty text before this helper. Measurements count retained entries, not heap/RSS. Empty-update frequency and contribution to #19831 remain unproven; nonempty chunk overhead and transient concatenation costs are separate.