Skip to content

fix(cron): align lifecycle tests with controller retirement - #195026

Merged
steipete merged 1 commit into
mainfrom
loops/l417-cron-isolated-agent
Nov 8, 2026
Merged

steipete merged 1 commit into
mainfrom
loops/l417-cron-isolated-agent

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes two deterministic cron test failures in scheduled main run 42442788470 after #194907 changed active-run diagnostics.

User Impact

No runtime behavior changes. Restores cron coverage of message completion, controller retirement, and admission cleanup after a finalization failure.

Why This Change Was Made

The introducer is ee3ec605a59c (#194907), whose raw parent is the previous green scheduled head 5e1a27a9bcc4. Its shared message lifecycle now consumes a completed input while preserving processing until the active controller retires. The extra event is the final controller-owned idle transition; it is not a duplicate queued input.

Keep the strict ordered event assertion, now checking processing with zero queued inputs before message completion and idle with zero queued inputs after controller retirement. Inject the finalization error at queue consumption instead of the obsolete immediate-idle transition; retain the exact rejection and admission-release assertions. Scoped spy disposal replaces manual cleanup. The patch has no production changes and reduces test code by three lines, with no baseline changes. Its hunks are separate from #188301's imports and appended timeout test.

Related: #194907. This is a coordinator-requested repair of the named main failures.

Evidence

  • On base 9a5df3d60f12b6c303225c50abeaa4d17bd27108, the two named files reproduced both reported failures: 2 failed, 16 passed (66.30 s including cold worker preparation).
  • With the fix, node scripts/run-vitest.mjs src/cron/isolated-agent/run.diagnostic-events.test.ts src/cron/isolated-agent/run.session-lifecycle.test.ts --maxWorkers=1: 18 passed, 2 files, 19.65 s Vitest duration / 21.49 s wrapper duration. CI seconds are pending.
  • Touched-file lint and types passed through scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json --type-check; touched-file formatting and git diff --check passed.
  • Codex autoreview of the complete local patch against the base above: P0–P2 scoped-clean, no findings. Source review included the unchanged lifecycle, diagnostic writer, controller, cron execution/preparation, and queue documentation. Review did not independently execute tests.
  • Broad validation is deferred to PR CI. No workflow dispatches, reruns, remote test allocations, or live Gateway changes were performed. The one original failed-job log fetch returned no content; local reproduction supplied the failure evidence.

@clawsweeper

clawsweeper Bot commented Nov 8, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR updates cron diagnostic expectations and failure injection to match controller-owned retirement.

Example: A cron run adopts session persisted-run-session and completes its queued input.

  • Before: The test expects immediate idle before message.processed and fails against the current lifecycle.
  • After: The test expects processing with queueDepth 0, message.processed, then controller-owned idle.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The minimal patch matches the production contract and preserves distinct regression coverage; validation consists of reported harness results, with required CI incomplete.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored test-only PR changes no shipped behavior; its reported focused red/green runs exercise the cron runner through the existing test harness.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Stale cron tests fail against the intended lifecycle and no longer inject finalization failure at the original cleanup boundary.
Reason: The repair preserves useful ordering, adopted-session identity, queue accounting, and cleanup coverage without changing production behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs stale lifecycle tests while preserving controller ownership and admission-cleanup coverage; no actionable patch defects were found.

Priority: P3
Reviewed head: 4019d3213f34cecc1b37b7a565c1f61938437164

Before merge

None.

Findings

None.

Agent review details

How this fits together

The isolated cron runner prepares and executes an agent turn, publishes message diagnostics, and releases session work; the shared message lifecycle consumes queued input while the session controller owns final retirement.

flowchart TD
CronJob --> IsolatedRunner
IsolatedRunner --> MessageLifecycle
MessageLifecycle --> DiagnosticEvents
IsolatedRunner --> SessionController
SessionController --> DiagnosticEvents
Loading

Technical review

Best possible solution:

Land this focused test adaptation once the required checks complete successfully.

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

Current source deterministically emits processing during message completion and idle at controller retirement, contradicting the base test expectation; the PR reports matching base failures and passing repaired tests, which this review did not rerun.

Is this the best way to solve the issue?

The patch is the smallest complete repair: update the ordered diagnostic contract and move fault injection to message completion while retaining rejection and admission-release assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 43f6e303f0a0.

Provenance checked

  • Cron diagnostic event ordering keeps the original intent (fix(cron): emit message.queued/processed for isolated-agent turns #79214: Expose paired isolated-cron message lifecycle events with the adopted run identity and balanced queue accounting.)
  • Final diagnostic failure injection keeps the original intent (e2f841b: Ensure an exception during final lifecycle marking cannot bypass cleanup and leave session admission active.)
  • Controller-owned processing and retirement keeps the original intent (ee3ec60: Consume completed message input without reporting an active run idle before its controller retires.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vito Cappello: Raw commit e2f841b adds src/cron/isolated-agent/run.session-lifecycle.test.ts:261 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e2f841bf1c12; files: src/cron/isolated-agent/run.session-lifecycle.test.ts)
  • Arnab Saha: Raw commit 804a31e adds src/cron/isolated-agent/run.diagnostic-events.test.ts:48 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 804a31ec5ca2; files: src/cron/isolated-agent/run.diagnostic-events.test.ts)

PR surface

Tests -3. Total -3 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 14 17 -3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 14 17 -3

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P3: This is a focused test-maintenance repair with no runtime behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a focused test-maintenance repair with no runtime behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 November 7, 2026, 11:53 PM ET / November 8, 2026, 04:53 UTC.

Preserve the processing and queue-consumption contract introduced by #194907. Assert controller retirement ordering and inject finalization failure at message completion while retaining rejection and admission-release checks.

Co-authored-by: steipete <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the loops/l417-cron-isolated-agent branch from 4019d32 to 310d155 Compare November 8, 2026 06:24
@steipete
steipete merged commit 32f14c9 into main Nov 8, 2026
96 checks passed
@steipete
steipete deleted the loops/l417-cron-isolated-agent branch November 8, 2026 06:51
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…#195026)

Preserve the processing and queue-consumption contract introduced by openclaw#194907. Assert controller retirement ordering and inject finalization failure at message completion while retaining rejection and admission-release checks.

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants