Repository navigation
perf(sessions): combine candidate transfer with commit admission - #169744
Conversation
Carry final candidate frames with the live commit grant, retaining bounded intermediate frames and durable receipt settlement. Share envelope validation across durable and incognito consumers. A measured group-commit prototype did not relieve the queue and is not included.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs maintainer review before merge. What this changesThis PR combines session candidate transfer with the final commit-authority exchange while preserving framed large results and native receipts. Example: Change agent:main:compound-worker from label initial to committed candidate.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this is a useful maintainer-directed optimization, and no actionable introduced correctness defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSession mutations enter the per-agent FIFO writer, execute in a SQLite worker, obtain current host authorization, and publish committed session facts after native receipt confirmation. flowchart LR
Caller[Session mutation] --> FIFO[Per agent writer]
FIFO --> Worker[SQLite transaction worker]
Worker --> Collector[Candidate collector]
Collector --> Authority[Live host authorization]
Authority --> Commit[Native COMMIT]
Commit --> Publication[Receipt and publication]
Technical reviewBest possible solution: Retain the combined exchange and existing receipt owners, then land after the normal CI gate is resolved. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the redundant exchanges; no runtime reproduction was run during this read-only review, and the author reports synthetic workload measurements. Is this the best way to solve the issue? The scoped optimization uses the existing worker, framing, authorization, and settlement owners without introducing batching or changing durable semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 76f4fdd41acf. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +19, Tests +35, Docs +7. Total +61 across 8 files. Added test files: 0. View PR surface stats
Review metrics
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 12, 2026, 4:19 AM ET / 08:19 UTC. |
|
Landing under the authorized inherited-failure exception for exact head CI run 38223434226, attempt 1 has one root failure: checks-node-compact-small-1, where The successful fail-fast monitor cancelled siblings, and the aggregate gate failed downstream. Those cancellations remain incomplete coverage. Focused storage/authority/incognito, goals, message admission, agent purge/reclamation, and the two closure files passed locally; independent reviews found no actionable P0–P2 defects. No CI rerun or dispatch was requested. |
…nclaw#169744) * perf(sessions): combine candidate transfer with commit admission Carry final candidate frames with the live commit grant, retaining bounded intermediate frames and durable receipt settlement. Share envelope validation across durable and incognito consumers. A measured group-commit prototype did not relieve the queue and is not included. * fix(sessions): constrain maintenance transfer receipts
…turn (#1475 D1) Carry openclaw#169843 (ca0a172, "fix: chat turns fail when session receipts exceed transport limits") onto the composite's actor shape, plus the transfer collector it depends on from openclaw#169744 (31a4b92, sqlite-worker-transfer.ts only). When the committed outcome serializes past SQLITE_WORKER_MAX_MESSAGE_BYTES, the worker frames it through live transaction admissions and commits only a small transfer witness. The host accepts the frames, and certifies the outcome only when the witness names the completed transfer. The receipt cap is unchanged. Adaptation to 855242b: admissions carry the full projected hot snapshot (this base has no projectSessionActorAuthority), and the commit admission has no inner kernel publication, so authorities receive undefined there as before. Accepted cost: on oversized sessions every frame repeats the hot snapshot; upstream later bounded the hot state itself (openclaw#172702, openclaw#174274), which stays a separate carry. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 454e86e)
What Problem This Solves
Queued session mutations hold the per-agent writer while transferring a candidate through separate handle, data, end-marker, and commit-authority exchanges. These waits amplify the transaction tail while other sessions wait behind the same FIFO.
User Impact
Ordinary session mutations now carry their last data frame and end marker in the existing final commit grant. This removes three host round trips per patch. FIFO, live authority, large-result framing, native commit receipts, incognito behavior, and update/storage contracts remain intact. This change does not establish overall queue relief or meet the lane's 150 ms queue-p95 target.
Why This Change Was Made
A 20-session synthetic workload attributed 61.5% of small-patch transaction wall time to authority exchanges and 2% to COMMIT. A bounded independent-write group-commit prototype saved only 14 COMMITs across roughly 1,000 metadata admissions and did not improve the matched queue result (576→565 ms p95). It was removed entirely. Callback prepare/compare boundaries still dominate the queue.
The remaining change shares envelope collection between the durable and incognito consumers and removes the standalone transfer acknowledgments. The full candidate is still checked before the live final grant; only the small original receipt certifies native COMMIT. Production delta: +19 lines. The retained arbitrary-size framed-result contract and incognito decode-before-authorize ordering require the shared collector and prevent deleting the large-result path.
Evidence
Linux rig, synthetic state, one database, 20 sessions × 5 measured tool turns; 100 probes, 400 history reads, and 100 UI metadata updates. No Team access or Testbox/Crabbox allocation.
The controlled singleton transaction-tail improvement was 35.5% (1.55×), with six→three authority exchanges. This comparison used the singleton subset of the subsequently discarded batch prototype, not a matched final-checkout end-to-end benchmark. The final four-file production candidate separately completed 100/100 turns and all probes with three exchanges and zero batches. Its busy-host queue p95 was 1,398 ms and transaction p95 37.142 ms; shared-host load prevents a valid latency comparison. BEGIN in the original phase capture was 0.20 ms p95. Phase percentiles are separate distributions and must not be summed.
Focused local proof: changed-file oxfmt and repo oxlint; session-entry authority, large payload/lost reply, incognito entry patch, goal management, and internal-source message-admission tests. Independent review: no actionable P0–P2 findings on the final diff. Full typecheck/build/closure/suite gates are delegated to PR CI per the lane validation rule.
pnpm test src/config/sessions/session-entry-patch.authority.test.ts src/config/sessions/session-entry-patch.test.ts src/state/openclaw-agent-execution-incognito.entry-patch.test.ts --maxWorkers=1: passed, 91.88 s including worker compilation.pnpm test src/agents/tools/message-tool.internal-source-reply.integration.test.ts src/config/sessions/goals-operations.test.ts --maxWorkers=1: passed, 30 tests, 197.20 s on the busy local host.CI found two unconstrained generic callers after the transfer helper's receipt contract was narrowed to objects. The purge and maintenance-finalization callbacks now carry the same constraint; this changes types only. The correction received an independent clean P2 review.
pnpm test src/config/sessions/session-agent-purge.test.ts src/config/sessions/session-native-binding.reclamation.test.ts --maxWorkers=1: passed, 15 tests, 110.16 s including compiler cleanup.CI disposition
The corrected head
fa0a4b346d8bf559f50f3fc9cd7de03f1807e086ran CI 38223434226, attempt 1. Its sole root failure ischecks-node-compact-small-1:test/scripts/type-suppression-inventory.test.tsreports an unlisted@ts-expect-errorinscripts/lib/managed-cleanup-handoff.mts. The successful fail-fast monitor cancelled sibling jobs; the CI aggregate failed downstream. Cancelled jobs are incomplete coverage, not passes.Baseline qualification: the same focused file fails identically on untouched main commit
2b4c2a10bb419014419482a8c44e3d2925b83310(one failed / three passed, 12.16 s). CI checked out mergeef20ef2f1af9dbcb1dd138f196712c82ef66207f, whose parents are that main baseline and the exact PR head. The cleanup script, inventory implementation, and inventory test are byte-identical between the baseline and tested merge; none is part of this PR. This qualifies for the operator-authorized inherited-failure landing exception. No rerun, dispatch, update-branch, or synthetic push was requested.Additional focused closure proof:
pnpm test test/scripts/eager-import-closure.test.ts test/scripts/pr-wrapper-source-closure.test.ts --maxWorkers=1passed, 20 tests, 49.90 s. The final CI attempt used 292 wall-clock seconds (08:25:05–08:29:57 UTC); most broad coverage was cancelled, so it is not a full-green result.