Skip to content

fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list - #660

Merged
scuttletoby merged 5 commits into
mainfrom
fix/643-model-guard-followups
Nov 20, 2026
Merged

scuttletoby merged 5 commits into
mainfrom
fix/643-model-guard-followups

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Fixes #643

What

  1. Inherited agent option. On delegate_task and create_threads, T3 puts the parent's options under the pick when the instance and model are the same. The child of an OpenCode parent that ran an agent, or a Kiro parent that ran a mode, kept that agent, and the model guard could not see it. Now the fork's delegation checks (apps/server/src/fork/delegateChecks.ts, withoutInheritedAgent) drop an inherited agent or mode option when the pick names its model, unless the call names that option itself. A pick that names no model keeps the parent's options, as before; the guard refuses such a T3 pick. The drop runs in both seats: beforeWorkspace, after pacing, so a moved pick is covered too, and beforeCreateThread. A retry passes both seats untouched, as every seat does.
  2. A level the model does not offer. --self-check now compares each claudeAgent row's efforts with T3's model list (t3ModelManifests, building on the model-guard: self-check reports an "ultracodeOption": false row whose model now has the option #600 reading). It checks the choices of the effort option, plus ultracode when the model has the ultracode option; with several lists, a level must be offered in each. These are reported as problems: a level the model does not offer, a model the list gives no option list, a list that cannot be read, and rows with efforts but no list named. A model that is not in the list (a custom model) is a note: line.

A contract test keeps the server's AGENT_OPTION_IDS and the guard's DRIVER_MODEL_OPTION_IDS in step, and the fork CI's three sparse checkouts now include delegateChecks.ts. Every existing guard refusal is kept.

Why

The guard checks only the call. An option inherited on the server side sat outside the guard's view. An allowed level that the model does not offer runs the model's default level outside delegate_task: on launch, configure, or a project's default.

General vs project

All general. The agent option ids are T3's own drivers' ids (OpenCode agent, Kiro mode), and the self-check reads whatever model list and policy a machine names. Nothing here is specific to one machine or project.

State

  • Runs again: withoutInheritedAgent returns the same result on a second run, and every case in the table checks this. The self-check keeps nothing between runs and reads the lists again each time; a test runs it twice and gets the same report.
  • Stopped half-way / retry: a retried dispatch passes both seats untouched. The receipt dedups it, so a retry does not drop an option the first attempt kept (tested with an agent option on a retry). A half-written model list (invalid JSON) is reported, never taken as clean.
  • Old / empty / missing state: an unknown instance (not in the provider list) drops every agent id, which fails closed. A target with no options is returned unchanged. An old machine file without t3ModelManifests is now reported when the policy has a claudeAgent row with efforts. A list that is missing or unreadable is reported. In mode off, nothing is compared. A model that loses a level in a T3 reload is reported on the next run.

Tests

  • apps/server/src/fork/delegateChecks.test.ts: a cases table for withoutInheritedAgent (opencode, kiro, an unknown instance, an agent named by the call, no model, a codex id that is not an agent option, opencode mode), both seats drop the option, and a retry keeps it.
  • OrchestratorMcpService.test.ts: delegate_task and create_threads end to end (model named, model and effort named, agent named by the call, no model).
  • OrchestratorMcpService.usageGate.test.ts: in enforce, a pick moved to another instance does not take the parent's agent.
  • guard.test.py: test_t3_model_list_levels_are_compared, with contract tests for the bundled list and for AGENT_OPTION_IDS. The red check gained 9 mutations, one per new self-check rule.
  • install.test.py: a level the model does not offer, in the installed self-check, and 2 new mutations.

Red on the old code (run): vitest had 3 failures in the service and seat tests and 1 in usageGate. In guard.test.py, the new functions were missing and the AGENT_OPTION_IDS contract failed. In install.test.py, the new test failed because the report was absent. All green now: guard 97 OK, install 36 OK, the three vitest files 134 passed, and typecheck, fmt, lint and knip are clean.

Not fixed / why

  • Levels of drivers other than Claude are not compared. T3's model list has option lists only for Claude models; a contract test pins this. Codex and the others have no option lists there. The README keeps the rule "list in efforts only the levels the model offers" for those rows. A possible follow-up is to read T3's provider status caches, which hold the runtime option descriptors of Codex and others.
  • The self-check is a report, not a control, as with model-guard: self-check reports an "ultracodeOption": false row whose model now has the option #600. The hook does not read T3's list on each call.

🤖 Generated with Claude Code

…ls with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Review lens B, head 49a6835 (read-only): NOT SAFE to merge as it stands

Verdict: NOT SAFE, for one blocking reason: CI is red on the fork seam check. The guard logic itself has no blocking or major findings. The self-check does not pass a level the model lacks in any case I tried. It reports a missing, unreadable or half-written list and does not take it as clean. Its output holds no file content. The new tests fail on the old code, and they kill 9 of my 11 lib mutants. Fix the seam check and this is SAFE from my side.

Blocking

  1. CI red: fork-seam-check.cjs fails in three checks: "No database schema changes" (fork-checks.yml, step "Fork lines in upstream files"), "Fork checks ran" (which only reports that failure) and "Workflow lint and upstream drift". It names two things:

    • apps/server/src/mcp/OrchestratorMcpService.test.ts (from line 4525): 135 fork lines in an upstream file that has no seam entry. Move these end-to-end tests into a fork test file listed in forkFiles, like OrchestratorMcpService.usageGate.test.ts and OrchestratorMcpService.slotGate.test.ts.
    • apps/server/src/mcp/OrchestratorMcpService.ts:3211 (requested: request.target): the file is in pending (35 lines), and this change adds one more line than it removes. It needs an owner-approved seam entry, or a fork line removed elsewhere in the file to balance it.

    Everything else on 49a6835 is green: Build and Typecheck, Lint, Test Server 1-8, and Fork kit tests 1-3 plus the root run. "Mobile Native Static Analysis" was still pending when I checked.

Major

None.

Minor

  1. The self-check matches models differently from T3, so a valid row can be reported (fork-kit/model-guard/lib/model_guard.py:1108, :1193). T3's resolveClaudeCatalogModel takes the first entry whose slug matches, and only falls back to aliases when no slug matches. _model_entries takes every entry that matches by slug or alias and keeps only the levels offered in all of them. I tried a list where m3 is one entry's slug (levels low, high, max) and another entry's alias (low only). A row m3: [high] is then reported as "allows high", but T3 offers high. This errs on the strict side, and no names overlap in today's bundled list. Matching T3's order (slug first, then the first alias match) would remove the false report. The same applies to ultracode_option_in.
  2. A model offering ultracode but not xhigh gets a false xhigh report. When an effort list has no xhigh, T3's withUltracodeToggle replaces the ultracode choice with xhigh, so T3 does offer xhigh. The self-check reads the raw list and reports xhigh as not offered (tried: profile low, high, ultracode, row [high, xhigh]). No bundled model has this shape today, but the list reloads from upstream. It also errs on the strict side.
  3. A list that names none of the policy's models gives only notes and exits 0 (model_guard.py:1223). A valid list with an empty claudeAgent.models, or a wrong but valid file, gives one note: per row and self-check: OK. The ultracodeOption check reports a missing model as a problem. Suggestion: report a list in which none of the rows' models appear (it is probably the wrong file), and keep a single custom model as a note.
  4. The AGENT_OPTION_IDS contract test ignores a spread (fork-kit/model-guard/tests/guard.test.py:1864). This is the same class as model-guard: pin each built-in driver's effort option id; fail closed for unknown drivers (#629) #638 lens A minor 2. Two mutants stayed green: ...EXTRA_AGENT_IDS, added to the object, and kiro: ["mode", ...KIRO_MORE]. The test reads only word: [...] pairs and quoted strings. Making the list private (not exported) changes nothing for the test, which reads the source file anyway, and it still proves the literal ids. It kills these mutants: kiro dropped, an extra id, single quotes, a quoted key. Suggestion: as in model-guard: pin each built-in driver's effort option id; fail closed for unknown drivers (#629) #638, strip the matched entries and assert nothing is left. The vitest kiro case, not the contract test, covers ANY_AGENT_OPTION_ID being cut loose from the list (delegateChecks.ts:195). I did not run vitest (see below), only read it.
  5. The docs miss the new need for t3ModelManifests. fork-kit/model-guard/README.md:331 still says the key "is needed when the policy has an "ultracodeOption": false row". Since Model guard: inherited agent option and unoffered effort levels (follow-ups from #638) #643 it is also needed for any claudeAgent row with efforts, which means nearly every policy, the example one included. Without it, the self-check now exits 1. Line 558 says this, but "Turn it on" step 2 does not. Also, README.md:207 ("between two self-checks, a T3 model list that changed under a false row") could add "or a level a Claude row allows".
  6. Test gap (model_guard.py:1189): with d.get('type') == 'select' removed, the tests stay green. Such a list (an effort id that is not a select but has options) would then count as offering levels, where T3 offers none. The case is theoretical.
  7. Out of scope, one README line: AGENT_OPTION_IDS covers the agent switches. An ACP registry child still inherits the parent's _t3/session-mode, which the README says some agents use as a second reasoning control, unless the row lists it in effortOptionIds (then the pick must name it). This is older than this PR and is the same class as the inherited ultracode in "inherited from the parent".

Checked and fine

  • Wrong passes: none found. With several entries, a level counts only when every entry offers it, so the result is never looser than T3's first match. A level written in another case (High) is reported. A row model in another case is a note: T3 does not find it either (slugs are exact, aliases ignore case). An alias in another case resolves the way T3 does. The guard's efforts match T3's raw effort ids, including ultrathink. capClaudeCatalogEffort relabels capped levels and keeps them (Claude Code lowers them), so the self-check is right to count them as offered. A model not in the catalog runs any CLAUDE_EFFORT_LEVELS value as given (resolveClaudeCatalogEffort), so a note is right for a custom model.
  • The README's claim holds for Claude: a level not in the model's list resolves to the descriptor's default (resolveClaudeCatalogEffort → getProviderOptionCurrentValue).
  • Missing, unreadable or partial lists: no list named, a missing file, cut-off JSON, bad UTF-8, a manifest without claudeAgent, a profile that is not an object, no capabilities: each is a PROBLEM. Mode off checks nothing. advise reports.
  • Secrets: the lines hold only the policy's model names, the list paths and Python's JSON error position or byte. File content never appears; I tried JSON with a fake token in it, cut off and with bad UTF-8.
  • Why other drivers are left out: sound, and pinned by test_t3_model_list_has_option_lists_for_claude_models_only on the bundled list. Reading the provider status caches is a reasonable follow-up.
  • State: the self-check keeps nothing, and running it again gives the same report (tested in both test files). An old machine file without the key is reported, not passed. The installer does not gate on the self-check, so an upgrade does not stop on the new report. On the server side, a retry passes both seats untouched. create_threads resolves a retry from the committed thread, and the receipt dedups it.
  • Tests: locally, guard.test.py gives 97 OK and install.test.py 36 OK. Red before: with the base's model_guard.py, the new guard test and the Contract case error (the functions are missing), and the new install test fails.
  • Lib mutants: 11 tried, 9 killed. Killed: only the first entry's levels kept, missing model made silent, defaultEffort hint dropped, advise skipped, alias case, slug trim, profile trim, only the first effort checked, only the first list read. Survivors: the select type check (minor 6), and "ultracode only by option id", which is equivalent because the select's ultracode choice is already a level.
  • Not run: vitest. This machine's capacity gate said no to the extra memory, and the temp worktree has no node_modules. CI's Test Server 1-8 and Build and Typecheck pass on 49a6835.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

Review lens A, head 49a6835 (read-only): NOT SAFE

Verdict: NOT SAFE. The local fix is right: both seats drop the inherited agent/mode, the retry is safe, and the new tests fail on the old code and kill my mutants. But one entry point still lets a child take the parent's agent. It is delegate_task with target.environmentId, and I reproduced it. CI is also red.

Blocking

  1. A remote delegate_task still gives the child the parent's agent (apps/server/src/peer/RemoteDelegation.ts:322-326).
    • A target with environmentId goes to remoteDelegation.delegate (OrchestratorMcpService.ts:2760-2771). That happens before resolveTarget and both delegateChecks seats, so withoutInheritedAgent never runs there.
    • There, options = target.options ?? (same instance and model ? inherited.options : undefined). With no driverKind and no providerInstanceId, the instance is the parent's. So a pick that names its model but no options gets all of the parent's options, agent included, in the remote t3_thread_launch.
    • The guard passes such a pick for a row without efforts. That is the right row for an OpenCode model without variants, whose only descriptor is agent (packages/provider-opencode/src/server/status.ts, openCodeCapabilitiesForModel). It is also the right row for a Kiro model without an effort level (kiroModelCapabilities returns no descriptors).
    • Reproduced. I added a throwaway test to RemoteDelegation.test.ts, not committed: parent options: [{id:"agent", value:"plan"}], then delegate_task {target: {environmentId, model}}. launchedWith.modelSelection.options came back as [{"id":"agent","value":"plan"}].
    • The README now says this route is closed (fork-kit/model-guard/README.md:96-99 and :197-199, "Since Model guard: inherited agent option and unoffered effort levels (follow-ups from #638) #643 T3 drops it"). That is not true for this entry.
    • Fix: run the same drop on the remote path. The driver there is unknown locally unless driverKind is given, so drop every ANY_AGENT_OPTION_ID the call does not name, which fails closed. Keep the logic in fork/delegateChecks.ts and call it from one line, for the seam check. Add a remote test that fails without it.
  2. CI is red, on the fork seam check (.github/scripts/fork-seam-check.cjs). It fails three jobs ("No database schema changes", "Workflow lint and upstream drift", and "Fork checks ran" through it), and fork-ci-result after them.
    • apps/server/src/mcp/OrchestratorMcpService.test.ts has 135 fork lines but no seam entry. Move the new end-to-end cases into a fork-owned test file.
    • apps/server/src/mcp/OrchestratorMcpService.ts is "pending", and :3211 (requested: request.target) adds one net line. Fold it into an existing seam line, or get the same value inside the fork seat.

Major

  1. Other options a call may not name are still inherited. The PR's root cause is "the guard checks only the call", but the fix handles only two ids. On a local delegate_task or create_threads that names its model, these still come from the parent. The guard refuses each of them in a call unless a row vouches for it, and the session mode can never be vouched for:

    • Codex serviceTier and cyberAccessProgram (apps/server/src/provider/CodexProvider.ts:300, :327);
    • ACP _t3/session-mode, and any ACP config option with category: "mode" (packages/provider-acp/src/server/sessionConfig.ts:60-150). A session mode can switch the agent's prompt, tools or permissions, the same class as Kiro's mode.

    Fix at the root: a pick that names its model keeps from the parent only the ids the call names. That is upstream's own options: [] rule (OrchestratorMcpService.ts:1731) applied in the fork seat. The guard already makes such a pick name its effort and ultracode, so nothing it needs is lost. If you keep the narrow list instead, add these to "What v0 does not check".

Minor

  1. t3_thread_configure on a running Kiro thread keeps the session's agent. applyKiroAgent returns early when the selection has no mode (packages/provider-kiro/src/server/adapter.ts:315-316). So a guarded configure that names model and effort leaves the current agent running. This is not a child and is older than this PR; one README line would cover it.
  2. The contract test misses a quoted key (fork-kit/model-guard/tests/guard.test.py:1864, regex (\w+): \[). My mutant added "acpRegistry": ["_t3/session-mode"], to AGENT_OPTION_IDS, and Contract.test_agent_option_ids_match_the_servers_list stayed green. Strip the matched entries and assert nothing is left, as model-guard: pin each built-in driver's effort option id; fail closed for unknown drivers (#629) #638 did for BUILT_IN_DRIVERS.
  3. The self-check skips Claude rows without efforts (fork-kit/model-guard/lib/model_guard.py:1204). Such a row's pick sends no options, so resolveTarget keeps the parent's effort when the model has one. Reporting "a row with no efforts whose model offers levels" would catch that slip.
  4. Two mutants survived, both harmless. Dropping the model test in dropInheritedAgent (delegateChecks.ts:419) changes nothing, because withoutInheritedAgent repeats it; only an extra provider read differs. Dropping type == 'select' (model_guard.py:1189) is not pinned by a test.

Checked and fine

  • Every local entry. delegate_task drops after pacing, so a moved pick is covered (mutant: drop before pacing, killed by 11 tests). create_threads drops in beforeCreateThread. t3_thread_launch, configure and a project default take an explicit selection and inherit nothing from a parent. create_threads has no remote path.
  • A model named by alias. requested.model is set, so the drop runs; inheritsOptions compares advertised slugs.
  • Case and whitespace. T3 trims option ids. A differently cased Agent is not an agent id, and the real inherited agent is still dropped because the call did not name it.
  • An unknown instance drops every agent id, which fails closed.
  • State.
    • Retry: a retried dispatch has a receipt, the dispatch replays the stored events, and prepareRun uses the stored run. The retry's modelSelection never starts work, so leaving it untouched is safe. A delegation accepted by older code and retried after the upgrade keeps what already ran.
    • Runs again: withoutInheritedAgent gives the same result on a second run, and so does the self-check.
    • Old, empty or missing files: a missing, unreadable or half-written model list is reported, and a machine file without t3ModelManifests is reported; mode off checks nothing.
  • Tests (under t3-capacity + heavy, in a temp worktree). guard.test.py 97 OK, install.test.py 36 OK, the three vitest files 134 passed.
    • delegateChecks.ts mutants, 8 of 9 killed: the create seat without the drop, the workspace seat without it, the call's own id ignored, an unknown instance keeping ids, a drop without a model, a drop on retry, Kiro taken out, and a drop before pacing. The survivor is the harmless one in minor 4.
    • Self-check mutants, 5 of 6 killed: union instead of intersection, "no list" read as missing, an unreadable list skipped, ultracode not added, only the first level compared.

🤖 Generated with Claude Code

scuttletoby and others added 2 commits November 20, 2026 18:38
While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Fix (head 13afecc)

1. Option inheritance: one rule on every path

  • One rule: ownOptions in apps/server/src/fork/delegateChecks.ts. When a call names its model, the child keeps from the parent only the options the call names. There is no list of option ids: AGENT_OPTION_IDS, withoutInheritedAgent and dropInheritedAgent are gone. A call that names the old effort ultracode keeps the ultracode switch it stands for.
  • Every launch path uses it:
    • local delegate_task, at seat 1 before pacing, and on the target the usage pacer moves to;
    • create_threads, at its seat;
    • remote delegate_task, through delegateChecks.remoteTarget: a call that names a model and no option sends options: [], so RemoteDelegation.ts lays nothing under it.
  • The rule applies only while T3's own model policy is on (server setting modelPolicy, mode advise or enforce). With off, the default, T3 inherits as upstream does.
    • Why: upstream's own test in OrchestratorMcpService.test.ts ("inherits delegated options, merges overrides…", the cases "same model by alias" and "parent named the same model by alias") requires that a call naming the parent's model inherits its options, serviceTier included. An always-on rule fails that test, and that file takes no fork lines.
    • The policy is what makes every call name its model, so it is the natural switch.
    • A settings read that fails applies the rule (fail closed, like the policy).
    • This is the first reader of that setting. The model-guard README has a new step 7 (set T3's policy to advise). The fork docs, go-live, FORK_CHANGES and the Settings text say what it now does.
    • packages/contracts/src/modelPolicy.ts has no seam entry, so its header comment stays as on main.
  • A call with no model is unchanged. A retry of an accepted call is untouched: it reads no setting and keeps its stored target.
  • t3_thread_configure on a running thread: the rule does not apply, because configure changes a thread that already runs. A running Kiro session keeps the agent it runs when the selection names no mode (applyKiroAgent). So a guarded configure that names model and effort leaves that thread's own agent running. t3_thread_launch and a project default take their selection as given and inherit nothing. The README says this.
  • README: the sentence now holds on every path and names the policy switch.

2. Seam check

  • The new tests moved out of upstream's OrchestratorMcpService.test.ts, which is now as on main, into apps/server/src/fork/delegateOwnOptions.test.ts (a fork file).
  • OrchestratorMcpService.ts has one fork line less than on main, so its pending ceiling went down from 35 to 34, as the check asked. No ceiling was raised, so no seam-list PR is needed.
  • fork-tests.yml is as on main.
  • node .github/scripts/fork-seam-check.cjs origin/main HEAD passes.

3. Minors

  • Spread and quoted key in AGENT_OPTION_IDS: no longer apply. The list and its contract test are removed.
  • Self-check skips Claude rows without efforts: a row without efforts allows any level, so there is nothing to compare. With the policy on, a child whose call names its model gets no inherited level either. Not worth a report.
  • The dead model test in dropInheritedAgent: removed with the function.
  • Only a select offers levels: pinned by a test and a mutation.
  • Strict side, wrong report 1 (match order): the self-check now matches as T3 does: an exact slug first, else the first alias that matches, case-insensitive. This applies in both the level check and ultracode_option_in. Tests cover both orders, and two mutations pin it.
  • Strict side, wrong report 2 (ultracode and xhigh): an ultracode effort choice counts as xhigh, as T3 turns it into xhigh. Pinned by a test and a mutation.
  • A model list that names none of the policy's models: now reported ("has none of …: it is likely not T3's model list"), and that list is skipped. Pinned by a test and a mutation.
  • README:331 (model-list setting): t3ModelManifests is needed for an "ultracodeOption": false row or a claudeAgent row with efforts. The drift bullet near line 215 now also covers a level that is no longer offered.
  • ACP _t3/session-mode and mode-category options: covered by the root rule (tested).

Tests

New tests fail on the old code (49a6835):

  • The old server files with the new tests: 22 of 66 fail across delegateOwnOptions.test.ts, delegateChecks.test.ts and OrchestratorMcpService.usageGate.test.ts.
  • The old model_guard.py with the new tests: 10 of 96 fail in guard.test.py.
  • install.test.py passes on both. Only its fixture changed: dropping xhigh now also drops the ultracode choice.

What the tests cover:

  • The rule: delegateOwnOptions.test.ts runs both delegate_task and create_threads through the real service:

    • OpenCode agent;
    • Codex serviceTier and cyberAccessProgram;
    • ACP _t3/session-mode and approval_mode;
    • Claude.

    Without a named option, none of these reaches the child. Options the call names are kept, including the same value as the parent's.

  • Remote: the service hands options: [], or the named agent, to the remote delegation. Through the real RemoteDelegation.layer, the launch on the other machine carries no parent option when the call names its model, the named variant when it names one, and the parent's options when it names no model.

  • Runs again: three calls on one server give the same options, and the rule gives the same result when applied again.

  • Stopped half-way: the first dispatch dies, the same call is made again, and it gives the same options.

  • Old or empty state: a parent with no options, or with a retired option, gives [].

  • Settings: an unreadable setting applies the rule. A call with nothing to drop reads no setting.

  • Unchanged cases: a retry of an accepted call is untouched. With the policy off, every setup runs as upstream does, and so does the pacer's moved pick.

Local results:

  • vitest: 248 passed in 10 files, including upstream's OrchestratorMcpService.test.ts and the peer tests;
  • typecheck, lint, fmt and knip: clean;
  • guard.test.py: 96 OK; install.test.py: 36 OK.

@scuttletoby

Copy link
Copy Markdown
Owner Author

Head moved to 7ab0d28: a merge of main, since the branch conflicted and no PR CI could run. The only hand-resolved conflict was the FORK_CHANGES.md row; the fix itself is unchanged from 13afecc. After the merge: the seam check against main is clean (OrchestratorMcpService.ts stays at 34), both model-guard test files and the delegate/usage-gate/upstream MCP tests pass, typecheck is clean, and CI is green.

@scuttletoby
scuttletoby merged commit c3d9c40 into main Nov 20, 2026
40 checks passed
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ork-follow refuses the series) (#795)

#660 changed upstream's remote delegate_task target line to go through
delegateChecks.remoteTarget and lowered the file's pending ceiling to 34,
but the series against upstream has 35 fork lines and 5 lost lines (limit
4). The pull request check let it through; fork-follow's check from the
upstream tag refuses it, so the fork cannot follow upstream (#792).
This records what main already has; no code change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ls with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ork-follow refuses the series) (#795)

#660 changed upstream's remote delegate_task target line to go through
delegateChecks.remoteTarget and lowered the file's pending ceiling to 34,
but the series against upstream has 35 fork lines and 5 lost lines (limit
4). The pull request check let it through; fork-follow's check from the
upstream tag refuses it, so the fork cannot follow upstream (#792).
This records what main already has; no code change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ls with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ork-follow refuses the series) (#795)

#660 changed upstream's remote delegate_task target line to go through
delegateChecks.remoteTarget and lowered the file's pending ceiling to 34,
but the series against upstream has 35 fork lines and 5 lost lines (limit
4). The pull request check let it through; fork-follow's check from the
upstream tag refuses it, so the fork cannot follow upstream (#792).
This records what main already has; no code change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ls with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
…ork-follow refuses the series) (#795)

#660 changed upstream's remote delegate_task target line to go through
delegateChecks.remoteTarget and lowered the file's pending ceiling to 34,
but the series against upstream has 35 fork lines and 5 lost lines (limit
4). The pull request check let it through; fork-follow's check from the
upstream tag refuses it, so the fork cannot follow upstream (#792).
This records what main already has; no code change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…ls with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…ork-follow refuses the series) (#795)

#660 changed upstream's remote delegate_task target line to go through
delegateChecks.remoteTarget and lowered the file's pending ceiling to 34,
but the series against upstream has 35 fork lines and 5 lost lines (limit
4). The pull request check let it through; fork-follow's check from the
upstream tag refuses it, so the fork cannot follow upstream (#792).
This records what main already has; no code change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…ls with T3's model list (#660)

* fix(model-guard): drop an inherited agent option; compare Claude levels with T3's model list

A delegate_task or create_threads pick that names its model no longer
inherits the parent's OpenCode `agent` or Kiro `mode` option: the fork's
delegation checks drop it on a fresh dispatch (a retry passes untouched),
unless the call names the option itself. The model guard never sees an
inherited option, so it could not refuse it.

The self-check now compares each claudeAgent row's efforts with the
levels T3's model list offers the model (and ultracode when the model has
the ultracode option). A level the model does not offer, a model with no
option list, an unreadable list or no list named is a problem; a model not
in the list is a note. A contract test keeps the server's agent option ids
and the guard's list in step.

Fixes #643

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: a child keeps only the options its call names

While a model policy is on (server setting modelPolicy, advise or enforce),
a call that names its model keeps from the parent only the options the call
names, on every launch path: local delegate_task (both seats, and the target
the usage pacer moves to), create_threads, and remote delegate_task. One
shared rule (ownOptions in fork/delegateChecks.ts) replaces the list of agent
option ids. A call that names no model, a retry of an accepted call, and every
call with the policy off keep upstream's inheritance, so upstream's own
inheritance tests stay as they are. An unreadable setting applies the rule.

The tests move out of upstream's OrchestratorMcpService.test.ts into
fork/delegateOwnOptions.test.ts; OrchestratorMcpService.ts loses a fork line
(pending ceiling 35 -> 34).

Self-check: T3's model match order (exact slug, then the first alias), an
ultracode choice stands for xhigh, only a select offers levels, and a model
list that names none of the policy's models is reported. README fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* model guard follow-ups: keep modelPolicy.ts as on main

Its header comment is not a seam line; the docs say what reads the setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 28, 2026
…ork-follow refuses the series) (#795)

#660 changed upstream's remote delegate_task target line to go through
delegateChecks.remoteTarget and lowered the file's pending ceiling to 34,
but the series against upstream has 35 fork lines and 5 lost lines (limit
4). The pull request check let it through; fork-follow's check from the
upstream tag refuses it, so the fork cannot follow upstream (#792).
This records what main already has; no code change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 29, 2026