Repository navigation
fix(cron): preserve cron context in session entry for async completion wakes - #101078
Conversation
340dbae to
5176542
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 6:06 AM ET / 10:06 UTC. Summary PR surface: Source +90, Tests +211. Total +301 across 6 files. Reproducibility: yes. source-reproducible: current main's generated-media completion handoff omits the cron provider/model/thinking/bootstrap context that normal cron execution carries, and the linked issue plus PR body provide symptom evidence. Review metrics: 3 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the narrow cron-aware wake restoration with its regression coverage and live proof after maintainers accept the durable marker, base-key routing, and trusted synthetic override contract. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main's generated-media completion handoff omits the cron provider/model/thinking/bootstrap context that normal cron execution carries, and the linked issue plus PR body provide symptom evidence. Is this the best way to solve the issue? Yes. This is the best bounded fix because it persists the missing cron marker, restores context only for cron entries, uses the persisted base session when run keys are ephemeral, and covers the invariant with focused tests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ae8d735bf54. Label changesLabel justifications:
Evidence reviewedPR surface: Source +90, Tests +211. Total +301 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (12 earlier review cycles; latest 8 shown)
|
ebc2377 to
3aa8298
Compare
3aa8298 to
1b532f4
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
ecccb9b to
bd10be2
Compare
|
Maintainer review and rewrite complete. The final implementation keeps each detached cron run's resumable context in a durable exact-run row, claims and releases it at the gateway owner boundary, atomically projects the settled snapshot back to the stable cron row, preserves native CLI/model/tool/delivery policy, and bounds release-write recovery without rerunning the model. Terminal media cleanup and stale gateway-generation fallback are covered as well. Land-ready evidence:
Known gap: no credentialed live provider call was run against untrusted contributor code. Sanitized regression proof and exact-head hosted CI are the merge gates. Thank you @xialonglee for reporting and implementing the original async-media wake fix. |
|
Merged via squash.
|
…n wakes (openclaw#101078) * fix(cron): preserve cron context in session entry for async completion wakes (openclaw#99919) Persist bootstrapContextRunKind on the session entry after cron agent runs, and restore provider/model/thinking/runKind from the session entry into directAgentParams when an async completion wake (e.g. media generation) resumes a cron session. Before this fix, async completion wakes lost the original cron run context and fell back to account defaults, causing multi-step cron tasks to silently dead-end after the first async media generation call. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(cron): authorize model override on trusted in-process dispatch for cron context restoration * fix(cron): persist bootstrapContextRunKind on base session entry for async completion wakes * fix(cron): route async completion wake to base cron session key instead of ephemeral run key When the cron run-key fallback fires, record the base cron key as effectiveSessionKey so deliverDirectSubagentAnnounce can route the agent call to the persisted session row with its transcript and task context instead of starting a fresh turn (openclaw#99919). * fix(cron): add bootstrapContextRunKind to session entry slot keys and declare loadRequesterSessionEntry return type * fix(cron): rebase onto upstream main, restore upstream agent-command behavior while keeping bootstrapContextRunKind persistence * fix(cron): persist bootstrapContextRunKind from a pre-mutation snapshot to produce a real delta * fix(cron): move pre-mutation snapshot inside guard so initialEntry is non-optional * fix(cron): preserve async media continuation context Co-authored-by: Peter Lee <[email protected]> * fix(cron): retain continuation after base cleanup * test(gateway): complete agent scope mock * test(gateway): preserve agent scope exports * test(cron): persist mocked session mutations * test(cron): model persisted session fixtures * fix(agents): snapshot cron continuation retries * fix(cron): harden async continuation settlement * test(cron): control continuation recovery clock * fix(gateway): narrow continuation model row * chore(changelog): defer cron continuation note --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes #99919.
An isolated cron turn can finish while
image_generate,music_generate, orvideo_generateis still running. The completion wake previously lost the exact cron run's model, thinking level, tool policy, native CLI session binding, transcript context, and delivery policy. Multi-step jobs could therefore resume with defaults, emit an incomplete reply, or silently stop.Why This Change Was Made
The final maintainer rewrite keeps continuation state at the owners that can enforce it:
:run:row while detached media is pending and projects normal history to the stable cron row.UNAVAILABLE, retry in a bounded unref'd worker, and repair the cached terminal result after recovery without rerunning the model.This is intentionally an exact-run protocol rather than a base-session fallback: concurrent cron runs and provider-owned CLI sessions must not share mutable continuation state.
User Impact
Async media completion now resumes the original isolated cron task with its exact runtime and delivery context. Successful generated media remains deliverable during gateway restart or persistence degradation, and hidden continuation rows are bounded by terminal cleanup and cron retention.
Evidence
cbx_aa62c4edff9f, runrun_8b37e22c4a9d: 636 focused tests passed across gateway settlement, session accessor, cron identity/policy, restart recovery, media lifecycle, and cleanup.run_068d566be879: 1,195 tests passed.29062957840: build, production types, test types, lint, session-accessor boundary, security scans, and completed compact shards are green.oxfmt, type-awareoxlint,git diff --check, andscripts/check-session-accessor-boundary.mjspassed.No credentialed live provider call was run on untrusted contributor code. The contributor's earlier stub-assisted behavior proof is useful supporting evidence; sanitized regression tests and exact-head CI are the merge gates.