Repository navigation
Conversation
Start client maintenance at 75% of the active context window while preserving provider and native compaction ownership. Check every prepared request against the hard window using nominal occupancy, calibrated tool-result estimates, and provider-measured context plus pending additions. Publish current context through the existing guarded session writer and let final ordered accounting supersede intermediate snapshots. Retire downstream mixed-counter repairs; invalidate old prompt-only freshness stamps without a schema change or new configuration. Preserve the working 32k prompt-cache fixture and repair impossible lifecycle fixture windows from the reverted admission rollout. Include red-on-parent long-turn/accounting regressions and repair the cold native-auth test setup. Related: #189810, #189891, #189888, #164551. Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesStarts client compaction earlier, checks every embedded request against its context window, and publishes current context totals during tool loops. Example: An embedded tool loop uses a 1,000,000-token context window with a 20,000-token reserve.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: it addresses a concrete long-turn failure, but the consumer cutover is incomplete and introduces confirmed CI failures. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe embedded request boundary receives prepared conversation content and provider usage, decides context pressure, and publishes occupancy through the existing session writer for maintenance and status readers. flowchart LR
Conversation[Prepared conversation] --> Boundary[Embedded request boundary]
Usage[Provider usage] --> Boundary
Boundary --> Recovery[Existing compaction recovery]
Boundary --> Provider[Provider transport]
Boundary --> Writer[Guarded session writer]
Writer --> Readers[Session and status readers]
Technical reviewBest possible solution: Complete the existing request-boundary and session-writer cutover, repair affected consumer fixtures without weakening their contracts, and demonstrate the persisted-state upgrade. Do we have a high-confidence way to reproduce the issue? Current-main source shows default-disabled mid-turn admission and completion-delayed publication; the supplied production-path regression targets both, but no target code was executed during this read-only review. Is this the best way to solve the issue? The existing pressure owner, recovery path, and keyed writer are the right boundaries, and the added publisher and shared threshold are justified; remaining consumers must adopt the changed contracts together. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0e24b7e5953e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 31, 2026, 11:27 PM ET / November 1, 2026, 03:27 UTC. |
Join the database lifecycle before raw archive fixture seeding, and wait for runtime steering admission before releasing the held document request. Preserve the existing behavior assertions and allocate exact regression lines. Archive admission passes 17/17; steering passes 6/6. The CI assertions did not reproduce locally, but diagnostic probes exposed the asynchronous fixture handoffs. Fresh Codex review found no actionable findings.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
) * fix(sessions): bound active accounting without blocking writers Reuse committed actor totals for incomplete transcript replicas and match carried accounting to the reader's native snapshot. Remove the writer reservation and the whole-history usage retry; missing anchors use bounded runtime context. Builds on #190161 after #190017. Add real-worker no-rescan and snapshot-coherence regressions plus synthetic accounting/write-latency measurement tooling. Production source is net -10 lines; no schema or config changes. * test(perf): measure accounting through the input actor Keep the generic persistence fallback as a separate control. Exercise the Gateway input actor binding and committed postimages for incremental byte accounting, with exact session identity and explicit actor cleanup.
…claw#190017) * fix(agents): compact long tool turns and publish current context totals Start client maintenance at 75% of the active context window while preserving provider and native compaction ownership. Check every prepared request against the hard window using nominal occupancy, calibrated tool-result estimates, and provider-measured context plus pending additions. Publish current context through the existing guarded session writer and let final ordered accounting supersede intermediate snapshots. Retire downstream mixed-counter repairs; invalidate old prompt-only freshness stamps without a schema change or new configuration. Preserve the working 32k prompt-cache fixture and repair impossible lifecycle fixture windows from the reverted admission rollout. Include red-on-parent long-turn/accounting regressions and repair the cold native-auth test setup. Related: openclaw#189810, openclaw#189891, openclaw#189888, openclaw#164551. Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Vincent Koc <[email protected]> * fix(agents): complete nominal context admission and accounting cutover * fix(agents): share lexical pricing with compaction summary fitting * test(agents): align context consumers and isolate announce state * test: await archive and steering fixture handoffs Join the database lifecycle before raw archive fixture seeding, and wait for runtime steering admission before releasing the held document request. Preserve the existing behavior assertions and allocate exact regression lines. Archive admission passes 17/17; steering passes 6/6. The CI assertions did not reproduce locally, but diagnostic probes exposed the asynchronous fixture handoffs. Fresh Codex review found no actionable findings. --------- Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…claw#190182) * fix(sessions): bound active accounting without blocking writers Reuse committed actor totals for incomplete transcript replicas and match carried accounting to the reader's native snapshot. Remove the writer reservation and the whole-history usage retry; missing anchors use bounded runtime context. Builds on openclaw#190161 after openclaw#190017. Add real-worker no-rescan and snapshot-coherence regressions plus synthetic accounting/write-latency measurement tooling. Production source is net -10 lines; no schema or config changes. * test(perf): measure accounting through the input actor Keep the generic persistence fallback as a separate control. Exercise the Gateway input actor binding and committed postimages for incremental byte accounting, with exact session identity and explicit actor cleanup.
What Problem This Solves
Long embedded tool loops could fill a 1M context window before auto-compaction, while
sessions.listcontinued showing the previous turn's token count. The threshold was 980,000 tokens, fresh usage stayed in memory until the whole run settled, and the mid-turn admission check was disabled by default.User Impact
Built-in client maintenance now starts by 75% of the active window. Provider-owned compaction and native runtime policies retain ownership. Every prepared embedded request is checked against the hard window, including the first request. Context totals refresh during tool loops from the request owner's measured context plus pending content, and final settlement supersedes its own intermediate observations.
Older prompt-only snapshots become unknown until refreshed. No configuration option, SQLite schema change, or new cache is introduced.
Why This Change Was Made
The provider boundary makes and publishes one pressure decision through the existing keyed writer. Downstream transcript rescans and mixed-counter repairs are removed. Ordinary tool text no longer receives a blanket two-characters-per-token penalty; encoded data, numeric groups, and JSON delimiters retain content-sensitive sizing. Hard admission and context-engine assembly use nominal occupancy, while compaction planning retains its safety margin. Summary fitting and request admission share the same lexical estimator, so fitted summaries retain metadata without exceeding the final request budget.
This repairs the false positives behind the reverted default guard: the existing 32k prompt-cache fixture remains unchanged. Synthetic host budgets too small to reach their intended tool boundary now match their existing model windows, with behavioral assertions preserved. The cold native-auth fixture also awaits its existing preparation owner; its setup failure reproduces on the exact parent and was introduced by #169580.
Related: #189810, #189891, #189888, #164551. Thanks @amittell for the ordered final-context snapshot precedent and @vincentkoc for the realistic lifecycle fixture budget. This change covers the accounting overlap with #164551 together with admission and threshold ownership.
Evidence
Runtime delta: +38 lines; regression/test-support delta: +425; reusable benchmark tooling: +412. Runtime growth supplies durable request-boundary publication and ordered settlement after deleting downstream repair machinery. All benchmark data is synthetic.
CI on the merged-main context also exposed an inherited browser import regression from #189973 (
31866655fd60):media-facts.tsimports the Node-only transcript clone used by browser attachment/history views. All three UI-job signatures reproduce on exact CI main parentc2a39e4c5a8166d1f5ea6703d1dfaa7d7c45de79, including the nested mock error. The same failure was independently requalified on the next actual CI main parentc32d920dab6bcb2eb55251bc71665816bb04f809. This is a main regression requiring follow-up, not a passing check. The six failed UI E2E shards reproduce the same handled Navigation/app-start failure on that exact parent, including routes without console errors; modal details namenode:util/types.isProxy. The final node-consumer repairs pass 41 gateway/announcement tests and all eleven message-buffer scenarios. The latter fixture now declares 32k after its request owner projected 22,180 against 16k, preserving output budget and behavioral assertions. Announcement fixtures also use their own temporary database instead of shared/tmpstate; no shared database was modified. Final exact-head run41275996117is complete on5a98db434bd1aef415a53ea1863da891a767afd3: 120 jobs passed, 21 skipped, and 11 failed (nine inherited UI jobs, the inherited Goal fixture, and the aggregate). All PostgreSQL shards, security-fast, and repaired fixture/ratchet jobs passed. A final fixture-only repair joins archive maintenance before raw seeding (17/17 tests pass) and waits for the existing steering admission receipt before releasing the provider (6/6 pass). The original CI assertions did not reproduce locally; source inspection and diagnostic probes confirmed the unjoined asynchronous work. No production change or weakened assertion was added. Fresh Codex review is scoped-clean, and fullpnpm check:changed --base 76fb0e371acd4e7e5d12a05e4b3f235c5a5a40ecpassed. The native landing evidence retains the failed checks and exact-main attribution.Exact-head qualification now uses actual CI main parent
9009dbdae33cf32eebfb3418793518018d9932f0; browser import and real-app failures reproduce there too. A newly observed Goal authority test failure is also inherited from #183706 (9e86c84aada4): its final silence assertion contradicts documented own-session read access after a fresh read-only connection. The unchanged case passes locally on both heads; on exact main, test-only real reconnect/role/history synchronization reproduces the original assertion with a new admin-injected message. Revoked-run cancellation, tool fencing, and history assertions pass. This is a main fixture defect requiring follow-up, not a production permission regression. No production authority change is included. Every failed job is accounted for against the actual tested main parent. Landing uses the authorized native inherited-failure exception; failed CI is not claimed green.