Skip to content

refactor(stream): share auxiliary queue overflow handling - #149282

Merged
vincentkoc merged 6 commits into
mainfrom
refactor/tool-call-aux-queue-20260916
Sep 18, 2026
Merged

vincentkoc merged 6 commits into
mainfrom
refactor/tool-call-aux-queue-20260916

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Streaming tool-call repair maintains the same auxiliary-event queue overflow policy twice, once for candidate text and once for text already being suppressed.

User Impact

No intended user-visible change. Auxiliary events keep their order, buffered tool-call text stays suppressed, and replayed false positives retain code-fence protection.

Why This Change Was Made

Use one bounded queue and drain path while keeping candidate-only classification and scrubbing explicit. The large stream-normalizer test file is split into focused primary, protection, and shared-support modules without changing production behavior or weakening coverage. No public API, limit, dependency, or performance claim changes.

Evidence

  • Final head abe92197df90771248a96991ebf1f18a37f4185a preserves the original signed PR head b49186330bfd5717bb5f258f6110e00a831555d4 in its ancestry.
  • The production blob remains c690896ce50699ce150e1aecff2d14eb482318d1; its stable patch ID remains a7132e9e7ee5bc97f72327fd9cbd70b222010b69 across the test split and current-main refresh.
  • Focused Testbox proof passed exactly 270/270 tests: 118 stream-normalizer tests, 136 protection-fast-path tests, and 16 caller/provider tests. The relevant blobs are unchanged at the final head.
  • Exact final candidate blobs were verified on Blacksmith Testbox lease tbx_01m2v4rqqc7tg2d9w8gkhjbt8z. Full five-path check-changed and scoped git diff --check passed with exit 0. Actions run: https://github.com/openclaw/openclaw/actions/runs/35393951147
  • Test files are below the line caps: primary 965 lines, protection 580 lines, shared support 188 lines. The obsolete max-lines baseline entry is removed.
  • Independent autoreview of the test split found no P0-P2 issues (0.96 confidence).

@vincentkoc vincentkoc self-assigned this Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 15, 2026 16:57
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 15, 2026
…pr-149282-proof-20260919

* commit '534100dfb1eda19b0793c14fd0fba67eaf729ee0': (1800 commits)
  perf(gateway): avoid roster scans in catalog delivery (#151938)
  fix(telegram): preserve dispatcher composition under Bun (#152055)
  test(gateway): seed fixture auth without native plugin imports (#152058)
  test: restore document focus after shared cleanup (#152065)
  fix(ui): preserve attachment reader focus during link refresh (#151858)
  perf(tests): isolate metadata heap checks (#152063)
  fix(ui): make RTL side panel resizing follow input direction (#151989)
  fix(doctor): move Workshop diagnostic reads off the caller thread (#149905)
  fix(google): prevent Gemini errors from optional schema metadata (#151327)
  test: retain safe quota recovery failure evidence (#152003)
  test(qa-lab): stabilize self-yield follow-up release proof (#152048)
  perf(codex): reduce residual app-server framing overhead (#152035)
  improve(cron): batch automation names in chat history (#152054)
  fix(ui): preserve transparent chat widget backgrounds (#151972)
  fix(ui): HTML attachment previews leave most of the side panel unused (#152031)
  perf(gateway): coalesce person presence activity broadcasts (#152042)
  fix(ui): keep session Actions clickable beside attachments (#151975)
  refactor(qa): reuse Matrix CLI JSON parser (#152087)
  feat(ui): navigate message images in the lightbox (#152027)
  fix(codex): avoid fallback replies after intentional silence (#151951)
  ...
…pr-149282-proof-20260918

* refs/remotes/origin/main:
  fix(clickclack): finish SQLite cleanup between persistence tests (#152061)
  fix(workboard): isolate board deletion from unrelated subscriptions (#152102)
  refactor(agents): unify tool availability and plugin work ownership (#152073)
  fix: session group moves lag while requests are pending (#151689)
  fix(agents): preserve active cleanup during requester settlement (#151907)
  perf(sessions): keep deletion responsive under disk pressure (#152092)
  fix: preserve successful direct replies without serializing bookkeeping keys (#151870)
  fix(gateway): keep the previous plugin generation serving when a replacement stalls on admitted work (#151273)
  fix(agents): resume parent tasks after provider retries (#151879)
  perf(skills): silence identical collisions across workspaces (#152062)
  fix: reduce Doctor preparation time for large fleets (#151366)
  perf(ui): reuse session snapshots for roster updates (#152067)
  perf(tasks): skip SQLite admission for transient agent events (#152088)
  fix: await initial task persistence before Gateway activation (#151634)
  test: keep Vitest prototype ownership on execFile mocks (#152064)
  fix(pr): recover interrupted checkouts and isolate allocation state (#152069)
  fix(test): keep quota observer armed during Codex prewarm (#152090)
  fix(cron): keep scheduled jobs alive after their creating request ends (#152051)
  refactor(shared): reduce immutable graph traversal allocations (#152077)
…pr-149282-proof-20260918

* commit 'dfa48c256f0853268c6b42cbe09fc1338d7d24ea':
  test(qa-lab): stabilize timeout recovery delivery proof (#152100)
  fix: probe SQLite when Node denies worker threads (#152075)
  perf(gateway): keep GitHub co-author trailer scans linear (#152115)
  fix(media): report CLI models with missing command or args (#151969)
  refactor: remove retired runtime code and duplicate helpers (#151973)
  perf(plugins): combine runtime and tool call scopes (#152101)
  test(memory): seed restart fixtures with the Gateway stopped (#152038)
  perf(gateway): avoid session list stalls on broad updates (#152074)
  fix: preserve model failure causes and worker fallback runtime (#152028)
  perf(logging): reduce Gateway hot-path info log volume (#152080)
  improve(gateway): reduce duplicate worker data fetched from SQLite (#151878)
  improve: format messages with many links faster (#152112)
  perf(cron): avoid unused SQL binding in config projections (#152029)
  fix: explain cloud worker startup failures (#152043)
  refactor(discord): share Markdown edit projection (#149214)
  refactor(media): remove unreachable geometry metadata backfills (#149272)
  chore(autoreview): sync mirror to agent-skills a7e91e1 (#152039)
  fix(ui): restore sidebar and chat test collection (#152099)
…of-20260918

* origin/main:
  fix(ui): load remote images in compact activity previews (#152045)
  refactor(health): skip unused verbose account projection (#152108)
  fix: restore dashboard test limits and SQLite test compilation (#152089)
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 5:36 PM ET / 21:36 UTC (Revision 2).

ClawSweeper review

What this changes

Shares overflow handling for buffered non-text stream events, expands ordering and suppression coverage, and splits the stream-normalizer tests into focused files.

Merge readiness

⛔ Blocked before merge - 1 item remains

No actionable introduced defects found. The consolidation remains absent from current main, and this MEMBER-authored PR is protected from automatic closure.

Priority: P3
Reviewed head: abe92197df90771248a96991ebf1f18a37f4185a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused behavior-preserving consolidation with retained coverage, useful overflow assertions, and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored internal queue refactor is exempt from contributor live proof and does not materially change authority; reported focused tests support overflow ordering and suppression but are not a live runtime demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal queue refactor is exempt from contributor live proof and does not materially change authority; reported focused tests support overflow ordering and suppression but are not a live runtime demonstration.
Evidence reviewed 6 items Introduced production change: The complete pinned base-to-head production diff consolidates the two pending-state branches while preserving candidate-only classification, false-positive replay, future-partial scrubbing, and suppressor transitions.
Current-main and release comparison: Current main and v2026.9.4 both retain production blob d4b5efa6175dad2255ceb5498442fced05ecec5f. The PR and previously reviewed head share blob c690896ce50699ce150e1aecff2d14eb482318d1, confirming that the consolidation is neither already on main nor newly changed since the previous review.
Test preservation and behavioral coverage: Read all three test modules and compared their text with the pinned base. Moved protection test bodies and shared helpers are preserved verbatim apart from exports. Both candidate and suppressing states now cover event-count and byte overflow; another case preserves fence protection after false-positive replay. Files contain 965, 580, and 188 lines.
Findings None None.
Security None None.

How this fits together

Tool-call repair processes provider response streams before the agent consumes them. It buffers possible serialized tool calls, preserves ordinary text and code examples, and forwards other events in order.

flowchart TD
  A[Provider response events] --> B[Tool-call repair]
  B --> C[Candidate or suppressed text]
  C --> D[Bounded auxiliary event queue]
  D --> E{Queue over limit}
  E -->|Yes| F[Replay ordinary text or drain scrubbed events]
  E -->|No| G[Wait for more events or final message]
  F --> H[Agent stream consumer]
  G --> H
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -18, Tests +81, Other -1. Total +62 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 28 -18
Tests 3 857 776 +81
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 5 867 805 +62

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: config/max-lines-baseline.txt. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one bounded auxiliary-event drain path with explicit candidate-only decisions and preserved ordering, suppression, and fence-protection contracts.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR removes duplicated handling rather than reporting a user-facing defect; source inspection confirms the duplication on main.

Is this the best way to solve the issue?

Yes. Consolidating the existing branch preserves its state-specific decisions without adding another abstraction or changing public contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fc8168070b17.

Labels

Label justifications:

  • P3: This is bounded internal cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal queue refactor is exempt from contributor live proof and does not materially change authority; reported focused tests support overflow ordering and suppression but are not a live runtime demonstration.

Evidence

What I checked:

  • Introduced production change: The complete pinned base-to-head production diff consolidates the two pending-state branches while preserving candidate-only classification, false-positive replay, future-partial scrubbing, and suppressor transitions. (packages/tool-call-repair/src/stream-normalizer.ts:1879, abe92197df90)
  • Current-main and release comparison: Current main and v2026.9.4 both retain production blob d4b5efa6175dad2255ceb5498442fced05ecec5f. The PR and previously reviewed head share blob c690896ce50699ce150e1aecff2d14eb482318d1, confirming that the consolidation is neither already on main nor newly changed since the previous review. (packages/tool-call-repair/src/stream-normalizer.ts:1879, fc8168070b17)
  • Test preservation and behavioral coverage: Read all three test modules and compared their text with the pinned base. Moved protection test bodies and shared helpers are preserved verbatim apart from exports. Both candidate and suppressing states now cover event-count and byte overflow; another case preserves fence protection after false-positive replay. Files contain 965, 580, and 188 lines. (packages/tool-call-repair/src/stream-normalizer.test.ts:356, abe92197df90)
  • Production consumer and implementation boundary: The embedded agent wraps provider streams with this package's normalizer, supplying allowed-tool matching, terminal normalization, and Markdown protection. The introduced queue refactor does not depend on a Codex harness contract or change tool authorization. (src/agents/embedded-agent-runner/run/attempt-tool-call-text-promotion.ts:121, abe92197df90)
  • Validation evidence and limits: The captured PR body reports 270 passing focused tests and successful checks against final candidate blobs. The linked Testbox workflow is a lease workflow whose checkout SHA is the base; its API status does not independently verify the shell test results. No target code or tests were executed during this read-only review; scoped diff whitespace validation passed. (abe92197df90)
  • Feature-history routing: Current-main history identifies prior work on bounded normalization, fenced examples, and incremental protection. GitHub commit metadata identifies harjothkhara for the protection update and vincentkoc for the earlier fenced-example change. Local blame could not complete because a historical object was unavailable; no introduction claim relies on that failed command. (packages/tool-call-repair/src/stream-normalizer.ts:1900, a84a915b67bd)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-18T20:46:58.989Z sha b491863 :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

ClawSweeper disposition for exact head abe92197df90771248a96991ebf1f18a37f4185a: the sole data-model compatibility item is not applicable.

This PR changes no runtime configuration, persisted state, database schema, migration, backfill, repair, or upgrade behavior. config/max-lines-baseline.txt is a static source-size ratchet; its stream-normalizer.test.ts entry must be removed because the split primary test file is now 965 lines, below the 1000-line cap.

Blacksmith Testbox changed-check and diff-check both passed with exit 0. The production patch ID remains unchanged at a7132e9e7ee5bc97f72327fd9cbd70b222010b69.

@vincentkoc
vincentkoc merged commit fe7f80d into main Sep 18, 2026
153 checks passed
@vincentkoc
vincentkoc deleted the refactor/tool-call-aux-queue-20260916 branch September 18, 2026 22:15
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…pr-149099-main-20260918

* commit '795e460278d4f8f41545dc8b4a66da1d12defd90': (1902 commits)
  refactor(slack): share Markdown preparation (#149129)
  fix(tooling): release completed PR operations with exited loaders (#152209)
  fix(release): allow stable npm bootstrap under an operator soak waiver (#152206)
  fix(daemon): avoid false restart timeouts during slow startup (#151387)
  feat: read agent documents from a host-owned workspace (#150584)
  improve(startup): skip redundant single-agent directory checks (#152192)
  test(ui): await board widget readiness before size reports (#152198)
  perf(browser): move dashboard event discovery to SQLite worker (#151952)
  improve(auth): reduce pauses during concurrent credential reads (#152140)
  improve(ui): load older chat history in smaller pages (#152093)
  fix(release): reject incomplete legacy npm install trees (#152186)
  refactor: share current-conversation binding row serialization (#152134)
  test(tooling): preserve Node and terminal fixture ownership under Bun (#152187)
  fix(sqlite): service worker admission through retained path aliases (#152190)
  improve: reduce CPU work for long CLI reasoning streams (#152191)
  chore(ui): refresh control ui locales (#152196)
  test(subagents): align lifecycle retries with durable completion owners (#152184)
  perf(gateway): defer participant maps for owned sessions (#152097)
  refactor(stream): share auxiliary queue overflow handling (#149282)
  fix(test): execute CLI fixture preloads on Node and Bun (#152076)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…49282)

* refactor(stream): share auxiliary queue overflow handling

* test(tool-call-repair): split stream normalizer coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant