Skip to content

fix(cron): let the agent stay silent after a posted automation notice - #207315

Merged
obviyus merged 5 commits into
mainfrom
fix/cron-notice-repair-silence
Nov 28, 2026
Merged

obviyus merged 5 commits into
mainfrom
fix/cron-notice-repair-silence

Conversation

@obviyus

@obviyus obviyus commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

Since #207226, a cron job notice (auto-disabled, or a fallback failure alert) is posted to the owner conversation directly. Its model turn stays as the agent's hidden repair input. That turn still required a visible result, and its input was the bare notice text:

  • When the agent correctly decided it had nothing to add and answered NO_REPLY, the runtime refused that ("NO_REPLY is not allowed") and forced another answer. The user got filler after the notice. On a working conversation the forced replies were "I'm here—what would you like me to call you?", "Got it." and "Noted.".
  • Nothing told the agent that the user had already seen the notice.

Found in the owed end-to-end check of #207226 on a real Telegram DM, with an isolated Gateway and gpt-5.4-mini.

Fix

src/gateway/server-cron-targets.ts, the notice owner. When the notice was posted:

  • The repair turn's hidden input says the notice is already shown to the user, with what they need to do, and must not be repeated. The agent either fixes the cause itself and says what it changed, or answers NO_REPLY. It leaves a disabled automation disabled unless it fixed the cause. The notice text is passed as an untrusted data block, like the existing repair brief.
  • The turn sets replyExpectation: "optional", the host-owned waiver the scheduler's repair request already uses.

When the notice could not be posted, the turn keeps its visible input and behavior, as before.

What users see

  • After an automation notice, the agent stays silent unless it actually changed something. Before, it was forced to send filler.

Evidence

  • src/gateway/server-cron-notice-repair-silence.test.ts runs the real cron target resolver, admission and CLI-runner settlement, with the agent answering NO_REPLY.
    • On the merge base the turn fails ("The AI service returned an empty response").
    • On this branch it completes in one model call, and chat shows only the posted notice.
  • Real Telegram run on this head (isolated Gateway, real gpt-5.4-mini, an automation auto-disabled because its account was signed out): the notice arrived once, then one agent line about its repair. The notice was not repeated.
  • Cron notice, failure-repair final-effect, notification and failure-alert suites pass.

Not in this PR (recorded separately)

  • When the notice post's channel send is refused transiently (SESSION_DELIVERY_GENERATION_UNAVAILABLE while the run's own result row is being written to the same session), postSessionNotice reports failure. Delivery recovery then sends the notice a few seconds later. The visible fallback turn runs meanwhile, so its reply can arrive before the notice. Seen once in three real runs.

@clawsweeper

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

@obviyus
obviyus marked this pull request as ready for review November 28, 2026 07:08
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Nov 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 28, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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. labels Nov 28, 2026
@clawsweeper

clawsweeper Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR lets an agent remain silent after an automation notice has already been posted and explains that notice’s status in the hidden repair input.

Example: The “Health check” automation is auto-disabled and its notice reaches the owner conversation.

  • Before: An agent answering NO_REPLY is forced to produce another response, creating filler after the notice.
  • After: NO_REPLY completes the repair turn silently; an agent that makes a repair can report what changed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Focused implementation with meaningful boundary coverage; direct evidence of the silent production path is incomplete.
Proof confidence 🦪 silver shellfish (2/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: Users receive forced filler after an automation notice even when the agent has nothing useful to add.
Reason: The maintainer-authored direction repairs a reported user-visible failure without adding configuration or another policy owner.

Regression provenance

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

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a current cron notice defect with a focused change; no introduced correctness bug was found.

Reviewed head: ab07bd7efb354b5d8da6bb697e63fed7650f1360

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway cron adapter receives scheduler notices, posts them through the session notice writer, and submits a requester-bound repair turn to the conversation runtime.

flowchart TD
  A[Scheduler notice] --> B[Cron target resolver]
  B --> C[Session notice writer]
  C --> D[Conversation and channel]
  B --> E[Hidden repair turn]
  E --> F[Optional reply settlement]
  F --> D
Loading

Technical review

Best possible solution:

Keep optional reply policy and the already-posted notice instructions together in the existing cron target resolver.

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

Current main posts the notice but omits the host-owned optional-reply setting; existing settlement coverage establishes that an otherwise identical NO_REPLY turn fails without that waiver.

Is this the best way to solve the issue?

The patch fixes the producer’s missing reply policy through an existing contract, preserves requester admission and posting-failure behavior, and adds a distinct regression covering the cron producer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 685fad85e4b8.

Provenance checked

  • Direct cron notices and hidden repair input keeps the original intent (fff3e0e: Make notices visible independently of model availability while retaining the agent’s repair opportunity.)
  • Requester-bound notice repair turns keeps the original intent (8100c60: Allow repair turns to inspect and repair their automation through the job requester’s authority.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned production change: The introduced diff adds optional reply settlement only after successful notice posting and preserves the existing visible fallback otherwise. (src/gateway/server-cron-targets.ts:246, ab07bd7efb35)
  • Current main still needs the repair: Fetched main still passes bare notice text without replyExpectation; its target resolver matches the merge-base version. (src/gateway/server-cron-targets.ts:244, 685fad85e4b8)
  • Existing reply-policy owner: The scheduler’s failure-repair dispatcher already uses the same host-owned optional-reply contract. (src/gateway/server-cron-notifications.ts:124, ab07bd7efb35)
  • Focused regression coverage: The new test drives real cron targeting, admission and CLI settlement with mocked model output, asserting completed settlement, one executor call, and only the notice in chat. (src/gateway/server-cron-notice-repair-silence.test.ts:37, ab07bd7efb35)
  • Supplied live scenario: The full PR body reports a real Telegram run on this head where the notice arrived once followed by a repair line; it supplies no capture or trace demonstrating silent completion. (ab07bd7efb35)
  • CI attribution remains unresolved: Head checks fail in import-cycle, mock-export ratchet and maximum-line checks. Annotations identify the checks and unrelated maximum-line paths, but detailed job logs redirect to a blocked storage host, so these failures cannot be classified as diff-caused or inherited. (ab07bd7efb35)

PR surface

Source +20, Tests +117. Total +137 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 23 3 +20
Tests 1 117 0 +117
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 140 3 +137

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 rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish 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:

  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish 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 28, 2026, 2:24 AM ET / 07:24 UTC.

@obviyus
obviyus merged commit 2a3bf24 into main Nov 28, 2026
112 checks passed
@obviyus
obviyus deleted the fix/cron-notice-repair-silence branch November 28, 2026 08:41
@obviyus

obviyus commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 2a3bf24, no overrides. After a posted automation notice, the agent's repair turn may now stay silent and is told the notice is already shown. Before: NO_REPLY was refused and the agent was forced into filler after the notice. After: one silent completion (test red on the merge base, green here); on a real Telegram DM the notice arrived once, followed by one repair line that did not repeat it. CI green on d4e420d; local ClawSweeper on the exact head: correct, no findings.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 29, 2026
…openclaw#207315)

## Problem

Since openclaw#207226, a cron job notice (auto-disabled, or a fallback failure alert) is posted to the owner conversation directly. Its model turn stays as the agent's hidden repair input. That turn still required a visible result, and its input was the bare notice text:

- When the agent correctly decided it had nothing to add and answered `NO_REPLY`, the runtime refused that ("NO_REPLY is not allowed") and forced another answer. The user got filler after the notice. On a working conversation the forced replies were "I'm here—what would you like me to call you?", "Got it." and "Noted.".
- Nothing told the agent that the user had already seen the notice.

Found in the owed end-to-end check of openclaw#207226 on a real Telegram DM, with an isolated Gateway and `gpt-5.4-mini`.

## Fix

`src/gateway/server-cron-targets.ts`, the notice owner. When the notice was posted:

- The repair turn's hidden input says the notice is already shown to the user, with what they need to do, and must not be repeated. The agent either fixes the cause itself and says what it changed, or answers `NO_REPLY`. It leaves a disabled automation disabled unless it fixed the cause. The notice text is passed as an untrusted data block, like the existing repair brief.
- The turn sets `replyExpectation: "optional"`, the host-owned waiver the scheduler's repair request already uses.

When the notice could not be posted, the turn keeps its visible input and behavior, as before.

## What users see

- After an automation notice, the agent stays silent unless it actually changed something. Before, it was forced to send filler.

## Evidence

- `src/gateway/server-cron-notice-repair-silence.test.ts` runs the real cron target resolver, admission and CLI-runner settlement, with the agent answering `NO_REPLY`.
  - On the merge base the turn fails ("The AI service returned an empty response").
  - On this branch it completes in one model call, and chat shows only the posted notice.
- Real Telegram run on this head (isolated Gateway, real `gpt-5.4-mini`, an automation auto-disabled because its account was signed out): the notice arrived once, then one agent line about its repair. The notice was not repeated.
- Cron notice, failure-repair final-effect, notification and failure-alert suites pass.

## Not in this PR (recorded separately)

- When the notice post's channel send is refused transiently (`SESSION_DELIVERY_GENERATION_UNAVAILABLE` while the run's own result row is being written to the same session), `postSessionNotice` reports failure. Delivery recovery then sends the notice a few seconds later. The visible fallback turn runs meanwhile, so its reply can arrive before the notice. Seen once in three real runs.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 29, 2026
…input (#207226)

## Problem

#207186 fixed the case where a cron job notice (auto-disabled, or a fallback failure alert) was lost because the owner conversation's model could not run. The notice still reached chat only as a model turn's input, and was posted directly only after that turn failed before start. A turn cancelled before start (supersession, restart) still lost it. The notice also never reached the conversation's channel as written; there the user saw only the agent's reply about it.

## Fix

`src/gateway/server-cron-targets.ts` posts every job notice directly through the session notice writer (`postSessionNotice`), without a model turn. The post needs no requester: it is fixed runtime text sent to the job owner conversation. It writes one chat row and a durable send to the conversation's channel, unless the notice is private or the conversation denies automatic sends (`session.sendPolicy`).

The notice's turn stays as the agent's repair turn (#188105), with its input hidden from chat (`cron_failure_repair` provenance, the same authority path as `cron`). Its error payloads are suppressed, as for repair turns, because the user already has the notice. When there is no session to post into yet, the turn keeps its visible input, so the notice still shows exactly once. The posted row is not replayed to the model, so when the repair turn fails for good before it starts (the owner conversation's model cannot run), the text is queued as context for the next turn, as #207186 did. The #207186 settle-time fallback is removed.

## What users see

- Chat: the fixed notice as a system notice row, then the agent's reply when the model works. Before, it was shown as a user-role row.
- Channels: the fixed notice, then the agent's reply. Before, only the reply.
- A dead model: the notice still shows once.
- Session notices (plugin notices too) now honor `session.sendPolicy`: a conversation that denies automatic sends keeps the notice in its transcript only. Before, `postSessionNotice` sent to the channel regardless.

## Accepted edge cases

- Owner guidance typed into a notice's repair turn does not join it as owner continuation. Repair turns already work this way.

## Evidence

- `server-cron-notice-delivery.test.ts`: owner model with no usable account. Chat shows the notice exactly once, as the posted assistant row. The next turn gets the notice as context.
- `server-cron-failure-repair.final-effect.test.ts`, auto-disabled case with a working model: the repair still applies and chat shows the notice exactly once, as the posted row, not the turn input.
- `runtime-session-notice.e2e.test.ts`: a conversation with `sendPolicy: deny` gets the transcript row and no channel send.
- `pnpm check:madge-import-cycles`: 0 cycles. The send policy is loaded lazily on the delivery path, because its owner reaches the channel plugin registry, which loads the notice writer.
- Not covered by a test: the private branch (`deliver: false`, one expression) and the channel send itself.
- Cron failure-alert, delivery-outcome, startup-notification and Gateway notification suites pass.

Co-authored-by: Ayaan Zaidi <[email protected]>

Follow-up scan: 494561c test: fix the participation admission test after cron notices became repair turns (#207414); 2a3bf24 fix(cron): let the agent stay silent after a posted automation notice (#207315). Other hits are not required by this focused beta.2 fix.

(cherry picked from commit fff3e0e)

Release adaptation: Backport direct posting onto the beta.2 cron target, preserving the admitted session generation and no-delivery policy.

Release adaptation: Resolve the lane-5 #207186 overlap in upstream order: replace the settle-time visible fallback with a direct post and hidden repair input, preserve next-turn context on permanent pre-start failure, and keep the release target-generation and delivery checks. The notice regression now checks chat projection and queued context; the separate removal, quota-alert and script-delivery fixes remain intact.

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

gateway Gateway runtime impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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