Skip to content

fix(agents): contain failures publishing saved transcript updates - #173387

Closed
Winoren wants to merge 1 commit into
openclaw:mainfrom
Winoren:fix/transcript-publication-rejection
Closed

Winoren wants to merge 1 commit into
openclaw:mainfrom
Winoren:fix/transcript-publication-rejection

Conversation

@Winoren

@Winoren Winoren commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #173350

What Problem This Solves

Fixes a saved session message being followed by an unhandled rejection when its transcript update cannot be published.

User Impact

A failed post-commit notification no longer escapes as an unhandled rejection that can reach process-fatal handling. The append keeps its existing successful receipt, and a content-free warning tells operators to reload the session to refresh the saved transcript. The failed notification is not replayed automatically.

Why This Change Was Made

Both append adapters share the guarded append generator, which discarded the fallible publication promise after persistence. Observe rejection at that boundary without turning a committed append into a failed write, changing the selected session owner, or broadening the global transient-error policy. The warning omits message content and error text.

Evidence

  • On upstream 3f1011275f54b104ccf33aa6979cd746ac75a5e0, both new sync/async cases fail because a post-commit publication rejection reaches unhandledRejection. The committed SQLite message is present in both cases.
  • After repair, pnpm test src/agents/session-tool-result-guard.transcript-events.test.ts --maxWorkers=1: 20 passed, including the two new failure cases and existing committed-owner, sequence, replay, and callback-rebinding coverage.
  • Rejection is injected with a plain promise-returning closure at the narrow publication boundary. The append, SQLite persistence, event-loop observation, and warning capture are real. Tests also check that neither message content nor private error text enters the warning.
  • Canonical autoreview, P0–P2: scoped-clean, no accepted/actionable findings.
  • Vitest duration 74.83s; wrapper 190.78s, including cold worker preparation (100.926s). Each new case takes approximately 1.1s; the existing integration file repeatedly creates real SQLite session fixtures. CI seconds pending.

Repository wrappers were launched with Node 26.1.0, pnpm 12.10.1, and Vitest 5.0.3, using an independently installed workspace dependency tree (pnpm install --frozen-lockfile) and the repository's selected worker runtime. No live model/provider call, full Gateway daemon run, incognito-deletion race, or full workspace suite was executed. The tests prove local rejection containment after committed append; production incident frequency and process termination were not exercised.

Additional local validation passed: pnpm tsgo:core; node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.agents-sessions.json --incremental; targeted oxlint for both changed files; pnpm format:check -- both changed files; and git diff --check. Remote CI remains separate from these local checks.

AI assistance was used to investigate, implement, test, and review this change.

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 15, 2026
@Winoren
Winoren marked this pull request as ready for review October 15, 2026 18:33
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR catches failed transcript-update publication after a saved append and logs recovery guidance.

Example: An assistant message containing “Completed” commits, then transcript publication rejects.

  • Before: The append succeeds, but the discarded rejection can reach fatal process handling.
  • After: The append remains successful and a content-free warning recommends reloading the session.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and useful, but mocked publication failure does not satisfy the external-PR real-behavior proof gate.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A saved session message can be followed by a publication rejection that terminates the process and leaves subscribers without an update.
Reason: Containing an auxiliary notification failure after commit has clear reliability value and requires only a focused change.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR addresses a concrete current-main defect with a focused correction; no introduced correctness or security defect was found.

Priority: P2
Reviewed head: 541d6708fdc1ea445d3719d135531998de7f1d3a

Before merge

  • Add real behavior proof - The body and discussion supply test results for real SessionManager appends and SQLite fixtures with a mocked rejecting publisher, but no CLI or Gateway execution of the changed failure path. Provide redacted terminal output or logs showing publication failure after commit, continued operation, the warning, and recovery of the saved message; redact IPs, keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied shipped-entry-point evidence shows a real post-commit publication failure being contained while the saved message remains recoverable.
Agent review details

How this fits together

The session append guard sits between agent message persistence and transcript subscribers; it receives messages, commits them through SessionManager, and publishes derived update notifications.

flowchart TD
  A[Agent runtime] --> B[Session append guard]
  B --> C[SQLite transcript commit]
  C --> D[Transcript publisher]
  D --> E[Transcript subscribers]
  D --> F[Publication failure warning]
Loading

Technical review

Best possible solution:

Keep rejection handling at the shared post-commit publication boundary while preserving saved messages, append receipts, and existing authority checks.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes the discarded fallible promise and fatal rejection path; the contributor reports failing baseline cases, but this read-only review executed no target code.

Is this the best way to solve the issue?

The small local catch fits a derived post-commit notification: it avoids reporting a committed append as failed and leaves global error classification and publication authority intact.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 648a3f075861.

Provenance checked

  • Typed post-commit transcript publication keeps the original intent (5976994: Replace file-era notification identity with canonical SQLite targets and notify consumers after persisted appends.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +6, Tests +57. Total +63 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 0 +6
Tests 1 57 0 +57
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 63 0 +63

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A concrete publication error-handling defect can affect process availability, but no observed production incident establishes urgent widespread impact.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply redacted CLI or Gateway evidence of the post-commit publication failure being contained with the saved message recoverable.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 2:48 PM ET / 18:48 UTC.

steipete added a commit that referenced this pull request Oct 17, 2026
Keep committed append receipts successful when live transcript publication
rejects. Record a content-free warning with the session and message IDs
and recovery guidance for both append adapters.

Fixes #173350. Supersedes #173387.

Co-authored-by: D41910 <[email protected]>
steipete added a commit that referenced this pull request Oct 17, 2026
…ad of dropping it (#174947)

The session tool-result guard's shared append path discarded the post-commit transcript publication promise, so a publication failure became a process-level unhandled rejection and the update was silently dropped. The guard now catches the rejection and records a content-free warning that identifies the saved session and message, while preserving the successful append receipt. Production net -2 LOC. Also repairs the mock-exports ratchet red on main (native update maintenance fixture now spreads the real database-context module; baseline shrunk by one). Supersedes #173387, thanks @D41910.

Fixes #173350

Co-authored-by: D41910 <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

Thanks for this! We landed the fix in #174947 (4513e9e), which supersedes this PR and credits you as co-author: a failed post-commit transcript publication is now recorded as a warning instead of an unhandled rejection that silently dropped the update.

@steipete steipete closed this Oct 17, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…ad of dropping it (openclaw#174947)

The session tool-result guard's shared append path discarded the post-commit transcript publication promise, so a publication failure became a process-level unhandled rejection and the update was silently dropped. The guard now catches the rejection and records a content-free warning that identifies the saved session and message, while preserving the successful append receipt. Production net -2 LOC. Also repairs the mock-exports ratchet red on main (native update maintenance fixture now spreads the real database-context module; baseline shrunk by one). Supersedes openclaw#173387, thanks @D41910.

Fixes openclaw#173350

Co-authored-by: D41910 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fire-and-forget transcript publication in the session tool-result guard produces process-level unhandled rejections and silently drops updates

2 participants