Repository navigation
fix(agents): avoid model fallback on local transcript conflicts - #165490
Conversation
Preserve local transcript conflict identity through the storage worker and agent loop. Keep bounded append recovery at the transcript owner, and surface exhausted conflicts without creating provider failures or replaying model work.
Remove two misplaced mock arguments introduced while relocating the transcript conflict regression. The complete candidate tree passes 272 focused tests and all selected typecheck graphs.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 5, 2026, 6:05 AM ET / 10:05 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR preserves local transcript-conflict errors across storage workers and agent execution, allowing one eligible append retry while preventing repeated model requests and fallback. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair: current main and the latest release lack the complete conflict handling. No actionable introduced defect or unresolved merge blocker was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw records agent messages through a SQLite transcript owner and storage workers. Errors returning from that boundary feed agent recovery and model fallback, which must distinguish local persistence conflicts from provider failures. flowchart TD
A[Agent messages] --> B[Transcript append owner]
B --> C[SQLite storage worker]
C --> D{Transcript conflict?}
D -->|Eligible first conflict| E[Reread revision and retry once]
E --> C
D -->|Exhausted or stale turn| F[Typed local error]
F --> G[Stop model retry and fallback]
D -->|No conflict| H[Persisted transcript]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +17, Tests +189, Docs +5. Total +211 across 20 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep transcript recovery with its existing owner and propagate exhausted local conflicts without replaying provider work. Do we have a high-confidence way to reproduce the issue? Yes, source provides a clear path: a concurrent transcript mutation crosses worker transport and reaches agent failure synthesis or model fallback. The body reports baseline-failing regressions; this read-only review did not execute them. Is this the best way to solve the issue? Yes. Consolidating the conflict class and intercepting it at existing recovery boundaries repairs the owning invariant without adding another retry mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f05baa4f524. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…claw#165490) * fix(agents): keep transcript conflicts out of model retry and fallback Preserve local transcript conflict identity through the storage worker and agent loop. Keep bounded append recovery at the transcript owner, and surface exhausted conflicts without creating provider failures or replaying model work. * test(agents): correct transcript worker model fixtures Remove two misplaced mock arguments introduced while relocating the transcript conflict regression. The complete candidate tree passes 272 focused tests and all selected typecheck graphs.
What Problem This Solves
Fixes repeated model requests and fallback after a local SQLite transcript conflict, including concurrent writes around a Gateway restart.
User Impact
Eligible appends reread the transcript revision and retry once. An exhausted conflict remains a typed local error: it cannot synthesize an assistant provider failure, rotate accounts, or select a fallback model. A newer user turn remains protected from replies prepared for an older turn. No configuration or persistence migration is required.
Why This Change Was Made
The worker transport lost the transcript conflict class, and the core agent converted thrown local errors into assistant failures. One typed class now survives the storage worker, core agent, attempt normalization, and model-fallback boundary. Normalization rejects it before an earlier compaction result can request another attempt.
The existing transcript owner keeps its bounded local retry and original parent/admission checks. Duplicate constructors and error-name retry matching are removed. Production delta is +60/−43 = +17 lines: the required worker identity and host-to-core classification boundary force that growth; no second retry or persistence path is added. Schemas, durability, retention, permissions, and update behavior remain unchanged.
Evidence
Validated tree:
64c1b61df2eb73a403b65c159dd567a781385850(head9f7c58a7a853). Both independent Codex reviews are scoped-clean at P0–P2.Blacksmith Testbox
tbx_01m45jrvx95qw4n603y213v4d5:a9f4080f9749for the intended defects. All 272 tests pass on the candidate.node scripts/check-changed.mjs --base a9f4080f9749a14fdd1c7225f341b0941d2b61cb: structural guards, core types, 27 core test graphs, and extension production/test types pass. It stops at inherited unused exports, reproduced identically on the untouched base. The remaining lint and source-policy checks passed in exact-head CI without disabling that guard.GoogleMeetJoinResult;MemoryWikiImportInsightCluster,MemoryWikiImportInsightsStatus,MemoryWikiOverviewCluster,MemoryWikiOverviewStatus;resolveGatewayWorkboardWorkspaceAccess;MeetingRuntimeOwner. These are in unchanged meeting, wiki, and workboard files.pnpm buildwith transport exit 255. That manual build is incomplete; the exact-head CI artifact build subsequently passed. The queued replacement lease was stopped unused when CI supplied the remaining proof. Earlier sync failures and a caught test-relocation typo are resolved; the corrected test tree is the one measured below.Measured with
/usr/bin/time -p pnpm test <file> --maxWorkers=1:session-manager-async-message.test.tssession-manager.fork-rebase.test.tsagent-session-models.admission.test.tsopenclaw-state-worker-error.test.tsagent-session-transcript-worker.test.tsmodel-fallback.terminal-boundary.test.tsrun.shared-integration.test.tsThe two added full-runner cases take 747 ms and 748 ms. They reuse the existing integration harness to prove the public retry boundary; the remainder of that suite is existing coverage.
Exact-head CI passed: run 37291933427 on
9f7c58a7a853, 83 jobs finished with no failures (including expected skips), 551 seconds elapsed. The artifact build passed in 383 seconds. Core/extension lint, additional boundaries, docs, source contracts, and requiredopenclaw/ci-gatestatuses are green. Both review passes are clean; all task Testbox leases are stopped. This PR covers local transcript conflict handling; restart discovery and input-admission recovery remain separate campaign work. No live deployment or restart was performed.