Repository navigation
fix(cron): link active tasks to execution transcripts - #117679
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 7:47 PM ET / 23:47 UTC. ClawSweeper reviewWhat this changesThe branch changes active cron task records to adopt the execution transcript reported by the cron runner instead of pre-populating creator or provisional session links. Merge readinessThis PR remains necessary: current main still pre-populates active cron task links from job metadata, while the runner owns the exact execution transcript. The branch moves that fact to the execution-start boundary, covers current/isolated/custom targets and cancellation, and includes reported real Gateway-plus-CLI proof; keep it open for maintainer handling and the normal final merge gate. Priority: P2 Review scores
Verification
How this fits togetherCron creates a durable task row before scheduled work runs, while the cron runner later resolves the exact agent execution session. The task registry exposes that row to task views and cancellation, so its child-session link must match the run actually in progress. flowchart LR
A[Scheduled cron job] --> B[Create active task row]
B --> C[Cron runner starts work]
C --> D[Reports execution session]
D --> E[Update task transcript link]
E --> F[Tasks UI and API]
E --> G[Cancellation handling]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +21, Tests +92. Total +113 across 9 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the focused owner-boundary repair after final current-head checks: use only the runner-reported execution session for agent-turn task links, retain deterministic system-event links, and retain taskKind as the separate canonical cancellation lifecycle fact. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main assigns the active task link before the runner callback publishes the exact execution session. The branch’s focused tests and reported Gateway/CLI run cover the observable state transition for current, isolated, and custom session targets. Is this the best way to solve the issue? Yes: recording the runner callback’s session at its producer boundary is more maintainable than inferring execution identity from creator metadata, while taskKind preserves the distinct cancellation invariant without a fabricated transcript link. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4153451a9a1d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review The PR body now includes exact-head real behavior proof from Testbox run 30723680725. It uses an isolated built Gateway, mock provider, public CLI task projection, and non-default ports to show the active task adopting the runner session key before completion. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready maintainer validation is complete at exact head eef2967. The repair now records the execution transcript only when the cron runner owns the exact session identity, keeps headless work childless, and records task kind separately so cancellation no longer infers lifecycle state from the presence of a presentation link. Proof:
The latest ClawSweeper review is proof sufficient, 5 of 6, with no findings. Its final merge-head, sibling-session-state, and maintainer-handling moves are covered. Known proof gaps: none for the changed contract. |
* fix(cron): link tasks to execution sessions Fixes openclaw#117678 * fix(tasks): preserve canonical cron cancellation state
Closes #117678
What Problem This Solves
Fixes an issue where an active scheduled task could link to the session that created the job instead of the transcript where the scheduled run was actually executing. Opening the task could therefore show an unrelated conversation or a provisional key that never received the run.
Why This Change Was Made
Cron task rows now start without an invented transcript link for agent turns and adopt the exact session key reported by the runner when execution begins. Both timeout and no-timeout paths use the same callback; main system events retain their deterministic per-run key, headless jobs stay childless, and terminal outcomes keep their existing authoritative session projection. A durable task-kind marker now distinguishes canonical pre-session rows from unmarked legacy cleanup rows, so cancellation no longer abuses transcript-link presence as a lifecycle sentinel.
User Impact
Operators opening active automation tasks now land in the real execution transcript for current, isolated, and custom persistent session targets. Script, command, and heartbeat tasks no longer advertise nonexistent conversations.
Evidence
eb8c22ed13f9865e07c0e363706183188e2a8fd1: custom and isolated jobs can carry both a creatorjob.sessionKeyand a different execution target, while the task projection prefers the creator metadata.tbx_01kyzs0ds7t8df63v96a4d35mg, run 30722526103: 81/81 focused cron and task assertions passed, covering current, isolated-with-source, custom persistent sessions, timeout/no-timeout callbacks, main system events, and headless work.tbx_01kyzswphf6sw5ft5584xgxeph, run 30723047598: the exact failed timer regression and full task-registry suite passed 178/178 after the ownership repair.tbx_01kyzv0jw2s8c6h74fekm8gxrm, run 30723680725: a cron agent turn remained activelyrunning, carriedtaskKind: "automation_run", and changed from creator sessionagent:main:telegram:group:creator-proofto the runner's exactagent:main:cron:<job>:run:<session>key before terminal completion. The full product build passed first; the owned Gateway, mock provider, state directory, and non-default ports were cleaned up.019fbfa2-b05e-7ff0-a6f4-be30d1432aa0: TruffleHog clean, zero findings, patch correct at 0.96 confidence.job.sessionKeyis creator/wake/delivery metadata rather than execution identity, and verified the runner callback is the authoritative transcript boundary.git diff --checkpassed. Production is+55/-34(net+21); tests are+141/-49.Release-note context: active cron task links now open the transcript where the scheduled run is actually executing.
AI-assisted: yes. The execution owner, task registry projection, timeout siblings, history, and focused proof were independently reviewed.