Repository navigation
fix(gateway): record a transcript notice when a run fails before replying - #139439
Conversation
|
🦞👀 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: blocked before merge. Reviewed September 5, 2026, 9:41 PM ET / September 6, 2026, 01:41 UTC. ClawSweeper reviewWhat this changesRecords a bounded, redacted transcript notice when a run fails before replying, preserving the failed input’s order and covering restart-safe dispatch. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains useful: current main and v2026.9.2 lack this durable failure notice. Both earlier findings are addressed, and the supplied compatibility evidence is supported by the shipped readers. No blocking defect was established. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway turns agent lifecycle and dispatch outcomes into session state and transcript history. These transcripts feed Control UI chat history and subsequent model context. flowchart TD
A[Chat input] --> B[Run or dispatch failure]
B --> C[Commit terminal session state]
C --> D[Check current transcript ownership]
D --> E[Check assistant output and duplicate notice]
E --> F[Append bounded failure notice]
F --> G[Chat history and model context]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +104, Tests +379, Docs +2. Total +485 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep failure reporting in the lifecycle owners and reuse the existing fenced custom-report format, preserving input order and established model-history semantics. Do we have a high-confidence way to reproduce the issue? Yes, from source: a pre-reply dispatch rejection updates terminal session state without appending a transcript outcome on current main. This review did not execute that path. Is this the best way to solve the issue? Yes. Reusing the existing report appender addresses both lifecycle owners without a parallel store, and the shipped-reader comparison resolves the earlier migration concern. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2c26114f5db5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
Compatibility evidence for the remaining data-model check on This PR adds a new value of the existing generic The relevant readers in this head are byte-identical to the shipped
I executed a synthetic The PR-relative diff is empty for |
0809b12 to
159edd9
Compare
159edd9 to
84ea17c
Compare
84ea17c to
f8df3d5
Compare
|
Merged via squash.
|
* origin/main: fix(cli): keep note text with Windows and Unicode line endings (#139512) fix(agents): keep isolated completion context on its admitted generation (#139607) fix: avoid declaration builds during source-server updates (#139392) fix(models): keep discovered models after catalog refresh failures (#139357) fix(gateway): record a transcript notice when a run fails before replying (#139439) refactor(ios): reuse shared integer conversion (#139581) fix(sessions): prevent database lock failures during reclamation (#139469) perf(test): reuse transforms within owned scheduler slots (#139553) test(agents): share sparse transcript input fixtures (#139589) chore(ui): refresh control ui locales (#139481) fix(slack): keep prototype-named emoji shortcodes intact (#136374) fix(gateway): deliver upgrade rejection responses under Bun (#139516) refactor(test): simplify catalog guards and fix native report fixture (#139496) fix(macos): prevent dashboard fixture loopback timeouts (#139556) fix(matrix): preserve selected reply targets inside threads (#139479)
* commit '6c55a99226ed0611ca088004c81b00fb296f1f71': (182 commits) test(ui): scope dashboard settings setup to the top frame (openclaw#139618) refactor(skills): share pending proposal creation (openclaw#139617) fix(release): accept frozen targets before worker bundles (openclaw#136699) fix(gateway): preserve percent sequences in media filenames (openclaw#139508) fix: preserve current update availability alongside update history (openclaw#139501) feat(diagnostics): expose garbage collection duration metrics (openclaw#139592) fix(ui): keep Logbook timestamps clear of the activity stripe (openclaw#139539) fix(ui): keep Swarm outcomes visible after completion (openclaw#139490) test: check file accessibility without runtime-specific return values (openclaw#139590) refactor(sdk): keep helper types private (openclaw#139601) fix(cron): preserve current-session delivery intent (openclaw#139491) fix: prevent browser profile permission hangs in Doctor (openclaw#139612) fix(agents): repair storage-failure test fixture after failover owner move (openclaw#139531) fix(cli): keep note text with Windows and Unicode line endings (openclaw#139512) fix(agents): keep isolated completion context on its admitted generation (openclaw#139607) fix: avoid declaration builds during source-server updates (openclaw#139392) fix(models): keep discovered models after catalog refresh failures (openclaw#139357) fix(gateway): record a transcript notice when a run fails before replying (openclaw#139439) refactor(ios): reuse shared integer conversion (openclaw#139581) fix(sessions): prevent database lock failures during reclamation (openclaw#139469) ...
* commit 'refs/openclaw/tasks/pr-135167-main-latest': test(ui): scope dashboard settings setup to the top frame (#139618) refactor(skills): share pending proposal creation (#139617) fix(release): accept frozen targets before worker bundles (#136699) fix(gateway): preserve percent sequences in media filenames (#139508) fix: preserve current update availability alongside update history (#139501) feat(diagnostics): expose garbage collection duration metrics (#139592) fix(ui): keep Logbook timestamps clear of the activity stripe (#139539) fix(ui): keep Swarm outcomes visible after completion (#139490) test: check file accessibility without runtime-specific return values (#139590) refactor(sdk): keep helper types private (#139601) fix(cron): preserve current-session delivery intent (#139491) fix: prevent browser profile permission hangs in Doctor (#139612) fix(agents): repair storage-failure test fixture after failover owner move (#139531) fix(cli): keep note text with Windows and Unicode line endings (#139512) fix(agents): keep isolated completion context on its admitted generation (#139607) fix: avoid declaration builds during source-server updates (#139392) fix(models): keep discovered models after catalog refresh failures (#139357) fix(gateway): record a transcript notice when a run fails before replying (#139439)
…ying (openclaw#139439) * fix(gateway): record a transcript notice when a run fails before replying * fix(gateway): cover dispatch settlement in failure notices
…ying (openclaw#139439) * fix(gateway): record a transcript notice when a run fails before replying * fix(gateway): cover dispatch settlement in failure notices (cherry picked from commit 2a77ac9)
Problem
Fixes an issue where a Control UI turn that fails before any assistant output leaves no durable outcome in the thread. A cloud runner rejection updates transient error state, but the thread can look unanswered after reload or later activity.
Root cause
Terminal session state and transcript history had separate coverage. Native lifecycle errors and fallback dispatch rejection updated the session row without a notice. Restart-safe dispatch settlement committed its diagnostic and claim state directly. Fallback finalization could also defer the failed user input until after terminal persistence.
Change
One report writer in the lifecycle persistence module records a displayed
run-failed-before-replycustom message after an accepted failed terminal commit. Native lifecycle persistence and restart-safe settlement both call it. The latter retains its existing atomic diagnostic/claim write; it does not perform a competing lifecycle update. If notice persistence fails after restart-safe settlement, the failure is logged and the already-committed settlement remains successful.Fallback dispatch finalization persists its deferred user input before lifecycle persistence, so history and subsequent model context receive the input before its failure notice. The active-run check still occurs after awaited work.
The report appender retains assistant run ownership during its existing traversal and suppresses the notice if any assistant message on the active branch already carries that run ID, including assistant error messages. Deduplication uses the latest report's
details.runIdin the same write transaction. The existing full traversal is explicitly accepted for qualifying errors only; no second transcript scan, schema, index, or retry policy is added.Impact
Failed pre-reply turns leave
This turn did not run: <error>.in the thread, with a sanitized/redacted error bounded to 512 characters. Aborts, existing assistant errors,lastRunError, and banners retain their prior behavior. The Control UI uses its existing neutral custom-report rendering, matching historical workspace recovery failures.Custom reports intentionally retain existing model-history behavior: the embedded harness converts them to user-role context, making the bounded failure available on the next turn. This change does not set
excludeFromContextor alter filtering. Seepackages/agent-core/src/harness/session/session.tsandpackages/agent-core/src/harness/messages.ts.Evidence
Rebased onto
984d417f807736a556aaf2299fcb379d084d5f3eafter main introduced a documentation conflict. Both main's activity-row paragraph and this PR's failure-notice sentence were preserved. All eight production/test files are byte-identical to the previously CI-green repair. The required focused suites were rerun after rebase:Fresh rebased-branch autoreview:
The initial owner regression failed because no report was persisted. Dispatch-level regressions then reproduced both ClawSweeper findings on head
473d4ba0ff08dd3e4e206618a9873692b0deac16: fallback history placed the report before its input, and restart-safe history omitted the report. Both findings are addressed in this revision.Pre-rebase focused proof (exit 0; production/test files unchanged by rebase):
node scripts/check-changed.mjsexited 0 on the pre-rebase repair. Final output:Fresh independent Codex autoreview, P0–P2 (exit 0):
The unchanged custom-report UI rendering was also verified with six mocked Control UI E2E tests and inspected synthetic before/after captures. The new backend regressions verify the actual SQLite transcript order through dispatch finalization, retry-identity retention/cleanup, duplicate suppression, and the committed-settlement result after report failure.
Screenshots
Captures remain local as requested; no upload was performed.
/var/folders/gl/hry704r5567fbcvp_mzdpg3m0000gn/T/pr-b-durable-run-failure-6dXDF0/before-no-reply.png/var/folders/gl/hry704r5567fbcvp_mzdpg3m0000gn/T/pr-b-durable-run-failure-6dXDF0/after-durable-notice.pngDocs
docs/web/control-ui.mdstates that a turn failing before any reply leaves a durable notice in the thread.