Skip to content

fix(agents): balance forced open-fence chunks - #174964

Merged
steipete merged 1 commit into
mainfrom
deslop/z24-6-forced-fences-20261015
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z24-6-forced-fences-20261015

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Force-draining an unfinished fenced code block below the transport cap bypasses the existing fence splitter. It can publish an unclosed Markdown fragment and lose the reopen context for subsequent streamed text. The same failure occurs in a fresh short block and a short tail after a capped emission.

User Impact

Forced streaming checkpoints keep code fragments balanced and within the transport cap, then resume without losing code or replaying the source. No new configuration or feature is introduced.

What changed

Route forced unfinished fences through the existing bounded close/reopen path, including below-cap tails. Reserve the synthetic closer when deciding whether an oversized language hint must shorten. Keep original source offsets and continuation ownership in the existing chunker; no new state or parser is added.

One owner regression covers fresh and resumed open fences, a language hint that needs shortening, the hard cap, exact body text and original source coverage, and absence of an extra final message. Existing tests remain intact.

Best-effort tradeoffs accepted

An explicit forced flush that ends midway through an opening-language line or a closing delimiter commits that fragment; a later continuation can retain the shortened language hint or remain formatted as code. The bot's synthetic force-then-append example is valid, but no human incident was cited. Production forces occur at text/message flush boundaries rather than every token delta. Accept this rare, cosmetic malformed-boundary case instead of adding buffering across a forced output contract; original source coverage remains intact. Inline review4300816737 is declined for that explicit best-effort tradeoff, not claimed fixed.

Fence markers too large to fit even bare balanced wrappers retain their existing degradation behavior. No security, durability, configuration, protocol, or SDK contract changes. Phase E standalone memory is untouched.

Evidence

The direct production-owner probe fails on the baseline with checkpoint missing closing fence and passes all three corrected scenarios after the fix. An initially incorrect fixture expected a fitting language hint to shorten; it was corrected to exercise a hint that actually exceeds the balanced budget.

Fresh independent P0–P2 review completed scoped-clean (confidence0.91) on an exact task-owned source snapshot; normalized full-index diff SHA256 matches the real worktree:2be7de6591f27c866c0b1f62fa5b823ed36994653649546510e70db90c984270. The full-repository attempt was interrupted during evidence verification and supplied no review outcome; its replacement completed final source verification.

Two-file type-aware lint and formatting pass. The required suppression audit passes all3tests (114.57s Vitest;157.11s wrapper). The owner-suite attempt reached no test case before the existing900000ms no-output deadline; its wrapper ended after1149.21s while preparing workers. That is an infrastructure proof gap, not a product assertion failure or passing suite. No timeout, retry, skip or suppression was added. Exact-head PR CI is the broad owner/sibling behavior/type/cycle gate. Runtime proof uses isolated HOME/OpenClaw/XDG state and one local worker. No production import edge is added. Check-changed dry-run classified both touched paths; broad local graph checks were not run under the campaign host budget.

Production delta: +1 net line. Test delta: +53 lines. This is a small real-bug fix, separate from the bookkeeping cleanup.

CI attribution and landing

Exact-head CI38992800528 is complete: runtime/type/lint/cycle gates passed. The sole substantive red is inherited mock-exports in the unchanged CLI update fixture at src/cli/update-cli/update-command-service-maintenance-native.test-support.ts:52; the aggregate gate is downstream. Exact same diagnostic appears in unrelated run38991638278/job117275393534; main-owned fixture/scanner are byte-identical between both CI main revisions. Line-cap/assertion-safety pass. The posted landing failure table records complete check enumeration, current security/dependency success, independent provenance, native infrastructure failures and the authorized exact-head fallback. No CI rerun, green-seeking repush or drift-only rebase.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 17, 2026 01:54
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 17, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T01:57:44.296256Z 7d95efc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d95efcc8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head landing evidence: 7d95efc.

CI run38992800528 completed. Complete paginated exact-head census:190 checks,64 success,122 skipped,1 neutral,2 failures,1 superseded metadata cancellation. No unfinished suite. Cancelled PR context/evidence117278502022 has successful same-head replacement117278647268/run38992800535. All substantive runtime/type/lint/cycle checks and current protected security/dependency statuses passed.

