Repository navigation
fix(agents): keep a streaming preflight flush alive and let a silent one fail open - #205687
Conversation
Co-authored-by: RomneyDa <[email protected]>
Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: c3b87dca-c363-4a4e-8381-f419c8b4a7a4
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThe PR forwards private memory-flush progress to the waiting reply, abandons silent flushes without failing the reply, and lets compaction handle its own timeout first. Example: A private memory flush emits one delta and then stays silent with compaction.timeoutSeconds set to 5.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a confirmed watchdog gap that remains on main and merits keeping open; no definite production-code defect was found, but exact-head CI reports a failing changed regression. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherReply preparation awaits private memory maintenance before compaction and foreground inference; model-output observations now refresh the parent reply watchdog without forwarding private content. flowchart TD
A[Incoming message] --> B[Reply preparation]
B --> C[Private memory flush]
C --> D[Model transport]
D --> E[Output progress callback]
E --> F[Reply watchdog]
C --> G[Compaction and foreground reply]
Technical reviewBest possible solution: Keep private-flush liveness connected to the existing reply watchdog while bounding optional maintenance through its existing cancellation and failure-accounting owners. Do we have a high-confidence way to reproduce the issue? The linked issue provides official-release failure traces and an independent Gateway reproduction; current main still lacks the private-flush-to-parent progress connection, although this read-only review executed no target code. Is this the best way to solve the issue? The approach fits the existing ownership boundaries: it forwards only progress, preserves private transcripts and tool authority, and treats flush expiry as optional-maintenance failure rather than foreground failure. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ca090d4b68a4. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +73, Tests +367. Total +440 across 14 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReview history (3 earlier review cycles)
Reviewed November 26, 2026, 1:31 AM ET / 06:31 UTC (Revision 4). |
Co-authored-by: RomneyDa <[email protected]>
Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: 8e01889d-abe8-4435-8b71-12db721a45a8
A reply waiting on its private memory flush now aborts the flush after a full compaction progress window without output and tells the user which model stalled and what to do. Compaction reports its own timeout before the reply watchdog backstop, so a stuck compaction no longer ends as a generic stall. Co-authored-by: RomneyDa <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
… cycle Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
A reply's private memory flush that sends no output for the compaction progress window is now abandoned as an ordinary, counted flush failure instead of failing the turn. A slow but healthy local model no longer loses the reply; the flush is retried on a later turn and stops after the existing three-failure limit. Co-authored-by: RomneyDa <[email protected]>
The compaction stall copy changed an existing error state without being needed for the fix. Preflight compaction failures keep their existing wording; the change keeps only the flush progress and bounded flush. Co-authored-by: RomneyDa <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Preserve main’s preflight transcript estimates and the reply’s fail-open memory flush. Co-authored-by: RomneyDa <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…one fail open (#205687) * fix(agents): keep replies alive while memory flush streams Co-authored-by: RomneyDa <[email protected]> * fix(agents): keep replies alive while memory flush streams Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: c3b87dca-c363-4a4e-8381-f419c8b4a7a4 * test(gateway): verify private flush with a unique canary Co-authored-by: RomneyDa <[email protected]> * Publish openclaw/long-session-stall Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: 8e01889d-abe8-4435-8b71-12db721a45a8 * fix(agents): fail a stalled preflight within the compaction window A reply waiting on its private memory flush now aborts the flush after a full compaction progress window without output and tells the user which model stalled and what to do. Compaction reports its own timeout before the reply watchdog backstop, so a stuck compaction no longer ends as a generic stall. Co-authored-by: RomneyDa <[email protected]> * test(gateway): share preflight fixture setup and break the stall type cycle Co-authored-by: RomneyDa <[email protected]> * test(gateway): drop unused stall scope Co-authored-by: RomneyDa <[email protected]> * fix(agents): let a reply continue past a stalled memory flush A reply's private memory flush that sends no output for the compaction progress window is now abandoned as an ordinary, counted flush failure instead of failing the turn. A slow but healthy local model no longer loses the reply; the flush is retried on a later turn and stops after the existing three-failure limit. Co-authored-by: RomneyDa <[email protected]> * refactor(agents): keep the existing preflight compaction failure copy The compaction stall copy changed an existing error state without being needed for the fix. Preflight compaction failures keep their existing wording; the change keeps only the flush progress and bounded flush. Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 26f82df) Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…one fail open (#205687) Report private flush output as progress without forwarding content. Time out only the stalled flush, count the failure under the existing policy, and allow compaction and the reply to continue. Let compaction report its own deadline before the reply watchdog backstop. Release adaptation: preserve the release session-store routing and queued follow-up refresh imports, and omit the unrelated harness artifact spelling refactor. The stall guard uses only the watchdog progress contract; document the reply behaviour. The large-transcript compaction worker fix (#205783) is already in the parent line and remains intact. Companion audit found no later same-path or PR/SHA follow-up on pinned main. (cherry picked from commit 26f82df) Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
…one fail open (openclaw#205687) * fix(agents): keep replies alive while memory flush streams Co-authored-by: RomneyDa <[email protected]> * fix(agents): keep replies alive while memory flush streams Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: c3b87dca-c363-4a4e-8381-f419c8b4a7a4 * test(gateway): verify private flush with a unique canary Co-authored-by: RomneyDa <[email protected]> * Publish openclaw/long-session-stall Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: 8e01889d-abe8-4435-8b71-12db721a45a8 * fix(agents): fail a stalled preflight within the compaction window A reply waiting on its private memory flush now aborts the flush after a full compaction progress window without output and tells the user which model stalled and what to do. Compaction reports its own timeout before the reply watchdog backstop, so a stuck compaction no longer ends as a generic stall. Co-authored-by: RomneyDa <[email protected]> * test(gateway): share preflight fixture setup and break the stall type cycle Co-authored-by: RomneyDa <[email protected]> * test(gateway): drop unused stall scope Co-authored-by: RomneyDa <[email protected]> * fix(agents): let a reply continue past a stalled memory flush A reply's private memory flush that sends no output for the compaction progress window is now abandoned as an ordinary, counted flush failure instead of failing the turn. A slow but healthy local model no longer loses the reply; the flush is retried on a later turn and stops after the existing three-failure limit. Co-authored-by: RomneyDa <[email protected]> * refactor(agents): keep the existing preflight compaction failure copy The compaction stall copy changed an existing error state without being needed for the fix. Preflight compaction failures keep their existing wording; the change keeps only the flush progress and bounded flush. Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]>
…l UI (#204325) * fix(agents): default Access to a model's only advertised program Cyber models advertise only Daybreak Red and reject Standard, but the runtime default fell back to Standard whenever no accessPrograms.cyber was configured, so unconfigured cyber-model turns outside the Control UI failed with invalid_access_program. The default now follows the selected account's advertised programs from the prepared model catalog for both the catalog projection and the physical request. * test(agents): satisfy test typecheck for Access default contracts * test(agents): give the overflow-compaction runtime fixture its isCurrent contract * fix(agents): read advertised Access programs only on routes that send one Dispatch now skips the prepared-catalog account read for providers and routes that never send an Access program, so non-OpenAI turns do no extra account-catalog work. The default resolver and dispatch share one route predicate. (cherry picked from commit 862c71e) Release adaptation: Keep stable's Daybreak toggle and separate Access selector wording; document the advertised single-program default and stale-choice error without importing the UI behavior from #204302. Include eccac8a (#204461), which keeps the attempt lookup private and tests the dispatch wrapper. Role, current-account, and entitlement checks are unchanged. Later same-file changes not needed: a1ba2bc (#204545) is newer Control UI behavior; d2699a8 (#204847) adds separate participation limits; f00839d adds MCP requester propagation; 26f82df (#205687) adds streaming preflight progress; 41dc731 (#195479) retains transcript targets across catalog reloads; 4ff18a0 changes project-move prompt inputs. None is a dependency of the Access default. Co-authored-by: RomneyDa <[email protected]>
Problem
In #205566 a long session can hit the reply watchdog before the reply's model is ever called. The reply's private memory flush runs in a separate session, so the reply watchdog did not see its streamed output. A flush that never answered hung until the 360 s reply watchdog. Compaction's own timeout fired at the same moment as the watchdog. In both cases the user saw only the generic stop: "Couldn't finish this reply" ("This turn was interrupted because it stopped making progress").
Change
agents.defaults.compaction.timeoutSeconds, default 180 s), and each output delta resets it. On expiry only the optional flush is aborted. It is recorded like any other flush failure, counted toward the existing three-failure limit, never shown to the user, and the reply continues: preflight compaction, then the reply itself.SESSION_WATCHDOG_MAINTENANCE_GRACE_MS), so compaction's existing timeout handling runs first. A prompt that still fits continues to the reply (existing threshold contract). Failure copy is unchanged.memory-flush-outcome.tswithout changing stored state. No configuration, migration, or dependency changes.Error surfaces
Audited against merge-base
b8992c005468. This PR adds no new throw, refusal, exit, rollback trigger, tightened validation, or "fail the turn" condition. It touches no update path.9877950a.e807a684. It was not needed for the fix, and the existing copy is kept.timeoutSecondsAccepted trade-off: if the reply's own model is completely unresponsive, the user now reaches the generic stop after the flush window plus the reply watchdog, not after 360 s alone. A healthy but slow model, the reported case, gets its reply instead of losing it.
Evidence (exact head
a248484a1a2f)Chromium → a real, isolated OpenClaw Gateway → a scripted local OpenAI Responses provider. The provider sent one text delta on the optional private flush, then left the connection open without a completion. The configured no-output window was 5 s. Runs used Node v26.12.1 and private rootless Podman with
network=none, not a live Gateway.Redacted request/response trace
Elapsed time is relative to observing the flush request. Provider request order and final browser text are from the captured logs. The next request was observed before the browser rendered the reply; its exact timestamp was not logged. Warm-up replies are included in the request lists.
Streaming flush and required compaction (Gateway RPC)
The unchanged three Gateway regressions ran against this head over an isolated Gateway and provider socket. The streaming case advances only the reply watchdog’s clock, not socket I/O or real timers:
The other Gateway cases passed too: silent flush →
flush, summary, reply; silent compaction →summary, reply. Both verified a delivered reply and no generic watchdog stop after their configured 5 s silence window. The normal isolated Gateway setup stopped before tests on a missing@openclaw/proc-safe/filesystem-launchdeclaration on both revisions; the isolated Control UI project’s full artifact build ran the same unmodified Gateway assertions via an import-only test wrapper.Checks and prior CI failure
pnpm validators:checkandgit diff --checkpassed. The completed and interrupted private-transcript regressions both passed in isolated Node and pinned Bun, with assertions unchanged. The other focused stall/accounting tests passed (3/3).e807a684: the first Bun CI attempt observedfailedinstead ofcompletedin the completed-flush case. The second attempt at the same head ran and passed that exact case. The original cause is not established; the passing runs are not a diagnosis. No assertion or timeout was weakened.Clean comparison
Scenario: a reply's memory flush goes silent (5 s window). Before = pre-fix baseline
b8992c00, captured after 360 s. After =a248484a1a2f, captured 5.884 s after observing the flush. The head recapture matched both hosted after PNGs byte-for-byte. Same viewport (1280×900), theme, fixture data and flow. The fixture is a scripted local provider.Before: the turn ends with the generic stop after the 360 s watchdog

After: the flush is abandoned and the reply arrives

Annotated comparison
Before

After

Refs #205566
Worked on by