Skip to content

fix(cron): preserve missing-account refusal diagnostics and repair guidance - #195879

Closed
roboclaw-bot wants to merge 1 commit into
mainfrom
openclaw/young-krill-4
Closed

roboclaw-bot wants to merge 1 commit into
mainfrom
openclaw/young-krill-4

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Rebase validation — November 25, 2026

Rebased onto main 40757d73039f5 as dcabd5ec76c77da03019d4967e74f2269a4582fb, preserving the latest remote changes from c4ec773d8d280. Historical merge/publication commits were consolidated; the final patch is identical by stable patch-id. Contributor credit is retained.

Fresh local proof: 88 passed (53 cron classification/scheduling/startup tests, 34 session-event boundary tests, and the previously failing preflight-compaction watchdog test). The watchdog selection intentionally skipped its 39 sibling cases. Core typecheck, targeted changed-file lint, and git diff --check passed. No live-model/Gateway proof is claimed.

The watchdog failure documented below is historical: its focused reproduction now passes after incorporating main. Older CI/preparation entries below remain prior-head evidence, not validation of this rebased head. Fresh hosted CI must complete before claiming green CI. Neither PR was merged.

Related: #195802, #191637, #189953, #188946

What Problem This Solves

A scheduled run refused for a missing recorded inference account can lose its actual cause and appear only as "Session event execution failed". Startup diagnostics also missed unbound Codex jobs using stored accounts.

User Impact

Automation history and diagnostics retain the actionable refusal. Direct chat failure alerts explain the missing account and repair without naming the stored account; webhook failure routes retain their existing raw-error behavior. Startup inspection warns about affected Codex jobs without rewriting them.

Recurring jobs stay enabled, following #203106. Normal backoff, alert thresholds/cooldowns, and owner-conversation repair policy remain in charge. This PR no longer introduces first-failure pausing or restores the removed ten-failure auto-disable policy. Account authorization and fallback guards remain unchanged. Existing owner-conversation repair briefs still use the recorded last error; no account-redaction guarantee is made for generated repair replies.

Why This Change Was Made

  • Pass the reply owner's recorded failure cause separately from optional chat text. Only recognized account refusals use the new error projection; unrelated wrapped errors keep their existing outer-error boundary.
  • Recognize the account guard's error by identity, then project a closed failure detail and permanent run classification through isolated and session-event results. Timeout, cancellation, auth-revoked, operator-admission and session-conflict precedence remain intact.
  • Do not confuse missing account configuration with revoked creator authority: an operator-linked recurring job keeps its schedule too.
  • Persist the actual refusal in existing history/error fields. Do not write a new account binding, disable the recurring job, introduce a disable reason, or migrate schemas.
  • Use credential-neutral alert copy that supports either selecting an authorized stored account or a configured provider key, without adding another metadata variant.
  • Remove the auto-disable plumbing and redundant configuration-refusal predicate from the earlier revision. Preserve the current-main run preparation split and operator-admission handling.

Evidence

On head c4ec773d8d28, the PR incorporates the updated compaction fixture from #204443 via main 5750fb88fe02. The only PR-specific follow-up removed a stale test comment: recurring jobs remain scheduled after an account refusal.

Local validation: 93 tests passed across account propagation, startup diagnostics, error classification and scheduler outcomes; all three selected session-event tests passed (stored account, direct credential, unrelated private cause). Targeted lint, format and whitespace checks passed.

The previously red watchdog case passed with its upstream assertions unchanged in the final single-worker run (1 passed, 39 filtered). An earlier run on the refreshed candidate still observed zero summary requests, so the local pass does not establish that the failure cannot recur. The older CI failure and its baseline reproduction are documented below. Current PR checks are separate from those historical results.

Built Gateway: base versus PR head (November 25, 2026)

The missing-account refusal was exercised through the real Gateway, scheduler, persistent run history, and Telegram send adapter. The receiver was a loopback Telegram Bot API fixture; the accounts were synthetic. No message went to Telegram and no paid inference was used. A refusal before inference is the expected result.

Observation Unmodified integration base 5750fb88fe02 PR head c4ec773d8d28
Scheduled session with optional delivery suppressed The history error included the refusal in this reproduction, but the run had no diagnostics summary. Both the history error and diagnostics summary identified the missing recorded inference account and the selected synthetic account. This also passed when the head ran again after the base.
Direct failure alert from a recurring isolated job The receiver got “Cause: unknown”. The receiver got “Cause: this automation has no recorded inference account, so OpenClaw refused the selected credentials.” It included the edit/Doctor repair and omitted the stored account identifier that appeared in history.
Cold start with an unbound job inheriting a stored-account Codex route No missing-account warning for the diagnostic job during the control startup. Two cold starts emitted a warning for that exact job ID with openclaw doctor --fix guidance. The job was not rebound.

The isolated job fired on its actual timer at 06:04:29 UTC. After the refusal it was still enabled, with 06:06:29 UTC recorded as its next run. Public automations runs and automations list reads confirmed the history and scheduling state; the chat assertion used the text actually received, not a formatter call.

How the condition was produced: Create recurring isolated and named-session jobs on a configured provider key before a stored account is selected. Set the isolated job’s failure threshold to one and point its direct-alert route at the loopback receiver. Save synthetic profiles with models auth paste-api-key, select the stored profile at the provider (not on the job), cold-start the Gateway, and let the timer fire. A third unbound job inherited an explicitly configured Codex model at startup. No refusal, history row, or notification text was injected. The candidate's tracked source tree matched the full published patch applied to the base (Git tree 4783570f09d5341fd25d366f6fce25d3cd7fdd94); the two built CLI processes ran separately against the disposable profile.

What persisted: On reopening the integration-base state with the PR build, all four previously observed run IDs retained the same job, status, timestamp, error, and diagnostics. Two stored profiles kept their IDs, providers and credential types; the explicit account order set on the base also survived unchanged. Both local listeners were closed afterward.

Still unverified — latest-stable upgrade: The control above was a source build, not the npm stable release. At test time npm’s latest was 2026.11.10, published November 25 at 05:07 UTC. This checkout’s seven-day minimum release age rejected its installation before the stable Gateway could create state. That policy was not overridden. This evidence does not claim a stable-to-PR upgrade or live external channel delivery.

Historical validation on c6f663f and earlier heads (November 23)
  • On reconciled candidate 7d3da265064d, seven focused suites passed: 165 tests covering session events, account propagation, scheduling, lifecycle classification, startup warnings and watchdogs.
  • On final candidate aed3a9904c0b, the three affected suites passed again: 88 tests, including stored/direct refusal handling, unrelated nested-error non-disclosure and operator-linked jobs remaining enabled. Session-event suite: 104.14s; cron scheduler/notification suites: 5.20s combined. These are boundary integrations; most session-suite time is real isolated state/lifecycle setup.
  • Core typecheck, changed-file lint/format and git diff --check passed. Dependencies were installed from each branch's frozen lockfile without package manifest or lockfile edits.
  • The first local ClawSweeper pass found two P2 issues: generic nested-error disclosure and stored-account-only alert wording. Both were fixed with regression coverage. Final full-range local ClawSweeper completed at aed3a9904c0b against 8b17822bec4f with two later findings dispositioned:
    • Owner repair account detail: retained intentionally. The existing trusted owner repair brief needs the actual account selection to repair the job. Documentation now scopes account-free wording to direct alerts, not model-generated repair replies; no new redaction policy is imposed on the owner workflow.
    • Webhook Cause: unknown line: not retained. It was an incidental projection of the old unknown classification, not a required field. A recognized permanent configuration refusal should not be labeled unknown. Structured raw error remains unchanged; the guide's stable-message note concerns omission of chat-only timestamps/links, not freezing an incorrect cause classification.
  • Relative to current main: production +141/-51 (+90 net); tests +203/-26 (+177 net). Compared with the previously reported PR delta, production net growth fell from +108 to +90; additional tests protect the keep-running and disclosure boundaries. No auto-disable machinery was restored.

Current-head CI has an inherited failing shard, reproduced on the unmodified integration base; see the auditable proof index below. Prior-head green runs are not proof of this candidate.

The current tests use synthetic model execution, not a shipped-Gateway/live-model run. No new live Gateway or upgrade proof is claimed.

Reported by @Marvinthebored in #195802.

Auditable proof index — November 23, 2026

Evidence is pinned to c6f663fce6fd3cb55c5a5b4fa99377cc149a761c. Local results below are retained results from the earlier preparation, not newly rerun tests or additive coverage counts. Hosted CI links are checks attached to this exact PR head (GitHub PR CI may execute its merge ref).

Hosted check Observed result
checks-node-changed-boundary SUCCESS
check-prod-types SUCCESS
check-lint SUCCESS
check-source-contracts SUCCESS
check-guards-architecture SUCCESS
check-docs SUCCESS

Observable contracts and state boundaries

Contract Evidence / assertion
Session-event refusal / negative control Real isolated session lifecycle with synthetic model: stored/direct refusals retain error + diagnostics and typed classification even with delivery disabled. Unrelated wrapped errors do not expose the nested private cause; refusal text is absent from the chat transcript; model is called once.
Stop and timeout precedence Lifecycle cases exercise cancellation, timeout and other terminal outcomes rather than treating every failure as missing account configuration.
Recurring scheduling and safe direct alerts Stored/direct account cases, including operator-linked jobs: enabled=true, future next run, exact lastError, no autoDisabled; one direct alert, no account identifier, and guidance includes configured provider keys.
Keep-running policy The tenth consecutive failure still leaves the recurring job enabled and scheduled; existing notification policy owns the alert. This is the #203106 policy, not the superseded auto-pause behavior.
Startup inspection Stored CLI / selected configured-key diagnostics are inspected without rewriting jobs.
Account/runtime authority siblings Existing lease, settlement, recorded-runtime and account-propagation contracts remain covered by the earlier focused validation.

Proof provenance: 165 tests passed on reconciled 7d3da265064d; 88 affected tests passed after the final production changes at aed3a9904c0b. git diff aed3a9904c0b c6f663fce6fd3 --stat contains only two documentation edits (delivery.md, troubleshooting.md, +2/−2); the current production code matches that final local run. These counts overlap and must not be summed.

Reproduce the principal boundaries (separate invocations, frozen dependencies):

node scripts/run-vitest.mjs src/auto-reply/reply/session-event-automation-result.test.ts --maxWorkers=1
node scripts/run-vitest.mjs src/cron/service/timer-outcomes.regression.test.ts --maxWorkers=1
node scripts/run-vitest.mjs src/cron/service/store.inference-warning.test.ts --maxWorkers=1

CI caveat — not merge-ready yet: current-head CI has a failed compact-large-17 job. Its cron shard completed 238 passing / 1 failing tests: session-run.session-model-strictness.integration.test.ts, “lets scheduled preflight compaction finish beyond the setup watchdog”, line 663, summaryRequests: expected 1, received 0. Other invocations in that job passed; that does not make the job green. Local baseline attribution below establishes this same assertion failure without the PR changes; no inherited-failure waiver or successful rerun is claimed. The run has now completed with a failing CI gate. The repository CI classifier reports unknown attribution (no matching main job), not pre-existing.

Fresh local reproduction on c6f663fce6fd3:

node scripts/run-vitest.mjs src/cron/session-run.session-model-strictness.integration.test.ts --maxWorkers=1

Result: 39 passed, 1 failed / 40, 148.05s Vitest duration, exit 1. The same preflight-compaction assertion failed (summaryRequests expected 1, observed 0). This confirms the CI symptom is locally reproducible, not a claim that the PR caused it. Baseline attribution is now recorded below; the underlying failure remains unrepaired. No assertion weakening, CI rerun, or waiver was used.

Baseline attribution — November 23, 2026

The identical assertion fails on clean, unmodified integration-base 8b17822bec4f36582bf5e15743087b32fd3460b1, with none of this PR's changes. A detached Git worktree reused the repository object store; dependencies were installed with pnpm install --frozen-lockfile. Its tracked working tree remained clean.

# At 8b17822bec4f36582bf5e15743087b32fd3460b1
node scripts/run-vitest.mjs src/cron/session-run.session-model-strictness.integration.test.ts --maxWorkers=1 -t 'lets scheduled preflight compaction finish beyond the setup watchdog'

Result: 1 failed, 39 intentionally filtered/skipped, exit 1, 67.85s Vitest duration. Exact signature: line 663, summaryRequests, expected 1, received 0. This matches the full-suite PR-head reproduction and hosted failed shard above. This establishes an inherited failure at the integration base, independently of the hosted classifier's unknown result; it is not proof that current main is fixed or that the CI gate passed.

Source inspection points to the base's request-boundary compaction change (#204111): token-triggered preflight compaction may defer to request-boundary ownership. The fixture seeds 125,000 reported tokens below a 128,000 context window and assumes a preflight summary request. That is a diagnostic lead, not a completed root-cause repair; no assertion or fixture was changed.

Remaining landing gate: hosted CI is still red. Any future landing must either carry a proven repair or use the repository's authorized inherited-failure route with this exact-head/base evidence. No merge, waiver, rerun, or source push was performed for this attribution. Native preparation remains pinned to c6f663fce6fd3; its earlier github_pending receipt is not passing-CI evidence.

Scope of state proof: session-result/transcript and scheduler-outcome assertions are not a shipped-Gateway persistence/upgrade demonstration. Actual refusal text uses existing history/error storage; this patch neither creates account authorization nor restores auto-disable. Direct-alert redaction does not apply to existing trusted owner-repair briefs or raw webhook errors. No new live model, packaged Gateway, or upgrade proof is claimed.

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Nov 9, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head c4ec773d8d280bc2f50f57b541c483bb0ea97e2b, but the PR head is now dcabd5ec76c77da03019d4967e74f2269a4582fb. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (4 earlier review cycles)
  • reviewed 2026-11-09T10:00:11.744Z sha 0781c24 :: needs changes before merge. :: [P3] Keep the handoff change within the enforced line-cap ratchet | [P3] Add the required allocation for the new regression coverage | [P3] Scope the account-redaction promise to chat notices
  • reviewed 2026-11-18T10:10:56.672Z sha 2527269 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-25T04:53:53.823Z sha c4ec773 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-25T06:16:11.959Z sha c4ec773 :: needs maintainer review before merge. :: none

@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@roboclaw-bot roboclaw-bot added the clawtributors PR from a clawtributor label Nov 10, 2026
@clawsweeper clawsweeper Bot removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 10, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. 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 18, 2026
@clawsweeper clawsweeper Bot added 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:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
@RomneyDa RomneyDa changed the title fix(cron): scheduled runs refused for a missing account hide the cause and retry ten times fix(cron): preserve missing-account refusal diagnostics and repair guidance Nov 23, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Nov 25, 2026
@RomneyDa
RomneyDa force-pushed the openclaw/young-krill-4 branch from c4ec773 to dcabd5e Compare November 25, 2026 09:52
@clawsweeper clawsweeper Bot removed 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. labels Nov 26, 2026
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @dallinromney. I landed this change in #205873 (480555a26f25), rebased onto current main, with your commit and credit kept. I made one change: the direct-alert sentence now comes from the refusal cause table (src/gateway/operator-refusal.ts, cause automation-account-unrecorded). Closing this PR in favor of that merge.

michibat01 pushed a commit to michibat01/openclaw that referenced this pull request Nov 26, 2026
…ion results (openclaw#205873)

Lands openclaw#195879 by @dallinromney (reported by @Marvinthebored in openclaw#195802), rebased on current `main`, with one change: the alert text now comes from the refusal cause table.

## Problem

An automation with no recorded inference account is refused before inference with `Automation has no recorded inference account …`. A team member described it as "sub-agent death by loss of credentials, and a mis-reported error message":

- In a session-target run, the refusal is in `lastError`, but the run has no diagnostics. When optional delivery suppresses the reply, the cause falls back to `Session event execution failed`.
- The direct failure alert classified the run as `unknown` and said `Cause: unknown`.
- Startup diagnostics did not warn about unbound Codex-runtime jobs that would use a stored account.

## Fix

- The reply owner's failure cause goes to the session-event result separately from the optional chat text. A recognized account refusal is identified by error identity, not by its message text. It gets a permanent classification and a closed `inference-account-unrecorded` failure detail.
- The direct alert text comes from `src/gateway/operator-refusal.ts` (new cause `automation-account-unrecorded`, with a required next step). It names the repair and does not name the stored account. Automation history keeps the full refusal.
- Recurring jobs stay enabled; normal backoff and alert policy apply. Nothing is auto-disabled, no binding is written and no schema changes.
- Startup inspection covers unbound Codex-runtime jobs on stored accounts. It warns only and does not rebind them.

Production changes add more lines than they remove: the cause was dropped because no code carried it, so this PR adds that path. It adds no new state, retry or flag.

## User impact

The history, diagnostics and chat alert all name the real cause (a missing recorded account) and the one command that repairs it, instead of `Session event execution failed` or `Cause: unknown`.

## Evidence

- Isolated Gateway (from source), real `openai/gpt-5.5`, on base `main` `4934b24699c0`. Two automations were created while the provider used a configured key. The provider then moved to a stored account (`models auth paste-api-key`, config key removed, Gateway restarted), and both jobs came due on their timer. On base, both runs are refused with `Automation has no recorded inference account …`. The isolated run has diagnostics. The `session:` run has **no diagnostics**.
- On this head, the same run is listed under the head E2E below.
- Tests: 23 files, every changed test plus the direct importers of the changed modules, all pass (`ocx test`, 6 shards).
- Same user report, other part: a woken owner chat can create a follow-up automation on `main` (the agent's own background exec wakes it, and the automation it creates runs `ok` on a stored account). That part is fixed on `main`, so openclaw#201146 was closed with that evidence.

Closes openclaw#195879.

Co-authored-by: Dallin Romney <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…ion results (openclaw#205873)

Lands openclaw#195879 by @dallinromney (reported by @Marvinthebored in openclaw#195802), rebased on current `main`, with one change: the alert text now comes from the refusal cause table.

## Problem

An automation with no recorded inference account is refused before inference with `Automation has no recorded inference account …`. A team member described it as "sub-agent death by loss of credentials, and a mis-reported error message":

- In a session-target run, the refusal is in `lastError`, but the run has no diagnostics. When optional delivery suppresses the reply, the cause falls back to `Session event execution failed`.
- The direct failure alert classified the run as `unknown` and said `Cause: unknown`.
- Startup diagnostics did not warn about unbound Codex-runtime jobs that would use a stored account.

## Fix

- The reply owner's failure cause goes to the session-event result separately from the optional chat text. A recognized account refusal is identified by error identity, not by its message text. It gets a permanent classification and a closed `inference-account-unrecorded` failure detail.
- The direct alert text comes from `src/gateway/operator-refusal.ts` (new cause `automation-account-unrecorded`, with a required next step). It names the repair and does not name the stored account. Automation history keeps the full refusal.
- Recurring jobs stay enabled; normal backoff and alert policy apply. Nothing is auto-disabled, no binding is written and no schema changes.
- Startup inspection covers unbound Codex-runtime jobs on stored accounts. It warns only and does not rebind them.

Production changes add more lines than they remove: the cause was dropped because no code carried it, so this PR adds that path. It adds no new state, retry or flag.

## User impact

The history, diagnostics and chat alert all name the real cause (a missing recorded account) and the one command that repairs it, instead of `Session event execution failed` or `Cause: unknown`.

## Evidence

- Isolated Gateway (from source), real `openai/gpt-5.5`, on base `main` `93c4244a2255`. Two automations were created while the provider used a configured key. The provider then moved to a stored account (`models auth paste-api-key`, config key removed, Gateway restarted), and both jobs came due on their timer. On base, both runs are refused with `Automation has no recorded inference account …`. The isolated run has diagnostics. The `session:` run has **no diagnostics**.
- On this head, the same run is listed under the head E2E below.
- Tests: 23 files, every changed test plus the direct importers of the changed modules, all pass (`ocx test`, 6 shards).
- Same user report, other part: a woken owner chat can create a follow-up automation on `main` (the agent's own background exec wakes it, and the automation it creates runs `ok` on a stored account). That part is fixed on `main`, so openclaw#201146 was closed with that evidence.

Closes openclaw#195879.

Co-authored-by: Dallin Romney <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…ion results (#205873)

Lands #195879 by @dallinromney (reported by @Marvinthebored in #195802), rebased on current `main`, with one change: the alert text now comes from the refusal cause table.

An automation with no recorded inference account is refused before inference with `Automation has no recorded inference account …`. A team member described it as "sub-agent death by loss of credentials, and a mis-reported error message":

- In a session-target run, the refusal is in `lastError`, but the run has no diagnostics. When optional delivery suppresses the reply, the cause falls back to `Session event execution failed`.
- The direct failure alert classified the run as `unknown` and said `Cause: unknown`.
- Startup diagnostics did not warn about unbound Codex-runtime jobs that would use a stored account.

- The reply owner's failure cause goes to the session-event result separately from the optional chat text. A recognized account refusal is identified by error identity, not by its message text. It gets a permanent classification and a closed `inference-account-unrecorded` failure detail.
- The direct alert text comes from `src/gateway/operator-refusal.ts` (new cause `automation-account-unrecorded`, with a required next step). It names the repair and does not name the stored account. Automation history keeps the full refusal.
- Recurring jobs stay enabled; normal backoff and alert policy apply. Nothing is auto-disabled, no binding is written and no schema changes.
- Startup inspection covers unbound Codex-runtime jobs on stored accounts. It warns only and does not rebind them.

Production changes add more lines than they remove: the cause was dropped because no code carried it, so this PR adds that path. It adds no new state, retry or flag.

The history, diagnostics and chat alert all name the real cause (a missing recorded account) and the one command that repairs it, instead of `Session event execution failed` or `Cause: unknown`.

- Isolated Gateway (from source), real `openai/gpt-5.5`, on base `main` `4934b24699c0`. Two automations were created while the provider used a configured key. The provider then moved to a stored account (`models auth paste-api-key`, config key removed, Gateway restarted), and both jobs came due on their timer. On base, both runs are refused with `Automation has no recorded inference account …`. The isolated run has diagnostics. The `session:` run has **no diagnostics**.
- On this head, the same run is listed under the head E2E below.
- Tests: 23 files, every changed test plus the direct importers of the changed modules, all pass (`ocx test`, 6 shards).
- Same user report, other part: a woken owner chat can create a follow-up automation on `main` (the agent's own background exec wakes it, and the automation it creates runs `ok` on a stored account). That part is fixed on `main`, so #201146 was closed with that evidence.

Closes #195879.

Co-authored-by: Dallin Romney <[email protected]>
Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 480555a)

Release adaptation: preserve stable cron preparation owner, abort/restart precedence, auto-disable policy and CLI guidance; use the stable cron alert renderer for sanitized repair copy. No required follow-up in the pinned audit.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…ion results (#205873)

Lands #195879 by @dallinromney (reported by @Marvinthebored in #195802), rebased on current `main`, with one change: the alert text now comes from the refusal cause table.

## Problem

An automation with no recorded inference account is refused before inference with `Automation has no recorded inference account …`. A team member described it as "sub-agent death by loss of credentials, and a mis-reported error message":

- In a session-target run, the refusal is in `lastError`, but the run has no diagnostics. When optional delivery suppresses the reply, the cause falls back to `Session event execution failed`.
- The direct failure alert classified the run as `unknown` and said `Cause: unknown`.
- Startup diagnostics did not warn about unbound Codex-runtime jobs that would use a stored account.

## Fix

- The reply owner's failure cause goes to the session-event result separately from the optional chat text. A recognized account refusal is identified by error identity, not by its message text. It gets a permanent classification and a closed `inference-account-unrecorded` failure detail.
- The direct alert text comes from `src/gateway/operator-refusal.ts` (new cause `automation-account-unrecorded`, with a required next step). It names the repair and does not name the stored account. Automation history keeps the full refusal.
- Recurring jobs stay enabled; normal backoff and alert policy apply. Nothing is auto-disabled, no binding is written and no schema changes.
- Startup inspection covers unbound Codex-runtime jobs on stored accounts. It warns only and does not rebind them.

Production changes add more lines than they remove: the cause was dropped because no code carried it, so this PR adds that path. It adds no new state, retry or flag.

## User impact

The history, diagnostics and chat alert all name the real cause (a missing recorded account) and the one command that repairs it, instead of `Session event execution failed` or `Cause: unknown`.

## Evidence

- Isolated Gateway (from source), real `openai/gpt-5.5`, on base `main` `4934b24699c0`. Two automations were created while the provider used a configured key. The provider then moved to a stored account (`models auth paste-api-key`, config key removed, Gateway restarted), and both jobs came due on their timer. On base, both runs are refused with `Automation has no recorded inference account …`. The isolated run has diagnostics. The `session:` run has **no diagnostics**.
- On this head, the same run is listed under the head E2E below.
- Tests: 23 files, every changed test plus the direct importers of the changed modules, all pass (`ocx test`, 6 shards).
- Same user report, other part: a woken owner chat can create a follow-up automation on `main` (the agent's own background exec wakes it, and the automation it creates runs `ok` on a stored account). That part is fixed on `main`, so #201146 was closed with that evidence.

Closes #195879.

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

(cherry picked from commit 480555a)

Release adaptation: Keep release CLI argument quoting and classify the existing refusal at outcome ownership; retain only the account-safe notification copy from the newer Gateway refusal table, not its broad authority refactor.

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

agents Agent runtime and tooling clawtributors PR from a clawtributor docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants