Repository navigation
feat(agents): an agent's own default model, one resolver for every turn path (ent#1202) - #4431
Conversation
…nt#1202)
A turn that names no model ran on the platform default for every Claude
Code agent, so an agent's own model never applied to backend-dispatched
turns (reminders, ask-ending and caller wakes, schedules, loops).
- agent_ownership.default_model TEXT NULL, both tracks: SQLite migration
agent_ownership_default_model + Alembic 0123 (single head). NULL changes
nothing.
- services/agent_model_service.resolve_default_model: explicit > public
override > the agent's own model when model_catalog.unrunnable_reason
passes it (catalog ids and Claude Code aliases only) > platform default.
Non-Claude runtimes resolve to None. Unrunnable values are skipped by
name; fail-open except the strict a2a pre-create.
- _default_model_for, the a2a pre-create, the portal ladder and label and
the public-channel model reads all go through it.
- execute_task stamps a pre-created row's blank model_used with the
resolved model (db.stamp_model_used_if_null); never an explicit one.
- GET /api/agents/{name}/model adds backend_turn_model, default_model,
default_model_source and default_model_refused.
Mutation: reverting task_execution_service turns
test_a_wake_with_no_model_runs_and_stamps_the_agents_own_model and
test_a_pre_created_row_gets_the_resolved_model_stamped red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t#1202) The Access tab shows, read-only, the model member messages run on and the model each member agent's own turns (wakes, reminders) run on, with its source (template / default). A template model this instance cannot run is named in a callout with the model that runs instead. Collapsed to the summary when every agent agrees; a bounded list otherwise. Reads the member-agents settings response the welcome panel already loads: the store now keeps the whole view (`settings`), so the tab issues one GET, and a welcome save replaces only `welcome`. Mutation: dropping the store's `settings` capture turns three of the five new specs red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iters (ent#1202)
set_default_model_if(agent, expected, model) updates the column only
while it still holds the value the caller read (IS NOT DISTINCT FROM, so
NULL matches NULL) and returns whether this call changed the row. Of
several writers that read the same old value, exactly one sees True; the
private boot sync uses it so a change is audited once when several
workers start together (abilityai/trinity-enterprise#1202, review I1).
GET /api/agents/{name}/model resolves the default model off the event
loop (asyncio.to_thread; review I4).
Test: test_set_default_model_if_lands_only_on_the_value_read (tmp DB).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o the new column and stamp (ent#1202) CI regression diff on #4431 named 18 new failures. Causes: - Code: get_owned_roster did not select agent_ownership.default_model, so an owned agent's Workspace card could never show its own model, and the owned and shared row shapes diverged (test_ent357_workspace_owned_roster went red). - Test fakes: the a2a message/send mint now resolves through resolve_default_model(strict=True) (plan decision 22: the a2a rung keeps raise-on-failure), so a routers.a2a db fake that mints rows needs get_default_model_raw. Added to the four fakes that mint (test_736, test_ent623, test_ent679_a2a_payment_gate, test_ent751); the other a2a fakes never mint. - Re-pin: the create-mode golden records every agent_ownership column, and default_model is the column ent#1202 adds. Regenerated per the module's rule (serial, TRINITY_ENT695_REGENERATE_GOLDEN=abilityai/trinity-enterprise#1202); the diff is 12 "default_model": null rows plus _meta.regenerated_by. - Re-pin: stamp_model_used_if_null is a new update(schedule_executions) site. It is a non-status writer (model_used only, CAS on IS NULL), so it goes in the inventory's non-status section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/validate-pr — REQUEST CHANGES (tip
|
…ariant #13) Answers /validate-pr V1 on #4431. chat.py points at chat.ts (chat_with_agent, get_chat_history) and connector.ts (run_playbook, ask); a2a.py points at a2a.ts (get_agent_a2a_card) and a2a_call.ts (call_a2a_agent, get_a2a_task). Comment-only; no route changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/validate-pr re-validation: fix-6 (V1 only), tip
|
| line the block printed | answer |
|---|---|
❌ #13 src/backend/routers/chat.py: 19 code line(s) changed; covering tool chat.ts connector.ts untouched |
(b) passes. Header present; tools chat_with_agent, get_chat_history (chat.ts), run_playbook, ask (connector.ts). Contract change = GET /api/agents/{name}/model gains default_model, default_model_source, default_model_refused, backend_turn_model. grep -nE '/model\b|default_model|default_model_source|default_model_refused|backend_turn_model' chat.ts connector.ts a2a.ts a2a_call.ts → 0 hits (exit 1). Same grep over all src/mcp-server/src → 0. No tool sends, branches on, or documents any of these. |
❌ #13 src/backend/routers/a2a.py: 5 code line(s) changed; covering tool a2a.ts a2a_call.ts untouched |
(b) passes. Header present; tools get_agent_a2a_card (a2a.ts), call_a2a_agent, get_a2a_task (a2a_call.ts). The diff changes only how the pre-created row's model is resolved (resolve_default_model(strict=True)). No path, param, status code or response field changes. Same grep → 0 hits. |
❌ #13 src/backend/routers/agent_config.py: 7 code line(s) changed; covering tool permissions.ts untouched |
Not part of V1, but the block prints it, so it is answered here. (b) passes. Header present (get_agent_capability_grants). The only change is the value of resolved_model (now falls through to the agent's own model). grep -rn 'resolved_model|public_chat_model' src/mcp-server/src → 0; default_model|/model in permissions.ts → 0. |
The engineer's report of 0 references is verified.
CI rollup (03:24Z, rechecked 03:33Z)
All checks pass or skip except pytest (head, seed 12345): pending. Job 129604116157 has been in_progress since 03:11:57Z. Passing: Analyze (python), Analyze (javascript-typescript), schema-parity, verify-non-root, CodeQL, gitleaks, both guards, lint, journey-impact, pg-migrations, e2e, build, prod-image-smoke, cached dev baseline, backend boots without enterprise submodule, verify-compose-file-sets, verify-docker-gid-detection. Skipped: report, journey-smoke, pytest (base, inline fallback), pytest (push, absolute failures), auto-merge, clear-needs-fix. dev-ci: success. No ent926 red is visible yet.
Merge condition: wait for pytest (head, seed 12345) and the regression diff to come back green. If ent926 is the only red, that is the known base flake (#4401, #4428). Any other red blocks the merge.
Not run
- The result of
pytest (head, seed 12345)and the regression diff. They were still running when the 15-minute budget ran out. - §5.5 Invariant Setup improvements #5 twin half and every other step. Narrow pass by rider; they are covered by the 03:04Z decision.
Merge order unchanged: #4431 → abilityai/trinity-enterprise#1210 → gitlink bump.
dolho
left a comment
There was a problem hiding this comment.
Reviewed with /validate-pr at d83afc89a (Lane B + schema), together with abilityai/trinity-enterprise#1210. Approving.
Verified
- Schema, both tracks: the SQLite entry
agent_ownership_default_model, Alembic0123_agent_ownership_default_model, and the DDL inschema.py/tables.py.check_alembic_heads.py: 124 revisions, 1 head.devis still at0122, so the only fork is against open #4425 (disjoint tables, mechanical; the body says so). test_ent1202_default_model_resolution.py(20 tests, none reads source text) plus the touched a2a, gate-caller, schedule and regression files: 391 passed.- Frontend:
memberAgentModelPanel.spec.jsmounts the panel; with the three ratchets, 33 passed. - The resolver is an allowlist on read (
unrunnable_reason), so an author-controlled value never reaches--model.stamp_model_used_if_nullonly fills a blank.set_default_model_ifusesIS NOT DISTINCT FROM, which SQLAlchemy renders correctly on both backends. - The change to
test_platform_default_model_regression.pyfollows the helper into the resolver rather than dropping the guard. - Secret, address and host-path greps: clean. No enterprise detail in the public docs.
- CI: all green at this head.
Non-blocking
- Sync calls on the event loop.
GET /modelmoved the resolver intoasyncio.to_thread(review I4), butget_public_channel_model,set_public_channel_model(routers/agent_config.py) and_mint_a2a_execution(routers/a2a.py) callresolve_default_modeldirectly. Each call is now a DB read plus a runtime lookup where there was one settings read. - A non-Claude agent's stored value is never read.
resolve_default_modelreturns before the DB read when the runtime is not Claude Code, soGET /modelreportsdefault_model: nullfor a Codex agent even when the column is set. Harmless for turns; the read-back just can't show what is stored. See the related finding on #1210. set_default_modelhas nodeleted_at IS NULLfilter, while the two readers do. It matchesset_public_channel_model, so I'm only noting it.- No closing keyword ("Part of …#1202"): the issue status needs moving by hand after merge.
- The body flags T10 (public turns now follow the agent's own model) for the release notes. Worth making sure that lands, since it is a behaviour change for anyone who sets the column.
What
An agent can carry its own default model, and every turn path honours it (abilityai/trinity-enterprise#1202, core half).
agent_ownership.default_modelon both database tracks — Alembic0123_agent_ownership_default_modeland the SQLite migration. An empty column changes nothing for any agent.services/agent_model_service.py): explicit model > public-channel override > the agent's own model > platform default. Used by task, schedule, loop and reminder turns, caller and ask-ending wakes (viaexecute_task), the a2a pre-create, and portal / public / channel / paid turns, in that one order. Only an authenticated/chatthat names no model skips it (deferred by the plan).model_usedon pre-created rows (reminder, schedule, loop) is filled byexecute_taskonly when empty (stamp_model_used_if_null).GET /api/agents/{name}/modelgains the effective resolved model and its source (column / platform default), from the resolver, not the container's value. A read-onlyMemberAgentModelPanelin Settings shows it.set_default_model_if(db/agents.py,database.pyfacade) for the enterprise boot sync.The value is set by the enterprise module (companion PR abilityai/trinity-enterprise#1210); without it the column stays empty and behaviour is unchanged.
Rulings carried (trinity-pm, autonomous chain
chain-ent1201)PUTsetter for the column in this issue (needs bug(auth): agent-scoped keys can toggle their own agent's autonomy — PUT /api/agents/{name}/autonomy lacks reject_agent_principal #2996 classification + UI). T7 (a): no hotspot paydown.Review + security
Reading review (Opus) over both repos: MERGEABLE, nothing critical; I1/I5 (enterprise) fixed, I4 here: the
GET /modelresolver call now runs off the event loop./cso --diff: the reviewer's own short pass, nothing at ≥8/10.Tests
Builder: 573 OSS backend and 42 frontend passed. Evidence sweep: 25 of 25 files green in random order (incl.
test_3677GET/PUT/modeland the schema / Alembic / SQLite parity guards). Mutations, each caught and restored byte-identical: platform default ahead of the agent's own → 6 reds;model_used"only if empty" guard dropped →test_stamp_model_used_if_null_fills_only_a_blankred on a real DB. Four existing tests changed on purpose (test_157,test_3749fakes; the platform-default regression source check). Sweep verdict incomplete (fullvitest runhit its 540 s cap with no failure) — CI's full shuffled run is the sweep; the pinned-guard run named in the fix report is not readable from the orchestrator, so CI's guard run is the check.Before merge
src/backend/enterprisegitlink to its merged commit.0123_agent_ownership_default_modelagainst livedev(13d32e22f). feat(guardrails): guardrail events reach the platform with fleet counts, and credentials in tool output are hidden from the model (abilityai/trinity-enterprise#165) #4425 also takes0123on0122_channel_client_blocks(0123_guardrail_events; fix(schedules): a schedule says what tier its runs get, the owner can take it over, and a restricted run is named, marked, alerted and counted (#4281) #4427 is stacked on it) — whichever merges second renumbers to0124. Merge-order call.dev): feat(runtime): OpenCode as a configurable agent runtime (Ollama / OpenRouter / OpenAI-compatible) — Refs #2981 #4196 (routers/chat.py,services/task_execution_service.py); feat(guardrails): guardrail events reach the platform with fleet counts, and credentials in tool output are hidden from the model (abilityai/trinity-enterprise#165) #4425 / fix(schedules): a schedule says what tier its runs get, the owner can take it over, and a restricted run is named, marked, alerted and counted (#4281) #4427 (db/migrations.py,tests/registry.json); fix(auth): live connections follow the account — event sockets, event streams and terminals close when its access changes (abilityai/trinity-enterprise#863) #4426, feat(systems): apply seats the instance's recorded member as primary (ent#1174) #4402 (tests/registry.json). feat(workspace): roster flag for a member whose agent is still being set up (ent#1201, A) #4428 (ent#1201 PR A) and the rest test-merge clean. Sharessrc/frontend/src/stores/memberWelcome.jswithfeature/1198-template-welcome(ent#1198, PR not yet open).Handoffs
task_execution_service.py(Feature/gemini runtime support #2 hotspot) andclient_portal/service.py(Fix: Add missing Docker labels to system agent container #1), one call intoagent_model_service. Paydown deferred (T7)."PUTsetter fordefault_model— follow-up, not built.Part of abilityai/trinity-enterprise#1202.
🤖 Generated with Claude Code