Repository navigation
contracts: modelPolicy person-only setting (model policy M1) - #268
Conversation
7633138 to
5ecbc60
Compare
|
lens: correctness-state-security · reviewer: opus high (pc-l268) · read at: 5ecbc60 Verdict: not safe to merge (one major: a misspelt key decodes to a wider policy instead of failing closed, on both the file read and the save path). Findings1. major: unknown/misspelt keys are silently dropped, so a typo widens the policy (fail-open) on read and on save
2. minor: the "efforts must be non-empty" guard is not tested 3. minor: a save that an agent can trigger erases the person's hand-edited (invalid) rows 4. minor: the patch schema reuses the read-side defaults, so a partial patch silently deletes rows or switches the policy off 5. minor (M2 note): effort names are free text Checked, no finding
|
…ps a bad hand edit Fix round 1 for model policy M1 (#268 review): - An unknown key (a typo such as `effort` or `Mode`) is an error on the settings file read, so it fails closed (enforce, nothing allowed, with the warning) instead of reading as a wider policy; a save refuses it. - A save of modelPolicy needs both `mode` and `allow`: the patch no longer reuses the read-side defaults, so `{mode: "advise"}` cannot drop rows and `{}` cannot turn the policy off. - A bad hand edit is kept as written (`unreadable`) and written back on a save of any other key; saving modelPolicy itself replaces it. - The empty-efforts test now uses a row without defaultEffort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b86c4a1 to
2284c4c
Compare
…ps a bad hand edit Fix round 1 for model policy M1 (#268 review): - An unknown key (a typo such as `effort` or `Mode`) is an error on the settings file read, so it fails closed (enforce, nothing allowed, with the warning) instead of reading as a wider policy; a save refuses it. - A save of modelPolicy needs both `mode` and `allow`: the patch no longer reuses the read-side defaults, so `{mode: "advise"}` cannot drop rows and `{}` cannot turn the policy off. - A bad hand edit is kept as written (`unreadable`) and written back on a save of any other key; saving modelPolicy itself replaces it. - The empty-efforts test now uses a row without defaultEffort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34b3f46 to
48b5b04
Compare
|
Rebased onto main 6e5cb80 (old head 34b3f46). Conflicts were main's new |
Adds the server setting `modelPolicy` (mode off/advise/enforce, allowed driver/model rows with optional efforts, defaultEffort and useFor). A missing key reads as off; a bad value reads as enforce with nothing allowed, with a warning, and the rest of the settings file still loads. A save refuses a bad value. Person-only like every fork setting. Nothing reads the setting yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ps a bad hand edit Fix round 1 for model policy M1 (#268 review): - An unknown key (a typo such as `effort` or `Mode`) is an error on the settings file read, so it fails closed (enforce, nothing allowed, with the warning) instead of reading as a wider policy; a save refuses it. - A save of modelPolicy needs both `mode` and `allow`: the patch no longer reuses the read-side defaults, so `{mode: "advise"}` cannot drop rows and `{}` cannot turn the policy off. - A bad hand edit is kept as written (`unreadable`) and written back on a save of any other key; saving modelPolicy itself replaces it. - The empty-efforts test now uses a row without defaultEffort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The settings table, a section and the FORK_CHANGES line for the new `server.modelPolicy` setting (forkDocs.test.ts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48b5b04 to
84eff53
Compare
|
Rebased onto main c19cfc0 (old head 48b5b04). No conflicts in the PR's own files; the conflict came from main being rebased again. The three commits are unchanged ( Checked at the new head 84eff53:
|
The fork report's settings test requires every fork setting to be a counted feature or named as not a switch. modelPolicy is now a feature reported by its mode (off when absent or mode off; an invalid value reads as enforce, as the load does), and go-live.md lists it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed the red
Ran: the fork report, |
FORK_CHANGES.md keeps both new rows (this PR's linked-task row and #268's model policy row). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k report, and a model policy row Fix round for the review of #543: - A managed-policy lock or a missing write permission now makes every control of a Fork row inert (the switches and lists below the title too), through a fork row wrapper; upstream's row only greys its main control. - The Overview reads where each feature is on with the fork report's own rules, now shared from the contracts (forkFeatures.ts): a project's override or one thread's handoff entry counts on a server screen, a project screen reads its effective value, and selected servers that differ show "Mixed". The fork report uses the same function, and the Overview's labels are typed by every feature, so the two cannot drift. - A reserve typed above 100 is saved as 100 and the field shows 100 again (the field restarts when the bound changes the number). - The lower-effort map refuses a level no model on the server offers (a typo such as hgih=medium). - Model policy (#268): a section in the Agents group after Usage pacing, server only: the mode, the allowed rows edited as JSON and checked as the server's save checks them, a warning with the kept text when the stored value cannot be read, an Overview line and search items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k report, and a model policy row Fix round for the review of #543: - A managed-policy lock or a missing write permission now makes every control of a Fork row inert (the switches and lists below the title too), through a fork row wrapper; upstream's row only greys its main control. - The Overview reads where each feature is on with the fork report's own rules, now shared from the contracts (forkFeatures.ts): a project's override or one thread's handoff entry counts on a server screen, a project screen reads its effective value, and selected servers that differ show "Mixed". The fork report uses the same function, and the Overview's labels are typed by every feature, so the two cannot drift. - A reserve typed above 100 is saved as 100 and the field shows 100 again (the field restarts when the bound changes the number). - The lower-effort map refuses a level no model on the server offers (a typo such as hgih=medium). - Model policy (#268): a section in the Agents group after Usage pacing, server only: the mode, the allowed rows edited as JSON and checked as the server's save checks them, a warning with the kept text when the stored value cannot be read, an Overview line and search items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ings, and usage pacing rows (#543) * feat(web): Settings page "Fork" with the fork's agent and review settings, and usage pacing rows Every fork setting gets one Settings page, Fork (/settings/fork), next to Threads in the Agents nav group. Its top lists each fork feature as on or off (the fork report's rules). Group Agents holds Waits, Wait checks and Agent slots, moved here from Settings > Threads (the Threads page is upstream's again), and the new Usage pacing section; group Reviews holds Review rules. A project screen shows only what a project may override (wait checks, review rules). Usage pacing had no screen: the gate (off, advise, enforce), the lower-effort map as pairs like high=medium, and one row per provider account by its display name with its reserve percent and its spend-first and no-limits switches. An entry for an account that is gone is listed with Remove; a stored entry has a reset. Every row is in the settings search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): the reserve field saves on blur, as upstream's number field does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): Fork page rows lock every control, Overview follows the fork report, and a model policy row Fix round for the review of #543: - A managed-policy lock or a missing write permission now makes every control of a Fork row inert (the switches and lists below the title too), through a fork row wrapper; upstream's row only greys its main control. - The Overview reads where each feature is on with the fork report's own rules, now shared from the contracts (forkFeatures.ts): a project's override or one thread's handoff entry counts on a server screen, a project screen reads its effective value, and selected servers that differ show "Mixed". The fork report uses the same function, and the Overview's labels are typed by every feature, so the two cannot drift. - A reserve typed above 100 is saved as 100 and the field shows 100 again (the field restarts when the bound changes the number). - The lower-effort map refuses a level no model on the server offers (a typo such as hgih=medium). - Model policy (#268): a section in the Agents group after Usage pacing, server only: the mode, the allowed rows edited as JSON and checked as the server's save checks them, a warning with the kept text when the stored value cannot be read, an Overview line and search items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): model policy dialog keeps an unreadable value's rows and asks for the mode; flag unknown drivers - The unreadable-value test used exact text matches; use toMatchTextContent, as vitest 5's toHaveTextContent(string) is exact. - "Edit allowed models" on an unreadable stored value repeats the warning with the kept text, starts from the value's own rows, and saves only after the person picks the mode (the file's own mode is marked), so a save no longer turns the mode into the fail-closed Enforce. - The row warning names the mode select and reset as replacing the value too. - A policy row whose driver no provider on the selected environments has is flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(fork): the model policy editor on an unreadable value, and the unknown-driver flag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3_thread_configure (#731) (#746) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fork seams: announce the model policy lines for a settings file that fails to load (#731) A settings.json that does not parse makes upstream run on its defaults, whose model policy is off. The fork reads the policy from the file on its own and fails closed, which needs two lines in apps/server/src/serverSettings.ts: the import of fork/modelPolicyFile.ts and the modelPolicy value in the fallback settings. Announced here so #747 may add them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…side it in Settings (#731) (#747) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Model policy: check agents' model picks on the server, mark picks outside it in Settings (#731) The server now checks an agent's pick against the model policy rows on every MCP route where an agent picks a model: delegate_task (here and before a task is sent to a linked machine), create_threads, t3_thread_launch and t3_thread_configure. Agents only: the owner's own picks are never refused. - enforce refuses a call that names no model, a model in no row, or an effort off its row, with a plain text listing the rows; advise lets it run, and delegate_task's reply says what enforce would refuse. - A policy the settings file holds but cannot be read refuses every agent pick, unless its own text says advise (then a warning); settings that cannot be read at all refuse too. - Each checked pick is logged as "model policy pick" with its model. - A retry of an accepted call is not checked again; the target the usage pacer moves a task to is checked too. - Settings marks the server's model picks outside the rows and offers the fork's start rows (Opus 5.5 and Fable 5.2) while none are saved. - The model-guard README gets a paste-ready install with those rows in advise mode, and how to switch to enforce later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: check linked-machine launches, every effort id, retries and a broken settings file (#731) Review fixes for the server's model policy check: - t3_thread_launch and t3_thread_configure sent to a linked machine are checked before they are sent (the forwarding check), as the machine there sees no calling thread. - Every effort option counts, not only the first: [reasoning: high, effort: max] reads as high + max and is refused when a row lacks max. Without a known driver (a linked machine), every driver's own effort id counts too. - A remote pick's driverKind is the agent's claim and is no longer read: every row and every effort id count. - A launch retried with the same key that names a model is checked again. - A settings.json that does not parse no longer turns the policy off: it fails closed (every agent pick refused, with a log line) until the file is fixed (fork/modelPolicyFile.ts; two seam lines announced in the seam PR). - An alias is refused with the full id to name, the same here and on a linked machine. - The paced pick logs as "model policy paced pick". - The model guard's effort-id sync test moves to the guard's own tests (no app code names a fork-kit path); kit tests read the contracts file. - README: install step 1 keeps an existing policy file; wording fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: update two tests for the stricter reads (#731) A settings file cut off half-way now fails the model policy closed (the one fork setting not at its pinned default then), and a pick with no known driver reads every driver's effort id, so the delegate checks' row names the effort its picks use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: model policy on a linked-machine retry, and who counts as an agent (#731) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: ultracode default, linked machine's own policy, pacer vs policy (#731) - A pick that leaves the ultracode option out reads the model's catalog default for it; an effort option that holds no effort name is refused. - A launch or model change an agent on a linked machine sent here (the link names its thread) is checked against this machine's own policy. - An effort the usage pacer lowers off the row keeps the checked effort, with a warning naming both settings. - A remote pick refused by some of its model's rows names their drivers. - docs: the retry cases left, and the above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* contracts: modelPolicy person-only setting (model policy M1) Adds the server setting `modelPolicy` (mode off/advise/enforce, allowed driver/model rows with optional efforts, defaultEffort and useFor). A missing key reads as off; a bad value reads as enforce with nothing allowed, with a warning, and the rest of the settings file still loads. A save refuses a bad value. Person-only like every fork setting. Nothing reads the setting yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * contracts: modelPolicy refuses unknown keys, needs a whole patch, keeps a bad hand edit Fix round 1 for model policy M1 (#268 review): - An unknown key (a typo such as `effort` or `Mode`) is an error on the settings file read, so it fails closed (enforce, nothing allowed, with the warning) instead of reading as a wider policy; a save refuses it. - A save of modelPolicy needs both `mode` and `allow`: the patch no longer reuses the read-side defaults, so `{mode: "advise"}` cannot drop rows and `{}` cannot turn the policy off. - A bad hand edit is kept as written (`unreadable`) and written back on a save of any other key; saving modelPolicy itself replaces it. - The empty-efforts test now uses a row without defaultEffort. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: modelPolicy row and section in the fork settings docs The settings table, a section and the FORK_CHANGES line for the new `server.modelPolicy` setting (forkDocs.test.ts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * golive: count modelPolicy in the fork report The fork report's settings test requires every fork setting to be a counted feature or named as not a switch. modelPolicy is now a feature reported by its mode (off when absent or mode off; an invalid value reads as enforce, as the load does), and go-live.md lists it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: scuttletoby <scuttletoby@users.noreply.github.com>
…ings, and usage pacing rows (#543) * feat(web): Settings page "Fork" with the fork's agent and review settings, and usage pacing rows Every fork setting gets one Settings page, Fork (/settings/fork), next to Threads in the Agents nav group. Its top lists each fork feature as on or off (the fork report's rules). Group Agents holds Waits, Wait checks and Agent slots, moved here from Settings > Threads (the Threads page is upstream's again), and the new Usage pacing section; group Reviews holds Review rules. A project screen shows only what a project may override (wait checks, review rules). Usage pacing had no screen: the gate (off, advise, enforce), the lower-effort map as pairs like high=medium, and one row per provider account by its display name with its reserve percent and its spend-first and no-limits switches. An entry for an account that is gone is listed with Remove; a stored entry has a reset. Every row is in the settings search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): the reserve field saves on blur, as upstream's number field does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): Fork page rows lock every control, Overview follows the fork report, and a model policy row Fix round for the review of #543: - A managed-policy lock or a missing write permission now makes every control of a Fork row inert (the switches and lists below the title too), through a fork row wrapper; upstream's row only greys its main control. - The Overview reads where each feature is on with the fork report's own rules, now shared from the contracts (forkFeatures.ts): a project's override or one thread's handoff entry counts on a server screen, a project screen reads its effective value, and selected servers that differ show "Mixed". The fork report uses the same function, and the Overview's labels are typed by every feature, so the two cannot drift. - A reserve typed above 100 is saved as 100 and the field shows 100 again (the field restarts when the bound changes the number). - The lower-effort map refuses a level no model on the server offers (a typo such as hgih=medium). - Model policy (#268): a section in the Agents group after Usage pacing, server only: the mode, the allowed rows edited as JSON and checked as the server's save checks them, a warning with the kept text when the stored value cannot be read, an Overview line and search items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): model policy dialog keeps an unreadable value's rows and asks for the mode; flag unknown drivers - The unreadable-value test used exact text matches; use toMatchTextContent, as vitest 5's toHaveTextContent(string) is exact. - "Edit allowed models" on an unreadable stored value repeats the warning with the kept text, starts from the value's own rows, and saves only after the person picks the mode (the file's own mode is marked), so a save no longer turns the mode into the fail-closed Enforce. - The row warning names the mode select and reset as replacing the value too. - A policy row whose driver no provider on the selected environments has is flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(fork): the model policy editor on an unreadable value, and the unknown-driver flag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3_thread_configure (#731) (#746) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fork seams: announce the model policy lines for a settings file that fails to load (#731) A settings.json that does not parse makes upstream run on its defaults, whose model policy is off. The fork reads the policy from the file on its own and fails closed, which needs two lines in apps/server/src/serverSettings.ts: the import of fork/modelPolicyFile.ts and the modelPolicy value in the fallback settings. Announced here so #747 may add them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…side it in Settings (#731) (#747) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Model policy: check agents' model picks on the server, mark picks outside it in Settings (#731) The server now checks an agent's pick against the model policy rows on every MCP route where an agent picks a model: delegate_task (here and before a task is sent to a linked machine), create_threads, t3_thread_launch and t3_thread_configure. Agents only: the owner's own picks are never refused. - enforce refuses a call that names no model, a model in no row, or an effort off its row, with a plain text listing the rows; advise lets it run, and delegate_task's reply says what enforce would refuse. - A policy the settings file holds but cannot be read refuses every agent pick, unless its own text says advise (then a warning); settings that cannot be read at all refuse too. - Each checked pick is logged as "model policy pick" with its model. - A retry of an accepted call is not checked again; the target the usage pacer moves a task to is checked too. - Settings marks the server's model picks outside the rows and offers the fork's start rows (Opus 5.5 and Fable 5.2) while none are saved. - The model-guard README gets a paste-ready install with those rows in advise mode, and how to switch to enforce later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: check linked-machine launches, every effort id, retries and a broken settings file (#731) Review fixes for the server's model policy check: - t3_thread_launch and t3_thread_configure sent to a linked machine are checked before they are sent (the forwarding check), as the machine there sees no calling thread. - Every effort option counts, not only the first: [reasoning: high, effort: max] reads as high + max and is refused when a row lacks max. Without a known driver (a linked machine), every driver's own effort id counts too. - A remote pick's driverKind is the agent's claim and is no longer read: every row and every effort id count. - A launch retried with the same key that names a model is checked again. - A settings.json that does not parse no longer turns the policy off: it fails closed (every agent pick refused, with a log line) until the file is fixed (fork/modelPolicyFile.ts; two seam lines announced in the seam PR). - An alias is refused with the full id to name, the same here and on a linked machine. - The paced pick logs as "model policy paced pick". - The model guard's effort-id sync test moves to the guard's own tests (no app code names a fork-kit path); kit tests read the contracts file. - README: install step 1 keeps an existing policy file; wording fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: update two tests for the stricter reads (#731) A settings file cut off half-way now fails the model policy closed (the one fork setting not at its pinned default then), and a pick with no known driver reads every driver's effort id, so the delegate checks' row names the effort its picks use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: model policy on a linked-machine retry, and who counts as an agent (#731) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: ultracode default, linked machine's own policy, pacer vs policy (#731) - A pick that leaves the ultracode option out reads the model's catalog default for it; an effort option that holds no effort name is refused. - A launch or model change an agent on a linked machine sent here (the link names its thread) is checked against this machine's own policy. - An effort the usage pacer lowers off the row keeps the checked effort, with a warning naming both settings. - A remote pick refused by some of its model's rows names their drivers. - docs: the retry cases left, and the above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ings, and usage pacing rows (#543) * feat(web): Settings page "Fork" with the fork's agent and review settings, and usage pacing rows Every fork setting gets one Settings page, Fork (/settings/fork), next to Threads in the Agents nav group. Its top lists each fork feature as on or off (the fork report's rules). Group Agents holds Waits, Wait checks and Agent slots, moved here from Settings > Threads (the Threads page is upstream's again), and the new Usage pacing section; group Reviews holds Review rules. A project screen shows only what a project may override (wait checks, review rules). Usage pacing had no screen: the gate (off, advise, enforce), the lower-effort map as pairs like high=medium, and one row per provider account by its display name with its reserve percent and its spend-first and no-limits switches. An entry for an account that is gone is listed with Remove; a stored entry has a reset. Every row is in the settings search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(web): the reserve field saves on blur, as upstream's number field does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): Fork page rows lock every control, Overview follows the fork report, and a model policy row Fix round for the review of #543: - A managed-policy lock or a missing write permission now makes every control of a Fork row inert (the switches and lists below the title too), through a fork row wrapper; upstream's row only greys its main control. - The Overview reads where each feature is on with the fork report's own rules, now shared from the contracts (forkFeatures.ts): a project's override or one thread's handoff entry counts on a server screen, a project screen reads its effective value, and selected servers that differ show "Mixed". The fork report uses the same function, and the Overview's labels are typed by every feature, so the two cannot drift. - A reserve typed above 100 is saved as 100 and the field shows 100 again (the field restarts when the bound changes the number). - The lower-effort map refuses a level no model on the server offers (a typo such as hgih=medium). - Model policy (#268): a section in the Agents group after Usage pacing, server only: the mode, the allowed rows edited as JSON and checked as the server's save checks them, a warning with the kept text when the stored value cannot be read, an Overview line and search items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): model policy dialog keeps an unreadable value's rows and asks for the mode; flag unknown drivers - The unreadable-value test used exact text matches; use toMatchTextContent, as vitest 5's toHaveTextContent(string) is exact. - "Edit allowed models" on an unreadable stored value repeats the warning with the kept text, starts from the value's own rows, and saves only after the person picks the mode (the file's own mode is marked), so a save no longer turns the mode into the fail-closed Enforce. - The row warning names the mode select and reset as replacing the value too. - A policy row whose driver no provider on the selected environments has is flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(fork): the model policy editor on an unreadable value, and the unknown-driver flag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3_thread_configure (#731) (#746) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fork seams: announce the model policy lines for a settings file that fails to load (#731) A settings.json that does not parse makes upstream run on its defaults, whose model policy is off. The fork reads the policy from the file on its own and fails closed, which needs two lines in apps/server/src/serverSettings.ts: the import of fork/modelPolicyFile.ts and the modelPolicy value in the fallback settings. Announced here so #747 may add them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…side it in Settings (#731) (#747) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Model policy: check agents' model picks on the server, mark picks outside it in Settings (#731) The server now checks an agent's pick against the model policy rows on every MCP route where an agent picks a model: delegate_task (here and before a task is sent to a linked machine), create_threads, t3_thread_launch and t3_thread_configure. Agents only: the owner's own picks are never refused. - enforce refuses a call that names no model, a model in no row, or an effort off its row, with a plain text listing the rows; advise lets it run, and delegate_task's reply says what enforce would refuse. - A policy the settings file holds but cannot be read refuses every agent pick, unless its own text says advise (then a warning); settings that cannot be read at all refuse too. - Each checked pick is logged as "model policy pick" with its model. - A retry of an accepted call is not checked again; the target the usage pacer moves a task to is checked too. - Settings marks the server's model picks outside the rows and offers the fork's start rows (Opus 5.5 and Fable 5.2) while none are saved. - The model-guard README gets a paste-ready install with those rows in advise mode, and how to switch to enforce later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: check linked-machine launches, every effort id, retries and a broken settings file (#731) Review fixes for the server's model policy check: - t3_thread_launch and t3_thread_configure sent to a linked machine are checked before they are sent (the forwarding check), as the machine there sees no calling thread. - Every effort option counts, not only the first: [reasoning: high, effort: max] reads as high + max and is refused when a row lacks max. Without a known driver (a linked machine), every driver's own effort id counts too. - A remote pick's driverKind is the agent's claim and is no longer read: every row and every effort id count. - A launch retried with the same key that names a model is checked again. - A settings.json that does not parse no longer turns the policy off: it fails closed (every agent pick refused, with a log line) until the file is fixed (fork/modelPolicyFile.ts; two seam lines announced in the seam PR). - An alias is refused with the full id to name, the same here and on a linked machine. - The paced pick logs as "model policy paced pick". - The model guard's effort-id sync test moves to the guard's own tests (no app code names a fork-kit path); kit tests read the contracts file. - README: install step 1 keeps an existing policy file; wording fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: update two tests for the stricter reads (#731) A settings file cut off half-way now fails the model policy closed (the one fork setting not at its pinned default then), and a pick with no known driver reads every driver's effort id, so the delegate checks' row names the effort its picks use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: model policy on a linked-machine retry, and who counts as an agent (#731) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: ultracode default, linked machine's own policy, pacer vs policy (#731) - A pick that leaves the ultracode option out reads the model's catalog default for it; an effort option that holds no effort name is refused. - A launch or model change an agent on a linked machine sent here (the link names its thread) is checked against this machine's own policy. - An effort the usage pacer lowers off the row keeps the checked effort, with a warning naming both settings. - A remote pick refused by some of its model's rows names their drivers. - docs: the retry cases left, and the above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…3_thread_configure (#731) (#746) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fork seams: announce the model policy lines for a settings file that fails to load (#731) A settings.json that does not parse makes upstream run on its defaults, whose model policy is off. The fork reads the policy from the file on its own and fails closed, which needs two lines in apps/server/src/serverSettings.ts: the import of fork/modelPolicyFile.ts and the modelPolicy value in the fallback settings. Announced here so #747 may add them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…side it in Settings (#731) (#747) * fork seams: announce the model policy lines on t3_thread_launch and t3_thread_configure (#731) Part of #731. List only (step 1 of "Adding a seam line"): the #731 code change adds two upstream lines to each of two MCP handler files, and changes the fork's own model policy contract file, which the list must name as a fork file. - project/handlers.ts: an agent's t3_thread_launch is checked against the model policy once its model is known, before the slot gate. - thread/handlers.ts: an agent's t3_thread_configure that changes a thread's model is checked before it is dispatched. - forkFiles: packages/contracts/src/modelPolicy* (added by #268, a fork file upstream does not have; like mcpProfile*, playtest* and reviewRules*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Model policy: check agents' model picks on the server, mark picks outside it in Settings (#731) The server now checks an agent's pick against the model policy rows on every MCP route where an agent picks a model: delegate_task (here and before a task is sent to a linked machine), create_threads, t3_thread_launch and t3_thread_configure. Agents only: the owner's own picks are never refused. - enforce refuses a call that names no model, a model in no row, or an effort off its row, with a plain text listing the rows; advise lets it run, and delegate_task's reply says what enforce would refuse. - A policy the settings file holds but cannot be read refuses every agent pick, unless its own text says advise (then a warning); settings that cannot be read at all refuse too. - Each checked pick is logged as "model policy pick" with its model. - A retry of an accepted call is not checked again; the target the usage pacer moves a task to is checked too. - Settings marks the server's model picks outside the rows and offers the fork's start rows (Opus 5.5 and Fable 5.2) while none are saved. - The model-guard README gets a paste-ready install with those rows in advise mode, and how to switch to enforce later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: check linked-machine launches, every effort id, retries and a broken settings file (#731) Review fixes for the server's model policy check: - t3_thread_launch and t3_thread_configure sent to a linked machine are checked before they are sent (the forwarding check), as the machine there sees no calling thread. - Every effort option counts, not only the first: [reasoning: high, effort: max] reads as high + max and is refused when a row lacks max. Without a known driver (a linked machine), every driver's own effort id counts too. - A remote pick's driverKind is the agent's claim and is no longer read: every row and every effort id count. - A launch retried with the same key that names a model is checked again. - A settings.json that does not parse no longer turns the policy off: it fails closed (every agent pick refused, with a log line) until the file is fixed (fork/modelPolicyFile.ts; two seam lines announced in the seam PR). - An alias is refused with the full id to name, the same here and on a linked machine. - The paced pick logs as "model policy paced pick". - The model guard's effort-id sync test moves to the guard's own tests (no app code names a fork-kit path); kit tests read the contracts file. - README: install step 1 keeps an existing policy file; wording fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: update two tests for the stricter reads (#731) A settings file cut off half-way now fails the model policy closed (the one fork setting not at its pinned default then), and a pick with no known driver reads every driver's effort id, so the delegate checks' row names the effort its picks use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: model policy on a linked-machine retry, and who counts as an agent (#731) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fork model policy: ultracode default, linked machine's own policy, pacer vs policy (#731) - A pick that leaves the ultracode option out reads the model's catalog default for it; an effort option that holds no effort name is refused. - A launch or model change an agent on a linked machine sent here (the link names its thread) is checked against this machine's own policy. - An effort the usage pacer lowers off the row keeps the checked effort, with a warning naming both settings. - A remote pick refused by some of its model's rows names their drivers. - docs: the retry cases left, and the above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
What and why
Model policy limits which models (and efforts) agents may pick: an agent's pick must match one of the allowed rows. This PR (M1) only adds the setting and its contract. Nothing reads it yet; the check and the server seats come in M2/M3.
New server setting
modelPolicy, person-only like every fork setting:packages/contracts/src/modelPolicy.ts: the schema, the lenient form used when reading the settings file (ModelPolicyFromSettingsFile), and the strict form used by saves (ModelPolicyPatch).forkSettings.ts: the field, the strict patch field, and patch rulereplace.forkDefaults.ts: the default row (off).Decoding rules
driveris a provider driver slug andmodela non-empty string.effortsis optional. A row without it is a model with no effort control, so only the model is checked. Wheneffortsis given it must be non-empty, because[]would be ambiguous.defaultEffortis optional, but when both it andeffortsare given it must be one ofefforts. Otherwise the row is refused.useForis an optional string: a short note per row that agents see when they pick (the owner's ask in Owner question: start the model policy with Opus 5.5 and Fable 5.2 (medium/high/xhigh) only? #126, so a costly model can be kept for the work it is for without a hard refusal).effortforefforts,default_effort,Mode) is never dropped, because dropping it would read as a wider policy (a row withouteffortsallows every effort; a policy withoutmodereads asoff).modedefaults tooffandallowto[], because the settings writer saves sparse (it drops fields equal to their defaults, so{mode: "enforce", allow: []}is stored as{mode: "enforce"}).modeandalloware required; there are no defaults. The patch rule staysreplace, as forplaytest(the other whole-value strict fork setting), so the strict check sees exactly the value that is saved and two saves at once end with the last one. The read-side defaults are not reused: with them,{mode: "advise"}would be saved as advise with every row gone and{}as off. A save that leaves out either key is refused instead. To turn the policy off a person saves{mode: "off", allow: [...]}, keeping their rows.State questions
{mode: "off", allow: []}, and a save of another key writes nomodelPolicy(tested). Nothing changes, the same as upstream.{mode: "enforce", allow: []}, meaning fail closed with nothing allowed, plus a log warning. The rest of the file still loads. The person's text is kept in memory asunreadableand written back unchanged by every save of another key (an agent's allowed preference save included), so a typo in one row never erases the other rows. Only the person's own save ofmodelPolicyreplaces it. The warning is logged again on each read while the value stays bad.defaultEffortnot inefforts, emptyefforts, unknown key, ormode/allowmissing).modelPolicyby reading the key leniently, so only that key fails, and it fails closed.unreadablevalue is in the settings clients receive, so a later banner can use it.)replace, so the last write wins and the whole value is replaced.Left for M2 (not fixed here)
["high", "high"]) and unknown names ("hgih") are accepted, anddefaultEffortis not checked at all wheneffortsis absent. Unknown names ineffortsfail closed (they never match), but a free-textdefaultEffortthat M2 applies to a launch is not safe: M2 must check it against the driver's real efforts.modelPolicyreadoff(fail open): in upstream's whole-file failure branch every setting reads as its default. It must be closed (forceMODEL_POLICY_FAIL_CLOSEDbeside the existingautomaticUpdates: falseinserverSettings.ts) before or in the PR that turns enforcement on.Person-only
No agent tool can change the key.
FORK_PERSON_ONLY_KEYSis derived from the fork's settings fields, somodelPolicyis on the list without a hand-kept row. The server's person-only test now names it, and checks that a tool input namingmodel_policy(in any spelling) is caught. A full-access agent with a shell can still edit the settings file directly, as for every person-only key, so the policy guides cooperative agents and is not a boundary against a hostile one.Upstream fit
modelPolicy.ts), wired only through the fork's ownforkSettings.ts/forkDefaults.ts, with tests and docs in fork files.General vs project
off).Tests
packages/contracts/src/modelPolicy.test.ts(10) andapps/server/src/serverSettings.forkSettings.test.ts(new "fork model policy" block, 3), plusapps/server/src/fork/personOnlySettings.test.ts(2 extended).Moderead as wider/off; a typo patch and{}/{mode: "advise"}/{allow: [...]}patches were accepted; a bad hand edit was rewritten as{mode: "enforce"}on a save of another key (server test, two cases). The old-file case is a guard and passed before too.NonEmptyArray→Arrayforefforts(2 red; the empty-efforts case now has nodefaultEffort), droppingonExcessProperty: "error"on the read (1 red) or on the patch (1 red), and encoding without the kept value (1 red). The first round's mutations still apply.server.modelPolicyhas its row and section indocs/fork/README.mdand its line inFORK_CHANGES.md;packages/shared/src/forkDocs.test.tswas red (3) without them and is green (23).🤖 Generated with Claude Code