Skip to content

fix(agents): correct cron background completion guidance - #199003

Merged
vincentkoc merged 1 commit into
mainfrom
fix-cron-exit-wake-guidance-20261114
Nov 14, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix-cron-exit-wake-guidance-20261114

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #198908

What Problem This Solves

Fixes: delivery-enabled isolated cron agents can be told to end their turn while waiting for a background command, even though the command's completion needs the originating run to remain active.

User Impact

Cron agents receive guidance to collect the command's result before ending their turn. Ordinary conversations retain their automatic completion-wake guidance.

Why This Change Was Made

The shared exec/process formatter now uses the acceptance guard already recorded by the notification owner when deciding whether to promise a wake after turn completion. The existing cron admission guard still rejects completions after their originating run ends. No runtime state or configuration is added.

Evidence

  • Base 2a8e0b3c6ed6afeef33331871c5822024f19f986: the extended real-exec regression fails in all four cron cases because the returned guidance says to end the turn; the ordinary case passes. Vitest 75.41s, wrapper 141.63s including cold worker preparation.
  • Head fb4963ad679a3fb40905e670c47a4e2011a4a68e: the complete exec-followup file passes 18/18, including live/queued completion and ended-run refusal. Vitest 33.25s, wrapper 99.25s. The change adds four net test lines to the existing fixture.
  • Process delivery/activity and prompt-prefix stability: 28 tests across 3 files pass; Vitest 49.60s, wrapper 54.93s.
  • Scoped typecheck, lint, three-file formatting, docs MDX and diff checks pass.
  • Fresh independent implementation review: no actionable findings. Full local ClawSweeper review (same pinned base/head, medium reasoning, complete): patch correct (0.92), no code or security findings. Its proof rating was F/missing because the local-range input had no execution report; the executed red/green and consumer results are recorded above. The rating is reported as received.

The regression executes the actual exec/native-process and session-event owners with fixed command output. It does not measure model compliance or run a scheduled model invocation. No live service, credential, permission, or storage behavior changes.

@clawsweeper

clawsweeper Bot commented Nov 14, 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 docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Nov 14, 2026
@vincentkoc vincentkoc self-assigned this Nov 14, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 14, 2026 16:12
@vincentkoc
vincentkoc enabled auto-merge (squash) November 14, 2026 16:19
@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. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR tells isolated cron agents to collect background command results before ending their turn.

Example: An isolated cron run starts a background command that eventually prints CRON_EXEC_DONE.

  • Before: The running result tells the agent to end its turn, although completion admission fails if the originating run has already ended.
  • After: The running result advises polling to collect the required result before ending the turn.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and has meaningful reported regression coverage, but the required shipped-entry-point proof is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
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 cron agent can follow the tool's advice to end its turn and then miss the completion needed to finish its task.
Reason: The maintainer-authored change restores accurate guidance under the existing lifecycle contract and preserves ordinary conversation behavior.

Regression provenance

Regression provenance — verified: source commit 2a8e0b3c6ed6 by Ayaan Zaidi; canonical PR #198908 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it corrects a current-main cron guidance regression with a focused change; no introduced code or security defect was found.

Priority: P2
Reviewed head: fb4963ad679a3fb40905e670c47a4e2011a4a68e

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide a redacted real-agent isolated cron trace showing the corrected guidance, result collection before turn completion, and the resulting task outcome.
Agent review details

How this fits together

The exec notification owner records completion eligibility on each process; the shared formatter consumes those facts to produce guidance for exec launches and subsequent process observations.

flowchart TD
  A[Cron or conversation agent] --> B[Exec process owner]
  B --> C[Notification destination and acceptance guard]
  C --> D[Shared guidance formatter]
  D --> E[Exec and process results]
  B --> F[Completion admission]
  F --> G[Originating session follow-up]
Loading

Technical review

Best possible solution:

Retain the shared formatter correction using the notification owner's existing acceptance guard.

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

Source establishes the failure path: cron captures a notification destination and acceptance guard, but current main promises an after-turn wake based only on the destination; the PR reports matching base-red/head-green regression results, which were not independently executed in this read-only review.

Is this the best way to solve the issue?

This is the smallest complete guidance repair: consume the existing lifecycle fact in the shared formatter, preserve ordinary wake behavior, and extend the existing regression fixture without adding state or another owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1ac07b333581.

Provenance checked

  • Automatic completion-wake guidance keeps the original intent (2a8e0b3: Avoid repeated polling when a background command's exit can start the next conversation turn.)
  • Manual collection message keeps the original intent (a7ab9fa: Describe effective notification availability accurately when automatic completion cannot occur.)
  • Cron completion acceptance lifecycle keeps the original intent (aee987f: Require the originating cron run through queue acceptance while allowing already accepted completions to execute afterward.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 2a8e0b3 adds src/agents/bash-tools.exec-output.ts:63 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2a8e0b3c6ed6; files: src/agents/bash-tools.exec-output.ts)

PR surface

Source +6, Tests +4, Docs +1. Total +11 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 9 3 +6
Tests 1 5 1 +4
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 16 5 +11

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 P2: Incorrect end-turn guidance can leave a cron task's required command result uncollected, with a focused affected path.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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:

  • P2: Incorrect end-turn guidance can leave a cron task's required command result uncollected, with a focused affected path.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 14, 2026, 11:28 AM ET / 16:28 UTC.

@vincentkoc
vincentkoc merged commit d867f17 into main Nov 14, 2026
222 checks passed
@vincentkoc
vincentkoc deleted the fix-cron-exit-wake-guidance-20261114 branch November 14, 2026 16:44
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

1 participant