Failing job Attribution
checks-fast-baseline-ratchets117278889182 Sole failed subcheck mock-exports: src/cli/update-cli/update-command-service-maintenance-native.test-support.ts:52, ./update-command-database-context.js. Exact independent failure in unrelated run38991638278/job117275393534 (headbb8691f0901143d532907fde3a0ee976d8610a29); its cached complete log was personally inspected. This PR CI merge checks out main8a178cafdd3718b39155dfdd8cd93c921d560502; independent CI used main8919729f0484e743af1a956f20f880bdba79a185. Failing fixture and scanner are byte-identical between those main revisions. Main-owned fixture blob d58dea26fa7d36b5a0bcd0e02b28d368eaedb39c has the stale baseline fingerprint67d2ce6900bcd11906754c59b78fd8dc1258eaf6483b94536686a6698b2d44e7 after maine849b925214. Neither chunker file imports this mock pair, adds a mock, or changes its baseline. Max-lines findings are warnings; line-cap and assertion-safety passed.
openclaw/ci-gate117280762479 Downstream aggregate of the sole inherited failure above, no separate defect.

Coordinator main-flakes inventory and last six completed scheduled-main identities inspected; this newer exact independent signature is the evidence, not a job-name comparison or local timeout. No rerun/re-push/rebase for green.

Fresh independent P0-P2 review is scoped-clean on exact snapshot; direct production-owner probe fails before/passes after all3 scenarios; required lint/format/suppression proof passes. Local owner suite never reached cases before its existing startup deadline, explicitly documented; exact-head runtime CI supplies broad proof. Production+1/test+53, actual bug-fix exception. Bot inline4300816737 is declined under the campaign's explicit best-effort doctrine: forcing midway through a Markdown delimiter can commit incomplete syntax and affect subsequent formatting. Production callers force at text/message flush boundaries, not each delta (btw-stream.ts158/176, stream-rendering.ts561); the example deliberately forces then resumes a partial delimiter, without a cited human incident. Buffering across forced output would add a different parser/flush contract; source bytes/metadata remain intact, security/data/FIFO/settlement unaffected. This is an accepted cosmetic tradeoff, not a claim the example is fixed. PR body updated accordingly. Existing degradation for impossibly small fence caps remains. Phase E unchanged.

Native workflow fallback under coordinator campaign authority: this lane already recorded two genuine native infrastructure failures (state-lease startup timeout and provisioning EPIPE, on prior bookkeeping landing). This PR's canonical review-init also failed shared origin/main CAS; exact lock owner375703b0f0d3d00f1f426b8d19cc523e2678dfff recovered only after its tools exited. A subsequent full56821-file provisioning attempt was deliberately interrupted, not misclassified as another infrastructure failure. No native merge was submitted and no outcome receipt exists. The fallback reuses the authorized broken-workflow exception, pins the exact reviewed head and does not bypass security or failure attribution. All known task-owned native processes are joined before submission; unfinished worktree registration, if any, is retained for native closeout.

@steipete
steipete merged commit c0e26d5 into main Oct 17, 2026
213 of 217 checks passed
@steipete
steipete deleted the deslop/z24-6-forced-fences-20261015 branch October 17, 2026 02:11
steipete added a commit that referenced this pull request Oct 17, 2026
Main hourly 38995631641 exposed two stale assertions. The deliberate
f6f54db (#174838) tradeoff no longer reconstructs historical chunk
boundaries after an authoritative native item rewrite. Assert the complete
corrected body exactly while retaining once-only early-prefix checks;
ordinary append, directive, voice and source-occurrence cases stay intact.

c0e26d5 (#174964) intentionally balances unfinished fences during a
forced flush. Expect the synthetic closer at early and terminal delivery,
with the literal MEDIA line preserved as code and no media attachment.
No production behavior changes.

Both original failures reproduced on main 789c8c0. Focused proof:
31 tests pass with --maxWorkers=1; owning agents-root test types,
targeted type-aware lint, formatting, and independent P2 review pass.
No CI dispatch, rerun, skip, retry, or timeout change.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
Main hourly 38995631641 exposed two stale assertions. The deliberate
a7855f2 (openclaw#174838) tradeoff no longer reconstructs historical chunk
boundaries after an authoritative native item rewrite. Assert the complete
corrected body exactly while retaining once-only early-prefix checks;
ordinary append, directive, voice and source-occurrence cases stay intact.

367e8a0 (openclaw#174964) intentionally balances unfinished fences during a
forced flush. Expect the synthetic closer at early and terminal delivery,
with the literal MEDIA line preserved as code and no media attachment.
No production behavior changes.

Both original failures reproduced on main 26e1077. Focused proof:
31 tests pass with --maxWorkers=1; owning agents-root test types,
targeted type-aware lint, formatting, and independent P2 review pass.
No CI dispatch, rerun, skip, retry, or timeout change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant