Skip to content

chore(ios): drop handled session.tool from the protocol event allowlist - #207259

Merged
obviyus merged 1 commit into
mainfrom
fix/protocol-allowlist-session-tool
Nov 28, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/protocol-allowlist-session-tool

Conversation

@obviyus

@obviyus obviyus commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

security-fast fails on every PR based on current main:

Protocol event coverage check failed:
  - [ios] allowlist entry "session.tool" is now handled; remove it from scripts/protocol-event-coverage.allowlist.json.

#206602 (5b4c5401) made the iOS chat surface handle session.tool, but the allowlist still says iOS does not handle it. On main, the push CI does not reach this check, so main looks green. PR runs (for example, #207238) fail.

Solution

Remove the iOS session.tool allowlist entry. The Android entry stays: Android still does not handle the event.

Evidence

  • node scripts/check-protocol-event-coverage.mts on origin/main 9c9e3c74: the failure above.
  • The same check on this branch: Protocol event coverage OK: 75 gateway events; ios handles 29, allowlists 46; android handles 26, allowlists 49.
  • Local ClawSweeper on b8041413: patch is correct, no findings.

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Nov 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. labels Nov 28, 2026
@obviyus
obviyus merged commit d8c4560 into main Nov 28, 2026
98 checks passed
@obviyus
obviyus deleted the fix/protocol-allowlist-session-tool branch November 28, 2026 05:19
obviyus added a commit that referenced this pull request Nov 28, 2026
…ttempt (#207262)

## Problem

A utility task that cancels its own work makes the fallback chain run the next utility model.

- The Activity recap, titles and transcript summaries pass a currency guard (`assertCurrent`) to `runUtilityCompletion`. The guard throws when the task's own work goes stale: the recap's session changed or a newer recap took over ("Activity recap lifecycle or utility model changed"), the title owner retired, or a newer transcript capture owner took the lane.
- When it throws, the caller's abort signal is still live. The fallback runner's only cancel fact is that signal (`resolveChainStopReason`, `model-fallback-attempt.ts`), so it counts the throw as a model failure and starts the next utility model.
- Real-user log signature (a production team Gateway, 4.35 h): 72 `model_fallback_decision candidate_failed` on the utility primary with the recap's self-cancel error; 19 of them went on to a configured utility fallback that the runtime does not offer, each failing with `model_not_found` and a "Activity recap deferred" line.

## Change

`runUtilityCompletion` (the one owner every utility user goes through) wraps the caller's `assertCurrent` on the fallback path. When it throws, a local controller is aborted with that same error and the error is rethrown. The chain receives `AbortSignal.any([caller, local])`, so the existing caller-cancel stop applies. No error-name or message match, no new error class, no runner change.

- A real model failure with a current caller still falls back (test).
- The no-fallback path is unchanged: with one candidate there is no next model to stop.

## User impact

- Recaps, titles, transcript notes and composer predictions that go stale stop at once instead of trying the next utility model, and a stale recap no longer produces a fallback `model_not_found` error or a retry delay. The chain logs one `model fallback chain stopped reason=caller_signal_aborted` line instead.
- Not changed: progress narration and the session observer already cancel through their abort signal.

## Evidence

| Test | Main | This PR |
|---|---|---|
| `utility-completion.runtime.test.ts`: guard throws the recap's `AbortError`, caller signal live | 3 model calls | 1 |
| `conversation-label-generator.test.ts`: title owner retires during the utility attempt | `gpt-mini`, `utility-backup` | `gpt-mini` |
| `summary-model.test.ts`: a newer capture owner takes the summary lane during the attempt (real lane-generation guard) | `utility-test-model`, `utility-backup` | `utility-test-model` |
| Guard present, model fails with a timeout | falls back | falls back |

- Each red was run with main's `utility-completion.ts` against the new tests; all green with the change. The three touched test files pass in full (19, 21 and 18 tests).
- `tsgo:core`, core test typecheck and oxlint on the touched files are clean.
- Adversarial review: land. Its one gap is taken: composer prediction's custom runner called the raw caller guard (`composer-prediction-completion.ts`), so its throw bypassed the wrapper; it now calls the candidate's guard. The review also confirmed that the wrapper sees only the caller's guard: the operator-model check, the timeout and the closed check inside isolated completion still fall back as before.
- Local review on head `5bcb1ab3` (after merging main for #207259): patch is correct, 0 findings, security cleared.
- Live proof gap (named): the self-cancel is a timing race (the session changes or a newer task takes over during the model call), so an isolated Gateway run cannot trigger it on demand. The tests drive the real guards (recap error shape, the title owner's guard, the transcript lane generation) through the real fallback runner. Production confirmation is the post-deploy log count: the recap self-cancel fallback decisions should go from 72 per 4.35 h to 0.

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

## What problem this solves

Fixes #205927 (with #207212, which stopped maintenance from recreating the deleted directory).

An agent removed from `agents.entries` by hand, whose directory was then deleted as Doctor advised, keeps its row in the shared agent-database registry. `openclaw doctor` then prints `Skipped missing registered agent database …` on every run, and no supported command can clear it: `openclaw agents delete <id>` answered "not found" because the agent is not configured and has no deletion record.

Doctor deliberately does not drop a registration just because its file is missing (#203130: the startup upgrade copies state without databases over 64 MiB, so that rule deleted real registrations). The removal therefore belongs to explicit agent deletion.

## Change

- `openclaw agents delete <id>` and the Gateway `agents.delete` method accept an agent that is not in config but still has a registered database. They run the existing journaled deletion: paths that are already gone are skipped, the registrations are removed with the journal, and config is not written. Confirmation and `--force` behave as for any delete.
- If any of the agent's paths still exist, the confirmation lists them before anything moves to Trash.
- Doctor's `Skipped missing registered agent database` warning names `openclaw agents delete <id>` for unconfigured, non-reserved agents. A configured agent's missing database (the upgrade-shadow case) keeps the old text. The orphan-directory note names the same command instead of "remove stale dirs".
- An id with no config entry, deletion record or registration is still "not found". Nothing happens automatically: no config edit, Doctor run or maintenance cycle removes a registration.

## Update behavior

Doctor wording only; no migration, schema, stored row or update-path change.

## User population

Gateway and CLI installs that retired an agent by removing it from config and deleting its directory. Two reporters on #205927.

## Evidence

- `src/commands/agents.delete.test.ts` "retires an unconfigured agent that is still registered":
  - files gone: Doctor's state migration reports the missing store on two runs, `agents delete retired --force` exits 0, the registration is gone, the deletion journal is complete, then two Doctor runs are silent. Red on main `fe1e8208` (no command pointer; delete answers "not found").
  - directory remains: the confirmation lists the existing agent directory; cancelling changes nothing; confirming moves it to Trash and removes the registration. Red on main (no prompt is reached: "not found").
  - unknown id with no config entry, record or registration: still "not found".
- Guards green: `state-upgrade.large-agent-db.test.ts` (#203130: a database omitted from the upgrade copy keeps its registration), `state-migrations.media-persistence-targets.test.ts`, `agent-deletion-journal-initialization.test.ts`, `doctor-state-integrity.test.ts`, and the Gateway `agents-delete` integration, upgrade and drain suites.
- Real Gateway, isolated (own port, empty HOME and state, `env -i`). Configure `main` and `retired`, start and stop the Gateway, remove `retired` from config and delete its directory, start the Gateway, then run the CLI against it:

  ```text
  main fe1e820
    doctor: Skipped missing registered agent database <state>/agents/retired/agent/openclaw-agent.sqlite.
    openclaw agents delete retired --force -> exit 1: Agent "retired" not found. Run openclaw agents list to see configured agents.
    doctor x2 afterwards: warning on every run; registry rows: main,retired
  this PR 53a60cd
    doctor: Skipped missing registered agent database <state>/agents/retired/agent/openclaw-agent.sqlite. If agent "retired" is retired, run openclaw agents delete retired to remove its registration.
    openclaw agents delete retired --force -> exit 0: Deleted agent: retired   (Gateway log: agents.delete ✓)
    doctor x2 afterwards, same Gateway still running, no restart: no warning; registry rows: main
  upgrade: state created by v2026.11.10 (latest stable), then this PR: same result as above
  ```

## Accepted edge cases

- A completed keep-files deletion whose files remain can be deleted again, this time with its files (moved to Trash; the confirmation lists them).
- `agents delete` does not refuse a store Doctor holds back after a lost deletion journal; Doctor still prints its restore-first guidance.
- If the registration points at a database on an unmounted volume, the confirmation says none of the agent's files were found on disk; deletion removes only the registration.

Final head `1c7963b9` (`53a60cd2` with `main` merged in, to pick up the protocol-allowlist fix from #207259). On that build, the same isolated-Gateway run again: Doctor warns before the delete; `agents delete retired --force` runs through the running Gateway; `doctor` and `status` are then silent on two runs each, without a restart; the registry holds `main` only; the directory stays absent. Local review on `1c7963b9`: patch is correct, 0 findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 28, 2026
…he protocol event allowlist (#207288)

## Problem
`security-fast` fails on every PR based on current `main` again:
```
Protocol event coverage check failed:
  - [ios] allowlist entry "controlUi.sessionPullRequests.changed" is now handled; remove it from scripts/protocol-event-coverage.allowlist.json.
```
#206640 (`18356ea02fce`, iOS PR pills) made iOS handle `controlUi.sessionPullRequests.changed`, but the allowlist still says iOS does not handle it. This is the same failure as #207259 with a different entry. #207258 runs this check on `main` pushes so that the next stale entry shows on `main`.

## Solution
Remove the iOS `controlUi.sessionPullRequests.changed` allowlist entry. The Android entry stays: `apps/android` has no handler for the event.

## Evidence
- `node scripts/check-protocol-event-coverage.mts` on `origin/main` `2595c38a`: the failure above.
- The same check on this branch: `Protocol event coverage OK: 75 gateway events; ios handles 30, allowlists 45; android handles 26, allowlists 49.`

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

## Problem
`security-fast` fails on every PR based on current `main`:
```
Protocol event coverage check failed:
  - [ios] allowlist entry "session.tool" is now handled; remove it from scripts/protocol-event-coverage.allowlist.json.
```
openclaw#206602 (`83d7a819`) made the iOS chat surface handle `session.tool`, but the allowlist still says iOS does not handle it. On `main`, the push CI does not reach this check, so `main` looks green. PR runs (for example, openclaw#207238) fail.

## Solution
Remove the iOS `session.tool` allowlist entry. The Android entry stays: Android still does not handle the event.

## Evidence
- `node scripts/check-protocol-event-coverage.mts` on `origin/main` `704cd214`: the failure above.
- The same check on this branch: `Protocol event coverage OK: 75 gateway events; ios handles 29, allowlists 46; android handles 26, allowlists 49.`
- Local ClawSweeper on `b8041413`: patch is correct, no findings.

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

## Problem

A utility task that cancels its own work makes the fallback chain run the next utility model.

- The Activity recap, titles and transcript summaries pass a currency guard (`assertCurrent`) to `runUtilityCompletion`. The guard throws when the task's own work goes stale: the recap's session changed or a newer recap took over ("Activity recap lifecycle or utility model changed"), the title owner retired, or a newer transcript capture owner took the lane.
- When it throws, the caller's abort signal is still live. The fallback runner's only cancel fact is that signal (`resolveChainStopReason`, `model-fallback-attempt.ts`), so it counts the throw as a model failure and starts the next utility model.
- Real-user log signature (a production team Gateway, 4.35 h): 72 `model_fallback_decision candidate_failed` on the utility primary with the recap's self-cancel error; 19 of them went on to a configured utility fallback that the runtime does not offer, each failing with `model_not_found` and a "Activity recap deferred" line.

## Change

`runUtilityCompletion` (the one owner every utility user goes through) wraps the caller's `assertCurrent` on the fallback path. When it throws, a local controller is aborted with that same error and the error is rethrown. The chain receives `AbortSignal.any([caller, local])`, so the existing caller-cancel stop applies. No error-name or message match, no new error class, no runner change.

- A real model failure with a current caller still falls back (test).
- The no-fallback path is unchanged: with one candidate there is no next model to stop.

## User impact

- Recaps, titles, transcript notes and composer predictions that go stale stop at once instead of trying the next utility model, and a stale recap no longer produces a fallback `model_not_found` error or a retry delay. The chain logs one `model fallback chain stopped reason=caller_signal_aborted` line instead.
- Not changed: progress narration and the session observer already cancel through their abort signal.

## Evidence

| Test | Main | This PR |
|---|---|---|
| `utility-completion.runtime.test.ts`: guard throws the recap's `AbortError`, caller signal live | 3 model calls | 1 |
| `conversation-label-generator.test.ts`: title owner retires during the utility attempt | `gpt-mini`, `utility-backup` | `gpt-mini` |
| `summary-model.test.ts`: a newer capture owner takes the summary lane during the attempt (real lane-generation guard) | `utility-test-model`, `utility-backup` | `utility-test-model` |
| Guard present, model fails with a timeout | falls back | falls back |

- Each red was run with main's `utility-completion.ts` against the new tests; all green with the change. The three touched test files pass in full (19, 21 and 18 tests).
- `tsgo:core`, core test typecheck and oxlint on the touched files are clean.
- Adversarial review: land. Its one gap is taken: composer prediction's custom runner called the raw caller guard (`composer-prediction-completion.ts`), so its throw bypassed the wrapper; it now calls the candidate's guard. The review also confirmed that the wrapper sees only the caller's guard: the operator-model check, the timeout and the closed check inside isolated completion still fall back as before.
- Local review on head `5bcb1ab3` (after merging main for openclaw#207259): patch is correct, 0 findings, security cleared.
- Live proof gap (named): the self-cancel is a timing race (the session changes or a newer task takes over during the model call), so an isolated Gateway run cannot trigger it on demand. The tests drive the real guards (recap error shape, the title owner's guard, the transcript lane generation) through the real fallback runner. Production confirmation is the post-deploy log count: the recap self-cancel fallback decisions should go from 72 per 4.35 h to 0.

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

## What problem this solves

Fixes openclaw#205927 (with openclaw#207212, which stopped maintenance from recreating the deleted directory).

An agent removed from `agents.entries` by hand, whose directory was then deleted as Doctor advised, keeps its row in the shared agent-database registry. `openclaw doctor` then prints `Skipped missing registered agent database …` on every run, and no supported command can clear it: `openclaw agents delete <id>` answered "not found" because the agent is not configured and has no deletion record.

Doctor deliberately does not drop a registration just because its file is missing (openclaw#203130: the startup upgrade copies state without databases over 64 MiB, so that rule deleted real registrations). The removal therefore belongs to explicit agent deletion.

## Change

- `openclaw agents delete <id>` and the Gateway `agents.delete` method accept an agent that is not in config but still has a registered database. They run the existing journaled deletion: paths that are already gone are skipped, the registrations are removed with the journal, and config is not written. Confirmation and `--force` behave as for any delete.
- If any of the agent's paths still exist, the confirmation lists them before anything moves to Trash.
- Doctor's `Skipped missing registered agent database` warning names `openclaw agents delete <id>` for unconfigured, non-reserved agents. A configured agent's missing database (the upgrade-shadow case) keeps the old text. The orphan-directory note names the same command instead of "remove stale dirs".
- An id with no config entry, deletion record or registration is still "not found". Nothing happens automatically: no config edit, Doctor run or maintenance cycle removes a registration.

## Update behavior

Doctor wording only; no migration, schema, stored row or update-path change.

## User population

Gateway and CLI installs that retired an agent by removing it from config and deleting its directory. Two reporters on openclaw#205927.

## Evidence

- `src/commands/agents.delete.test.ts` "retires an unconfigured agent that is still registered":
  - files gone: Doctor's state migration reports the missing store on two runs, `agents delete retired --force` exits 0, the registration is gone, the deletion journal is complete, then two Doctor runs are silent. Red on main `580d6b3b` (no command pointer; delete answers "not found").
  - directory remains: the confirmation lists the existing agent directory; cancelling changes nothing; confirming moves it to Trash and removes the registration. Red on main (no prompt is reached: "not found").
  - unknown id with no config entry, record or registration: still "not found".
- Guards green: `state-upgrade.large-agent-db.test.ts` (openclaw#203130: a database omitted from the upgrade copy keeps its registration), `state-migrations.media-persistence-targets.test.ts`, `agent-deletion-journal-initialization.test.ts`, `doctor-state-integrity.test.ts`, and the Gateway `agents-delete` integration, upgrade and drain suites.
- Real Gateway, isolated (own port, empty HOME and state, `env -i`). Configure `main` and `retired`, start and stop the Gateway, remove `retired` from config and delete its directory, start the Gateway, then run the CLI against it:

  ```text
  main 580d6b3
    doctor: Skipped missing registered agent database <state>/agents/retired/agent/openclaw-agent.sqlite.
    openclaw agents delete retired --force -> exit 1: Agent "retired" not found. Run openclaw agents list to see configured agents.
    doctor x2 afterwards: warning on every run; registry rows: main,retired
  this PR 53a60cd
    doctor: Skipped missing registered agent database <state>/agents/retired/agent/openclaw-agent.sqlite. If agent "retired" is retired, run openclaw agents delete retired to remove its registration.
    openclaw agents delete retired --force -> exit 0: Deleted agent: retired   (Gateway log: agents.delete ✓)
    doctor x2 afterwards, same Gateway still running, no restart: no warning; registry rows: main
  upgrade: state created by v2026.11.10 (latest stable), then this PR: same result as above
  ```

## Accepted edge cases

- A completed keep-files deletion whose files remain can be deleted again, this time with its files (moved to Trash; the confirmation lists them).
- `agents delete` does not refuse a store Doctor holds back after a lost deletion journal; Doctor still prints its restore-first guidance.
- If the registration points at a database on an unmounted volume, the confirmation says none of the agent's files were found on disk; deletion removes only the registration.

Final head `1c7963b9` (`53a60cd2` with `main` merged in, to pick up the protocol-allowlist fix from openclaw#207259). On that build, the same isolated-Gateway run again: Doctor warns before the delete; `agents delete retired --force` runs through the running Gateway; `doctor` and `status` are then silent on two runs each, without a restart; the registry holds `main` only; the directory stays absent. Local review on `1c7963b9`: patch is correct, 0 findings.

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

## Problem
`security-fast` fails on every PR based on current `main` again:
```
Protocol event coverage check failed:
  - [ios] allowlist entry "controlUi.sessionPullRequests.changed" is now handled; remove it from scripts/protocol-event-coverage.allowlist.json.
```
openclaw#206640 (`5d7cefb41ea2`, iOS PR pills) made iOS handle `controlUi.sessionPullRequests.changed`, but the allowlist still says iOS does not handle it. This is the same failure as openclaw#207259 with a different entry. openclaw#207258 runs this check on `main` pushes so that the next stale entry shows on `main`.

## Solution
Remove the iOS `controlUi.sessionPullRequests.changed` allowlist entry. The Android entry stays: `apps/android` has no handler for the event.

## Evidence
- `node scripts/check-protocol-event-coverage.mts` on `origin/main` `e6fe0a36`: the failure above.
- The same check on this branch: `Protocol event coverage OK: 75 gateway events; ios handles 30, allowlists 45; android handles 26, allowlists 49.`

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

## Problem

A utility task that cancels its own work makes the fallback chain run the next utility model.

- The Activity recap, titles and transcript summaries pass a currency guard (`assertCurrent`) to `runUtilityCompletion`. The guard throws when the task's own work goes stale: the recap's session changed or a newer recap took over ("Activity recap lifecycle or utility model changed"), the title owner retired, or a newer transcript capture owner took the lane.
- When it throws, the caller's abort signal is still live. The fallback runner's only cancel fact is that signal (`resolveChainStopReason`, `model-fallback-attempt.ts`), so it counts the throw as a model failure and starts the next utility model.
- Real-user log signature (a production team Gateway, 4.35 h): 72 `model_fallback_decision candidate_failed` on the utility primary with the recap's self-cancel error; 19 of them went on to a configured utility fallback that the runtime does not offer, each failing with `model_not_found` and a "Activity recap deferred" line.

## Change

`runUtilityCompletion` (the one owner every utility user goes through) wraps the caller's `assertCurrent` on the fallback path. When it throws, a local controller is aborted with that same error and the error is rethrown. The chain receives `AbortSignal.any([caller, local])`, so the existing caller-cancel stop applies. No error-name or message match, no new error class, no runner change.

- A real model failure with a current caller still falls back (test).
- The no-fallback path is unchanged: with one candidate there is no next model to stop.

## User impact

- Recaps, titles, transcript notes and composer predictions that go stale stop at once instead of trying the next utility model, and a stale recap no longer produces a fallback `model_not_found` error or a retry delay. The chain logs one `model fallback chain stopped reason=caller_signal_aborted` line instead.
- Not changed: progress narration and the session observer already cancel through their abort signal.

## Evidence

| Test | Main | This PR |
|---|---|---|
| `utility-completion.runtime.test.ts`: guard throws the recap's `AbortError`, caller signal live | 3 model calls | 1 |
| `conversation-label-generator.test.ts`: title owner retires during the utility attempt | `gpt-mini`, `utility-backup` | `gpt-mini` |
| `summary-model.test.ts`: a newer capture owner takes the summary lane during the attempt (real lane-generation guard) | `utility-test-model`, `utility-backup` | `utility-test-model` |
| Guard present, model fails with a timeout | falls back | falls back |

- Each red was run with main's `utility-completion.ts` against the new tests; all green with the change. The three touched test files pass in full (19, 21 and 18 tests).
- `tsgo:core`, core test typecheck and oxlint on the touched files are clean.
- Adversarial review: land. Its one gap is taken: composer prediction's custom runner called the raw caller guard (`composer-prediction-completion.ts`), so its throw bypassed the wrapper; it now calls the candidate's guard. The review also confirmed that the wrapper sees only the caller's guard: the operator-model check, the timeout and the closed check inside isolated completion still fall back as before.
- Local review on head `5bcb1ab3` (after merging main for #207259): patch is correct, 0 findings, security cleared.
- Live proof gap (named): the self-cancel is a timing race (the session changes or a newer task takes over during the model call), so an isolated Gateway run cannot trigger it on demand. The tests drive the real guards (recap error shape, the title owner's guard, the transcript lane generation) through the real fallback runner. Production confirmation is the post-deploy log count: the recap self-cancel fallback decisions should go from 72 per 4.35 h to 0.

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

(cherry picked from commit e2fa67a)

Release adaptation: Combine the release transcript summary helpers with the upstream cancel-through-persistence regression imports.

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

A utility task that cancels its own work makes the fallback chain run the next utility model.

- The Activity recap, titles and transcript summaries pass a currency guard (`assertCurrent`) to `runUtilityCompletion`. The guard throws when the task's own work goes stale: the recap's session changed or a newer recap took over ("Activity recap lifecycle or utility model changed"), the title owner retired, or a newer transcript capture owner took the lane.
- When it throws, the caller's abort signal is still live. The fallback runner's only cancel fact is that signal (`resolveChainStopReason`, `model-fallback-attempt.ts`), so it counts the throw as a model failure and starts the next utility model.
- Real-user log signature (a production team Gateway, 4.35 h): 72 `model_fallback_decision candidate_failed` on the utility primary with the recap's self-cancel error; 19 of them went on to a configured utility fallback that the runtime does not offer, each failing with `model_not_found` and a "Activity recap deferred" line.

`runUtilityCompletion` (the one owner every utility user goes through) wraps the caller's `assertCurrent` on the fallback path. When it throws, a local controller is aborted with that same error and the error is rethrown. The chain receives `AbortSignal.any([caller, local])`, so the existing caller-cancel stop applies. No error-name or message match, no new error class, no runner change.

- A real model failure with a current caller still falls back (test).
- The no-fallback path is unchanged: with one candidate there is no next model to stop.

- Recaps, titles, transcript notes and composer predictions that go stale stop at once instead of trying the next utility model, and a stale recap no longer produces a fallback `model_not_found` error or a retry delay. The chain logs one `model fallback chain stopped reason=caller_signal_aborted` line instead.
- Not changed: progress narration and the session observer already cancel through their abort signal.

| Test | Main | This PR |
|---|---|---|
| `utility-completion.runtime.test.ts`: guard throws the recap's `AbortError`, caller signal live | 3 model calls | 1 |
| `conversation-label-generator.test.ts`: title owner retires during the utility attempt | `gpt-mini`, `utility-backup` | `gpt-mini` |
| `summary-model.test.ts`: a newer capture owner takes the summary lane during the attempt (real lane-generation guard) | `utility-test-model`, `utility-backup` | `utility-test-model` |
| Guard present, model fails with a timeout | falls back | falls back |

- Each red was run with main's `utility-completion.ts` against the new tests; all green with the change. The three touched test files pass in full (19, 21 and 18 tests).
- `tsgo:core`, core test typecheck and oxlint on the touched files are clean.
- Adversarial review: land. Its one gap is taken: composer prediction's custom runner called the raw caller guard (`composer-prediction-completion.ts`), so its throw bypassed the wrapper; it now calls the candidate's guard. The review also confirmed that the wrapper sees only the caller's guard: the operator-model check, the timeout and the closed check inside isolated completion still fall back as before.
- Local review on head `5bcb1ab3` (after merging main for #207259): patch is correct, 0 findings, security cleared.
- Live proof gap (named): the self-cancel is a timing race (the session changes or a newer task takes over during the model call), so an isolated Gateway run cannot trigger it on demand. The tests drive the real guards (recap error shape, the title owner's guard, the transcript lane generation) through the real fallback runner. Production confirmation is the post-deploy log count: the recap self-cancel fallback decisions should go from 72 per 4.35 h to 0.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e2fa67a)

Release adaptation: exercise the same capture owner supersession with the stable utterance snapshot shape and public provider types. Later PR-number mentions are unrelated; no required follow-up.

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

impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. scripts Repository scripts size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant