Skip to content

fix(cron): show outcomes for authority-only withheld follow-ups - #203029

Merged
steipete merged 1 commit into
mainfrom
codex/cron-withheld-visible-outcome-2
Nov 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cron-withheld-visible-outcome-2

Conversation

@steipete

@steipete steipete commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #202997

What Problem This Solves

A withheld cron follow-up still disappeared after #202997 was live. Reported metadata from release 95e9afcf2926 (including merge e43daaa4045a) shows followup queue: input withheld; refusing replay: cron delivery owner retired at 01:06:14 PST on November 21, with no recording-failure log, non-ok cron receipt within 45 minutes, or session transcript notice. The same refusal appeared at 22:54:55, 23:01:33, and 00:38 PST on the preceding release. The refusal had no session or job identifier.

User Impact

Revoked cron continuations record a failed, not-delivered history outcome and a visible session failure report wherever those existing owners are available, including follow-ups that retain cron authority without automation metadata. The refusal log identifies the known session/job/run and successful recording paths; unavailable paths have explicit non-outcome reasons. Revoked inputs still cannot replay. No schema, store, retry, durability, retention, or restart recovery policy changes.

Why This Change Was Made

At base b229b2664537, src/auto-reply/reply/followup-runner.ts:434 consumes the revoked input, but line 460 gates both history and session recording on queued.run.scheduledAutomation. This is the vanishing line for an authority-only continuation. Line 468 can also silently skip a fence with no recordWithheld, while line 502 requires a source deliver callback for completion reporting.

The uncovered shape is a background session-event follow-up carrying the original cron-fenced operator authority but no scheduledAutomation, plus a Goal successor of that event. For example, src/agents/bash-tools.exec-notify.ts:75 captures the producing operator authority, src/auto-reply/reply/session-event-context.ts:44 recovers it, and session-event-handoff.ts:525 forwards it independently of automation metadata. The handoff's callback at line 633 records completion failure in its closure but does not render completion.notice; a Goal successor clears that callback at goal-continuation.ts:257. By contrast, buildTranscriptFollowupRun retains base.run, so a Goal directly originating from a scheduled turn retains automation metadata and was covered by #202997. The supplied production metadata cannot distinguish which event or Goal produced the refusal; this PR proves the missing shape without claiming an unavailable production identity.

The cron delivery fence now carries its diagnostic recorder and job ID on its typed refusal error, preserving the existing CronRunReceiptRevisionError contract. The runner reads that error (including wrapped causes), independently records through the existing history/session-report owners, and logs explicit missing-handle/target reasons. An already-revoked authority also enters this settlement instead of silently taking the early-abort return. Recording remains best effort, with attributed failure logs and no replay. The original occurrence's result is preserved; the existing history owner records the continuation separately.

Accepted edges: a removed/reset session can reject its existing report writer; the other recording path still runs. Storage failures are visible warnings, not a new retry queue. Fences without a recorder explicitly report the unavailable history path. All diagnosis and proof stayed in the worktree and repository tooling; no operational host or Gateway was contacted.

Simplify pass: retained one recording boundary and the existing outcome owners. Consolidated the queue/execution test fixtures and repeated settlement assertions without removing cases. Versus b229b2664537 after formatting: production +68 lines across three files; tests -6 in followup-runner.test.ts and +6 in service.restart-delivery.test.ts, net test lines 0; troubleshooting docs +1.

Evidence

The extended regression drives the real follow-up runner, cron fence, history writer, and session-report owner for both retained-automation and authority-only follow-ups. It verifies failed history, the session's withheld report, and continued fencing. The runner suite also checks the explicit non-outcome when neither a receipt handle nor session target exists.

Red on b229b2664537, before production edits:

pnpm test src/cron/service.restart-delivery.test.ts --maxWorkers=1
PASS records a retired cron follow-up without replay (automation=true)
followup queue: input withheld; refusing replay: cron delivery owner retired
FAIL records a retired cron follow-up without replay (automation=false)
AssertionError: expected [] to deep equally contain ObjectContaining{...}
Tests  1 failed | 10 passed (11)

The failed expectation was the failed/not-delivered history entry; this was a behavior failure, not fixture setup. With the repair, both cases record history and a session notice:

followup queue: input withheld; refusing replay: {"sessionKey":"agent:main:withheld-cron","jobId":"job-1","runId":"withheld-cron:1765584000000","reason":"cron delivery owner retired","recorded":["history","session-notice"],"nonOutcomes":[]}
Tests  11 passed (11)

All six follow-up runner files and direct consumers passed in four repository test shards (149.75 seconds total): service.restart-delivery.test.ts, delivery.test.ts, session-run.test.ts, server-cron-completion.test.ts, timer-outcome-finalization.receipts.test.ts, and run-receipt-store.test.ts. This includes #202997's regression, cancellation/removal fencing, and restart delivery behavior. Core typecheck plus targeted messaging and services-cron test typechecks passed. Touched-file lint, format, docs MDX sanity, and git diff --check passed. One earlier runner attempt was invalidated because source changed during compiled-artifact use; that was rerun on unchanged inputs. Initial local type/lint findings were repaired.

Final changed-file run: pnpm test src/auto-reply/reply/followup-runner.test.ts src/cron/service.restart-delivery.test.ts --maxWorkers=1 passed 32 runner tests and 11 restart-delivery tests in 55.87 seconds total. Per-file wall times were 5.87 seconds (runner; test bodies about 0.06 seconds) and 46.57 seconds (cron; test bodies about 3.5 seconds). The cron wall time includes a cold worker-artifact preparation of 33.22 seconds for the repository graph, not extra per-test work; this existing production-boundary composition exercises the real history and session writers. Exact-head CI completed successfully in 786 seconds (09:46:23–09:59:29 UTC), including broad repository gates.

Local candidate and committed-head Codex autoreview against b229b2664537, P0–P2: scoped-clean, no accepted/actionable findings. Committed review head: 830fbe20db1ea2afc687bde96e273c896370c357. Native review artifacts validated with zero findings; preparation preserved that head without rebase or push.

Exact-head CI run 44891154710 completed successfully. node scripts/watch-pr-ci.mjs 203029 830fbe20db1ea2afc687bde96e273c896370c357 returned GREEN, zero pending, with 12 superseded checks distinguished from the raw GitHub rollup. No CI reruns.

@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T09:48:41.195589Z 830fbe2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Nov 21, 2026
@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR records outcomes for withheld cron continuations that retain authority without automation metadata.

Example: A continuation targeting agent:main:withheld-cron retains job-1's authority after its active marker retires, without scheduledAutomation metadata.

  • Before: The runner consumes the refused continuation without recording its history outcome or session notice.
  • After: The refusal carries the captured history recorder, allowing independent history and session reporting without replay.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused repair has meaningful integration coverage, but required product-path proof is absent and the new summary has a concrete false-success defect; existing persisted formats remain unchanged.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A refused cron continuation can disappear without a matching automation-history outcome or visible session report.
Reason: The maintainer-authored direction restores the existing visible-outcome contract without adding configuration, storage, replay, or recovery policy.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it repairs a source-confirmed reporting gap, but its new diagnostic summary can incorrectly claim that failed history persistence succeeded.

Priority: P2
Reviewed head: 830fbe20db1ea2afc687bde96e273c896370c357

Before merge

  • Confirm history persistence before marking it recorded (P2) - When the cron history write fails, such as a SQLite write failure, recordWithheld still resolves: it calls finishCronRun, whose persistCronOutcome catches recordCronRun errors and only logs a warning. Consequently this new return path includes "history" in recorded even though no history row exists. That contradicts the diagnostic summary's purpose and directs operators toward an outcome that was never saved. Have the existing history owner expose its persistence outcome and include history in recorded only on confirmed success, while preserving best-effort settlement and the independent session recording path.

Findings

  • [P2] Confirm history persistence before marking it recorded — src/auto-reply/reply/followup-runner.ts:529-530

Tests

  • Missing end-to-end proof: Provide redacted isolated-Gateway output showing an authority-only continuation being withheld, its history outcome and visible session report, and no replay; remove credentials, IPs, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The follow-up runner admits queued agent work, cron fences reject retired occurrence authority, and existing history and session-report owners record terminal outcomes.

flowchart TD
  A[Queued continuation] --> B[Follow-up admission]
  B --> C[Cron authority fence]
  C --> D[Typed refusal]
  D --> E[History recorder]
  D --> F[Session report writer]
  E --> G[Diagnostic summary]
  F --> G
Loading

Technical review

Best possible solution:

Keep the existing refusal and recording owners, but report history success only when its persistence owner confirms the write.

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

Source establishes the authority-only continuation path and the metadata gate that suppresses its outcomes; the supplied regression reports the expected base failure, but this review executed no target code.

Is this the best way to solve the issue?

Carrying the existing recorder through the typed refusal is a focused repair that preserves authority and original occurrence results, provided diagnostic success reflects the history owner's actual outcome.

Full review comments:

  • [P2] Confirm history persistence before marking it recorded — src/auto-reply/reply/followup-runner.ts:529-530
    When the cron history write fails, such as a SQLite write failure, recordWithheld still resolves: it calls finishCronRun, whose persistCronOutcome catches recordCronRun errors and only logs a warning. Consequently this new return path includes "history" in recorded even though no history row exists. That contradicts the diagnostic summary's purpose and directs operators toward an outcome that was never saved. Have the existing history owner expose its persistence outcome and include history in recorded only on confirmed success, while preserving best-effort settlement and the independent session recording path.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 346078f73f19.

Provenance checked

  • Withheld continuation recording keeps the original intent (e43daaa: Record refused continuations separately through existing history and session owners while preserving the original occurrence's result.)
  • Queue revocation and retry distinction keeps the original intent (d979dba: Only recorded revocation ends input custody; temporary authority assertion failures retain the queued input for retry.)
  • Cron delivery refusal keeps the original intent (187594c: Fence retired occurrence delivery to prevent duplicate one-shot delivery after uncertainty and restart.)
  • Live scheduler handover keeps the original intent (ce76ed2: A same-store cron configuration reload retires scheduling without aborting or suppressing already-running jobs.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e43daaa adds src/cron/service/delivery-attempt-fence.ts:56 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e43daaa4045a; files: src/cron/service/delivery-attempt-fence.ts)
  • Ayaan Zaidi: Raw commit d979dba adds src/auto-reply/reply/followup-runner.ts:408 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d979dba02457; files: src/auto-reply/reply/followup-runner.ts)
  • Josh Avant: Raw commit 187594c adds src/cron/service/delivery-attempt-fence.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 187594c66309; files: src/cron/service/delivery-attempt-fence.ts)

PR surface

Source +68, Tests 0, Docs +1. Total +69 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 98 30 +68
Tests 2 117 117 0
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 216 147 +69

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: This is a bounded reporting repair for refused automation continuations; it preserves execution and delivery policy.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a bounded reporting repair for refused automation continuations; it preserves execution and delivery policy.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 21, 2026, 5:01 AM ET / 10:01 UTC.

@steipete
steipete merged commit f02d9dc into main Nov 21, 2026
145 of 146 checks passed
@steipete
steipete deleted the codex/cron-withheld-visible-outcome-2 branch November 21, 2026 10:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 22, 2026
- status-message: the fork moved formatVoiceModeLine out (line cap) and
  upstream openclaw#203043 moved formatEstimatedContextBudgetTokens out; together
  they took the last reader of the SessionEntry type import (TS6133).
- followup-runner.test: upstream openclaw#202997/openclaw#203029 replaced the
  createSettledExecution fixture with createExecution("settled" default);
  the fork's suppressed-delivery ordering case follows (TS2552).

No behavior change.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 22, 2026
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
)

(cherry picked from commit f02d9dc)

Release adaptation: Place the captured cron receipt/error contract and troubleshooting text first. Its producer and consumer follow in the paired source commit.

Companion audit: #203029 is required by #202997 to cover authority-only refusal without replay.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
Retain the delivery fence while recording refused cron continuations in existing run history and bounded session failure notices. Preserve the original occurrence outcome and never replay revoked input.

(cherry picked from commit e43daaa)

Release adaptation: Integrate the companion against the stable pre-source queue/cron owners; keep their activated behavior in this source commit after the companion contract. No change to authority or replay policy.

Companion audit: #203029 included as the preceding contract and paired activation; later account/restart lifecycle rows are independent.

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

Labels

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: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant