Skip to content

fix(cron): post job notices directly; keep the turn as hidden repair input - #207226

Merged
obviyus merged 4 commits into
mainfrom
fix/cron-notice-always-direct
Nov 28, 2026
Merged

obviyus merged 4 commits into
mainfrom
fix/cron-notice-always-direct

Conversation

@obviyus

@obviyus obviyus commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

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.

…input

Every cron job notice is posted through the session notice writer, so it shows once in chat and on the conversation's channel without depending on a model turn. The notice turn stays as the agent's repair turn with hidden input; with no session yet, its visible input carries the notice. Removes the #207186 settle-time fallback.
@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.

@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:message-loss Channel message delivery can be lost, duplicated, or misrouted. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. 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. labels Nov 28, 2026
@clawsweeper

clawsweeper Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR posts cron job notices directly and retains their model turns as hidden repair input.

Example: The Health check automation is auto-disabled, and its notice turn is cancelled before execution starts.

  • Before: The cancellation bypasses the direct-post fallback, so the notice can disappear.
  • After: An existing owner conversation receives the notice before the repair turn is enqueued.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation has no identified correctness defect, but required proof of the changed product flow is limited to tests.
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: An automation's fixed notice can disappear when its conversation turn is cancelled before starting, and successful turns deliver only the agent's response to the channel.
Reason: The maintainer-authored direction repairs a concrete silent failure and explicitly accepts the changed notice presentation and repair-context tradeoffs.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a remaining notice-loss path on current main, and inspection found no definite introduced bug.

Reviewed head: 1841677f0e4a5476b9884b5a822ec0390ef965a1

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 requester-aware repair turns to the conversation runtime.

flowchart TD
  A[Cron scheduler notice] --> B[Gateway cron adapter]
  B --> C[Session notice writer]
  C --> D[Conversation transcript]
  C --> E[Conversation channel]
  B --> F[Requester admission]
  F --> G[Hidden repair turn]
  G --> D
Loading

Technical review

Best possible solution:

Use the existing session notice writer for model-independent visibility and retain the existing requester-aware turn for repair.

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

Current main's settlement condition excludes cancellation before execution, establishing the remaining loss path from source; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change places notice visibility with its existing effect owner, removes the superseded fallback, and preserves repair admission without adding another persistence or policy owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5b4c54012ec2.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 8100c60 adds src/gateway/server-cron-targets.ts:221 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8100c6008860; files: src/gateway/server-cron-targets.ts)

PR surface

Source 0, Tests +12. Total +12 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 34 34 0
Tests 2 21 9 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 55 43 +12

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: 🧂 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:

  • 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.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture the notice and repair flow through an isolated running Gateway and its channel.

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 27, 2026, 11:38 PM ET / November 28, 2026, 04:38 UTC.

postSessionNotice sent to the session's channel without resolving session.sendPolicy. A conversation that denies automatic sends now keeps the notice in its transcript only.
@obviyus
obviyus merged commit fff3e0e into main Nov 28, 2026
123 of 124 checks passed
@obviyus
obviyus deleted the fix/cron-notice-always-direct branch November 28, 2026 06:02
@obviyus

obviyus commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as fff3e0e. Cron job notices now post directly to the owner conversation, without a model turn: shown exactly once, as the posted row, both when the conversation's model cannot run and when it works (the repair turn still applies). The dead-model case also keeps the notice as next-turn context. Session notices now honor session.sendPolicy. CI green on 7276d05; local ClawSweeper on the exact head: correct, no findings. No overrides.

obviyus added a commit that referenced this pull request Nov 28, 2026
…#207315)

## 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.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 28, 2026
…repair turns (#207414)

Related: #207226

## What Problem This Solves

`main` is red: the Gateway test `server.participation-admission` "readmits pending native child and scheduled work under current invitation bounds" times out after 120 s on every run. Every PR whose CI runs that test sees the same red, so it blocks landing work that is not related to it.

## User Impact

No product change. Developers and CI get a passing participation admission test again.

## Why This Change Was Made

#207226 (`fff3e0ec`) posts cron job notices directly and keeps the notice's turn as a hidden repair turn with `source: "cron_failure_repair"`. This was intended (see that PR's body). The test's spy on `enqueueSessionEventForHost` checked `source === "cron_failure_repair"` before the failure alert's `contextKey`. The failure alert's turn now has that source too, so it resolved the repair wait, and the failure-alert wait never settled. The spy now matches the failure alert by its `contextKey` first. The test still asserts what it asserted before: after the invitation is revoked, the scheduled run, the repair turn and the failure alert's turn are all refused before they start, and the provider gets no request.

## Evidence

- Bisect, running this test 3 times on each side: `fff3e0ec^` passed 3/3, `fff3e0ec` (#207226) timed out 3/3.
- Before this change, on `main` `6d8e821a`: timed out on both runs that finished.
- With this change, on `main` `89ed0f79`: passed 3/3 (`ocx test --no-memo src/gateway/server.participation-admission.test.ts`).
- `oxlint` and `oxfmt --check` are clean on the changed file.
- Test-only; no production code changed.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 29, 2026
…input (openclaw#207226)

## Problem

openclaw#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 (openclaw#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 openclaw#207186 did. The openclaw#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]>
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 29, 2026
…repair turns (openclaw#207414)

Related: openclaw#207226

## What Problem This Solves

`main` is red: the Gateway test `server.participation-admission` "readmits pending native child and scheduled work under current invitation bounds" times out after 120 s on every run. Every PR whose CI runs that test sees the same red, so it blocks landing work that is not related to it.

## User Impact

No product change. Developers and CI get a passing participation admission test again.

## Why This Change Was Made

openclaw#207226 (`34bda418`) posts cron job notices directly and keeps the notice's turn as a hidden repair turn with `source: "cron_failure_repair"`. This was intended (see that PR's body). The test's spy on `enqueueSessionEventForHost` checked `source === "cron_failure_repair"` before the failure alert's `contextKey`. The failure alert's turn now has that source too, so it resolved the repair wait, and the failure-alert wait never settled. The spy now matches the failure alert by its `contextKey` first. The test still asserts what it asserted before: after the invitation is revoked, the scheduled run, the repair turn and the failure alert's turn are all refused before they start, and the provider gets no request.

## Evidence

- Bisect, running this test 3 times on each side: `34bda418^` passed 3/3, `34bda418` (openclaw#207226) timed out 3/3.
- Before this change, on `main` `402dc418`: timed out on both runs that finished.
- With this change, on `main` `bb688f42`: passed 3/3 (`ocx test --no-memo src/gateway/server.participation-admission.test.ts`).
- `oxlint` and `oxfmt --check` are clean on the changed file.
- Test-only; no production code changed.

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

## Problem

Cron's fixed notices reach the owner conversation only as a session-event model turn. These are the auto-disabled notice (including `account-unavailable` from #207097) and the failure alert when no direct transport delivers it, which also covers repair fallbacks and the #207091 reset alert. The notice text becomes the turn's input row. When the conversation's own model cannot run, for example on the same signed-out account, the turn fails before it starts and writes no row. The user never sees why their automation stopped.

## Fix

The Gateway cron adapter (`src/gateway/server-cron-targets.ts`) keeps the notice turn, because it is also the agent's repair turn (#188105). When a job notice's turn settles `failed` without starting and is not retained for retry, the adapter posts the same text through the existing session notice writer (`postSessionNotice`). This writes one transcript row, sends it to the conversation's channel unless the event is private, and adds the text to the next turn's context. No model turn is involved.

- It uses the captured target's store path and `deliver` policy.
- When the model works, nothing changes: the user sees the same row and the agent's reply.

## Review

Fable reviewed this adversarially. Applied: drop the extra flag (`jobId` already identifies job notices); skip retryable outcomes, because the retained event still owns its text; honor the captured target's `deliver` and store path.

Not applied:
- A re-check of requester authority before the post. Authority is decided once, when the turn target is captured. Repo rules forbid `assertCurrent()`-style re-checks.
- Always posting notices directly and hiding the repair input. That would change what users see when the model works, and would send a second channel message.

Accepted edge cases:
- A notice whose turn is `cancelled` by restart or supersession is not reposted.
- A session that does not exist yet (`createIfMissing`) and fails before creation has nowhere to post. The warning is logged.

## Evidence

- `src/gateway/server-cron-notice-delivery.test.ts` uses a real Gateway target resolver, a real session-event handoff and an owner model with no usable account. On the merge base, 0 visible notices. On this branch, exactly 1.
- Cron failure-alert, delivery-outcome, startup-notification, Gateway notification and failure-repair final-effect suites pass.

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

(cherry picked from commit 22a3aec)

Release adaptation: Keep the beta.2 cron troubleshooting document; its release-specific surrounding guidance conflicts. The runtime/test patch applies unchanged.

Companions: #207226 changes notice display to direct posting with hidden repair input; not needed for the failed-before-start fallback, and not in this lane.

Co-authored-by: RomneyDa <[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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…input (#207226)

`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.

- 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.

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

- `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]>
(cherry picked from commit fff3e0e)

Release adaptation: Keep only session notice automatic-send policy resolution and transcript-only proof. Leave stable cron posting and repair behavior untouched.

Companion audit: 2a3bf24 and 494561c cover excluded cron redesign; b3f2fcc covers Goal scheduling; d62c462 changes an independent transcript write fence. None is required for the selected send-policy slice.

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:message-loss Channel message delivery can be lost, duplicated, or misrouted. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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