Skip to content

feat(workspace): a user-friendly model dropdown in the chat composer (abilityai/trinity-enterprise#403) - #2615

Merged
vybe merged 20 commits into
devfrom
AndriiPasternak31/ent403
Sep 9, 2026
Merged

vybe merged 20 commits into
devfrom
AndriiPasternak31/ent403

Conversation

@AndriiPasternak31

@AndriiPasternak31 AndriiPasternak31 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes abilityai/trinity-enterprise#403

Manual sign-off completed — 2026-09-08

Completed on PR head 6059a235416c29ed30faf30bf00e0b6ac4d28eca using the isolated ent#403 sibling stack. Older stacks were preserved.

All four composer choices have successful real Anthropic executions. Runtime system/init.model and assistant.message.model agree with the execution record for every choice; this verifies actual model execution beyond dispatch bookkeeping.

Composer choice Runtime model Result
Fastest claude-haiku-4-5-20251001 PASS
Balanced — fast and smart claude-sonnet-5 PASS
Most capable claude-opus-5 PASS
Agent’s default (no explicit model) claude-sonnet-4-6 PASS

Live browser checks also passed for curated labels, preference persistence across reloads and browser contexts, per-agent and per-user isolation, portal-client capability restrictions, hiding the picker for Codex, and disabling it for a group-chat draft.

The narrow-layout defect found during sign-off was fixed in 6059a2354: the picker occupies its own row, so it costs the action row nothing at 375/768/1280px while the 44px action buttons are preserved. Light and dark themes were inspected. (The e2e case that pins this originally asserted an absolute >= 140px field width and failed in CI — see Rebase onto dev below.)

Model-rejection recovery was verified in the browser with controlled provider responses: the rejected preference clears, and a fresh choice survives repeated reloads with the stale verdict. This check does not claim a real provider rejection. Real authentication-failure handling preserved the selected model.

Validation: frontend units 2,354 passed, production build and design-token check passed, focused browser suite 5 passed. The broader compact-header suite still has unrelated selector/loading-timing failures documented during comparison; it is not represented as green.

Rebase onto dev — 2026-09-08

Rebased onto 105be062f, which had moved six commits ahead (the Files tab
#2582/ent#548, the Escape/overlay the #2598 fix, the room JSONL keep-set #2610, and
three CI/submodule fixes). Two conflicts, both additive and both resolved by
keeping each side: PortalAgentCard gains #2582's owned and this PR's
model_default, and learnings.md keeps every entry. Three things were fixed
or corrected on top:

  1. The e2e check was red, and it was this PR's own spec. @smoke ... usable typing space at 375px asserted a >= 140px field and measured 128px on the
    runner across all three attempts, having measured 143px during local sign-off.
    The 15px is the scrollbar — macOS overlays it, the Linux runner reserves it —
    so a floor between the two numbers can only ever be green on one platform, and
    no change to this feature moves it: the <form> element here is
    byte-identical to the one on dev, so 128px at 375px is the platform's
    composer geometry, not something this PR introduced. The check now states the
    claim the fix actually makes, from a single render and relative to the row:
    the picker ends above where the form begins, and the field takes all the slack
    at form.width - buttons * (44 + 8). Both scrollbar regimes agree on that.
    Proven non-ambient: moving the BaseSelect back inside the <form> turns all
    three width cases red.
  2. The requirements section had a duplicate number. It was added as §5.23
    directly after §5.22, but §5.23 was already "Workspace — agents at the centre"
    (ent#523/feat: agent-authoritative execution state machine with single-writer projection (RELIABILITY-005) #524) — the 5.2x run continues further down the file, past sections 6
    and 9 — and two existing docs already pointed at that one. Renumbered §5.32
    and moved beside §5.30 and §5.31, where the two preceding Workspace slices
    appended.
  3. Re-verified after the rebase, against a live stack: tests/unit 14,795
    passed / 33 skipped / 0 failed
    (the two test_1854_agent_mcp_key.py failures
    noted below did not reproduce); frontend units 2,439 passed (107 files);
    production build passed; npm run test:e2e:smoke — CI's exact selection — 77
    passed / 7 skipped / 0 failed
    , including the agent-detail-request-dedupe
    case CI reported flaky. The raw-color scan over src/frontend/src is
    identical to dev file-for-file, and the Alembic single-head, enterprise-
    docs and requirements-structure guards all pass locally.

Where this sits

Step 3 of 7 of the Workspace sequence. Merge order is binding, because these
PRs share PortalConversation.vue:

  • merges after ent#547 (header compact) — already merged (23bb54788), and this
    branch is rebased directly onto it, so that ordering constraint is now satisfied rather
    than pending. Worth knowing for review: ent#547 moved the voice-call control into the
    composer row
    , adjacent to this PR's select. They merge cleanly and the
    h-11 w-11 button rule is untouched (a <select> is not a <button>), and the final sign-off fix places the select on its own row above the textarea
    and action buttons to preserve typing space at narrow widths.
  • trinity#2581 follows

What it does

The Workspace composer had no model control: every turn ran on whatever the agent
defaulted to, and the person in the conversation could neither see it nor change
it. This adds a short, curated, plain-language dropdown for platform users —
three tiers, not the operator combobox (ModelSelector.vue is a preset list plus
free-text over raw model ids: right for an operator panel, wrong in front of a
client).

Where the curated set comes from. It is not a second hand-typed list. Two
fields — workspace and workspace_tier — are appended to ModelEntry in
services/model_catalog.py, the ONE catalog the #2086 registry exists to keep
authoritative, and src/frontend/src/constants/modelCatalog.js is regenerated
from it by scripts/gen_model_catalog.py, never hand-edited. Three entries carry
the flag:

Model Tier shown
claude-opus-5 Most capable
claude-sonnet-5 Balanced — fast and smart
claude-haiku-4-5-20251001 Fastest

Fable 5 is out (its own note also reads "Most capable"; Opus-vs-Fable is an
operator distinction) and every "Legacy" entry is out — a client-facing surface
offering "Claude Opus 4.6 — Legacy" is the combobox this reacts against. Two
import-time assertions make the rules build failures rather than runtime
surprises: WORKSPACE_MODELS ⊆ PUBLIC_CHANNEL_MODELS, and every workspace entry
has a tier. workspace/workspace_tier are keyword-set and appended last —
ModelEntry is a positional frozen dataclass, so a field inserted anywhere else
silently reassigns three booleans on every entry.

AC 5 is resolved as INHERIT. Three states, not two: explicit choice → the
agent's #894 public_channel_model → the platform default. There is deliberately
no third model source — the entire point of the issue is not leaving two
sources silently disagreeing. Blank (""), whitespace and an omitted field all
mean inherit and are normalised to None before validation (the
PUT /api/agents/{name}/public-channel-model idiom); without that normalisation
every default turn 422s on day one, because "" is the control's own default
option value.

Open-core status

OSS-core and ungated, per the ent#356 standing ruling — the Workspace moved
into OSS core, src/backend/client_portal/ is a public package mounted
unconditionally in main.py. An ent-tracker number does not by itself make a
Workspace feature entitlement-gated, and this one is not: no
requires_entitlement, no enterprise_features gate, no enterprise_* table.
The capability gate here is a principal gate (platform vs portal-token), not an
edition gate.

Verification

The completed manual sign-off and its evidence are recorded above. It supersedes the original credential-blocked verification notes. Additional route checks verified invalid model values return bounded 422 errors, portal-token explicit selections return 403, and the agent override is stamped on external-client execution records.

Two things a reviewer must know

  1. A deliberate behaviour change ships with this. The Add per-agent model override for public communication channels #894
    public_channel_model rung now applies to every portal turn, not only a
    platform user's — including external portal-token clients and headless ent#83
    consumers (demonstrated live, table above). On deploy the model changes for
    existing external-client conversations wherever an owner set that override.
    That absence is the defect ent#403 names; gating the rung on the principal
    would leave the streaming route and the synchronous route resolving
    differently, which is exactly what AC 5 exists to kill. Pinned by a test,
    recorded in requirements/core-agent.md §5.32 — and it belongs in the
    release note.
  2. There is deliberately no ownership check. A rostered non-owner can pin
    every turn to Opus and beat the owner's Add per-agent model override for public communication channels #894 cost setting, while Add per-agent model override for public communication channels #894 itself
    is owner-gated. That was an explicit gate decision, recorded with its
    reasoning rather than left to be inferred; the reversal is one
    assert_agent_owner at each of the two router entry points — no payload and
    no UI change.

Review findings already fixed on this branch

  • AC-7 was unmet on the commonest turn. resolve_turn_model terminated in
    None ("let execute_task resolve it"). It does — but its paired
    model_used= write lives inside if not execution_id: and both portal paths
    pre-create the row, so the resolution happened and the stamp never did:
    model_used = NULL for "no pick, no override", the default state of every
    agent. A test had pinned the NULL. Fixed by giving the ladder a concrete last
    rung; the durable lesson is in docs/memory/learnings.md.
  • The self-heal re-fired on every reload. The clear ran from
    rememberVerdict, which also runs on load/reattach off the durable Redis
    verdict (15-min TTL) — so a re-picked model was wiped again on every refresh
    inside that window, and written through to the server for every device. Now on
    settleDelivery only.
  • The 422 echoed an unbounded field. PortalChatRequest.model had no
    max_length while every sibling does. Truncated at 64 before interpolation.

Testing

tests/unit/test_ent403_workspace_model.py 45 (new)
tests/unit/test_2086_model_catalog_parity.py +2
src/frontend/tests/unit/portalModelChoice.spec.js 55 (new)
Full tests/unit, no fail-fast, re-run after the rebase onto ent#547 2 failed / 14443 passed / 30 skipped — both failures are test_1854_agent_mcp_key.py::test_19{,f}, and they are not from this branch: reproduced identically on a detached origin/dev worktree with the same interpreter, deterministic in isolation, and nothing here touches agent_mcp_key_service. CI is green on those same tests across all three seeds, so they are specific to the local environment, not to dev
Frontend 102 files / 2355 tests post-rebase (ent#547 brought its own)
/verify-local --skip-unit --skip-agent PASS — build+import-smoke 9s, boot+health 14s, integration 70 passed / 13 skipped / 2 deselected. --skip-agent is correct: no docker/base-image change

The seam this PR adds — docker_service.agent_container_runtimes, which the
whole capability gate is driven by — is guarded rather than merely exercised:
under sparse=True docker-py's .labels raises, so a rewrite to .labels
would be swallowed by the leaf's own except and answer None forever, silently
returning the Claude control to every Codex agent. Reverting attrs["Labels"] to
.labels turns 3 of those 7 tests red.

Docs

  • docs/memory/requirements/core-agent.md §5.32 (new, AC-by-AC) and
    requirements/public-access.md §47.2 (the catalog dimension)
  • docs/memory/architecture/workspace.md (the payload contract) and
    architecture/backend.md (the docker_service entry). The always-loaded
    architecture.md core is deliberately untouched — no new area, invariant or
    topology change, so per its own editorial rule the update belongs in the owning
    area file
  • docs/memory/feature-flows/workspace-model-choice.md (new) +
    feature-flows/public-channel-model.md (the deliberate change) + an index row
  • docs/memory/learnings.md

Known debt, registered not hidden

The roster now makes two identical /containers/json calls —
agent_container_runtimes() duplicates agent_container_states()'s exact call to
read Labels instead of .status from the same response. Folding them means
re-pointing the leaf #2196's guard suite pins, and asyncio.gather trips #2163's
blanket no-fan-out source guard — which was upheld rather than widened, so the two
reads are sequential (~50–200ms, once per roster load, O(1) in fleet size).
Registered as debt:2026-09-08-roster-pays-two-identical-docker-reads.


Note for the merger: the closing reference is cross-tracker, so GitHub will
not auto-close ent#403 or auto-promote it to status-in-dev — that is a manual
bump at release.

🤖 Generated with Claude Code

@AndriiPasternak31
AndriiPasternak31 marked this pull request as ready for review September 8, 2026 11:28
@AndriiPasternak31

Copy link
Copy Markdown
Contributor Author

Manual sign-off completed — 2026-09-08

Completed on PR head 6059a235416c29ed30faf30bf00e0b6ac4d28eca using the isolated ent#403 sibling stack. Older stacks were preserved.

All four composer choices have successful real Anthropic executions. Runtime system/init.model and assistant.message.model agree with the execution record for every choice; this verifies actual model execution beyond dispatch bookkeeping.

Composer choice Runtime model Result
Fastest claude-haiku-4-5-20251001 PASS
Balanced — fast and smart claude-sonnet-5 PASS
Most capable claude-opus-5 PASS
Agent’s default (no explicit model) claude-sonnet-4-6 PASS

Live browser checks also passed for curated labels, preference persistence across reloads and browser contexts, per-agent and per-user isolation, portal-client capability restrictions, hiding the picker for Codex, and disabling it for a group-chat draft.

The narrow-layout defect found during sign-off was fixed in 6059a2354: the picker occupies its own row, leaving usable typing space at 375/768/1280px while preserving 44px action buttons. Light and dark themes were inspected.

Model-rejection recovery was verified in the browser with controlled provider responses: the rejected preference clears, and a fresh choice survives repeated reloads with the stale verdict. This check does not claim a real provider rejection. Real authentication-failure handling preserved the selected model.

Validation: frontend units 2,354 passed, production build and design-token check passed, focused browser suite 5 passed. The broader compact-header suite still has unrelated selector/loading-timing failures documented during comparison; it is not represented as green.

@vybe

vybe commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

merge-train: ejected — own e2e test failing. e2e/workspace-model-choice.spec.js:52 "model picker leaves usable typing space at 375px" fails on this PR's own merge ref (three toBeGreaterThanOrEqual assertions; the request-dedupe test was merely flaky). Plus a dev conflict. Rides the next train once green.

AndriiPasternak31 and others added 18 commits September 8, 2026 19:44
…tyai/trinity-enterprise#403)

Rule #1 — the requirement lands before the implementation.

core-agent.md §5.23 records the capability and the three things a later reader
would otherwise have to infer from the fact that it merged: AC 5 is settled as
*inherit* (never a third model source), the #894 rung now applies to EVERY
portal turn (a deliberate behaviour change for existing external-client
conversations), and there is deliberately NO ownership check on the override —
a rostered non-owner can beat the owner's cost setting, raised by three
reviewers and knowingly accepted, with the one-line reversal named.

public-access.md §47.2 gains the `workspace` / `workspace_tier` catalog
dimension and the subset rule the Workspace must not break.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
… catalog (Abilityai/trinity-enterprise#403)

`workspace` + `workspace_tier` on `ModelEntry`, three entries flagged, and the
derived `WORKSPACE_MODELS` frozenset the Workspace turn route validates against.
A second hand-typed list is exactly the drift #2086 exists to prevent.

Appended LAST and set by keyword: `ModelEntry` is a positional frozen dataclass
and every entry passes its three booleans positionally, so a field inserted
anywhere else silently reassigns `public_channel` / `admin_default_selectable` /
`recommended` on all ten entries with no error.

Two import-time assertions, both load-bearing rather than decorative:
WORKSPACE_MODELS must be a SUBSET of PUBLIC_CHANNEL_MODELS (the Workspace must
never accept a model the #894 operator route would 422 — the two sources would
then genuinely disagree, which is what AC 5 exists to kill), and a workspace
entry must carry a tier (the option's primary text; empty renders blank).

`workspace_tier` rather than reusing `note`: joining `label — note` yields two
options both leading with "Most capable" and an em-dash nested inside an
em-dash. `note` is copy written for the operator picker.

Fable 5 and every "Legacy" entry stay out — a client-facing surface offering
"Claude Opus 4.6 — Legacy" IS the operator combobox this issue reacts against.

`modelCatalog.js` regenerated (never hand-edited); the parity test's
`_expected_records` hard-codes the emitted key set and asserts equality, so both
new keys had to land there in the same commit.

tests/unit/test_2086_model_catalog_parity.py: 12 passed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…dder, and the row stamp (Abilityai/trinity-enterprise#403)

The capability channel. The roster carries the curated option list
(INSTANCE-level, like `realtime_voice` — options on every card would ship N
copies on exactly the path #2159/#2163 exist to keep small) and each card
carries only its resolved default. Both fail CLOSED: `model_default is None`
means no control renders at all — for every non-platform principal, and for a
non-Claude runtime, where a Claude-model list is a dead affordance because the
platform passes no `--model` to Codex.

`_row_to_card` gains `is_platform` / `runtime` / `model_context` as
keyword-only with NO default. A default would let the agent page keep compiling
while silently serving the wrong card; the safe value differs per call site.

The ladder is ONE function, `resolve_turn_model`: the user's pick → the agent's
states preserved, not collapsed. The middle rung applies to EVERY portal turn,
not only a platform user's — gating it on the principal would leave the
streaming route and the synchronous ent#83 route resolving differently, which
is the "two sources silently disagree" AC 5 exists to kill. It is a deliberate
behaviour change for existing external-client conversations, recorded in
requirements §5.23.

AC 7 is a ROW-CREATION change at two sites, not a kwarg change:
`schedule_executions.model_used` is written only inside `execute_task`'s
`if not execution_id:`, and BOTH portal paths pre-create the row — the #2426
class named in `_precreate_sync_execution`'s own docstring. So the model is
resolved ONCE, immediately after the availability gate (not where it is used —
`_precreate_sync_execution` runs ~200 lines later, past `_persist_user_turn`
and the history read), and threaded to both the row and the turn. A caller that
passes `execution_id` must pass the `resolved_model` it stamped; re-resolving
would let the row and the turn disagree, so that path raises rather than
falling back with `or`.

Degradation is honest and never lies about billing. The AUTH/BILLING/CAPACITY
branches are untouched — there is no "model unavailable" code in the #2320
ladder, and AUTH/BILLING merges into one usage-limit answer with a true cause,
so rewording it whenever a model was picked would blame the model for an
exhausted subscription. Only the generic branch names the model, under a NINTH
category `invalid_model` — the one the client branches on rather than renders,
because it clears the stored preference so the sentence is true next turn.

Validation is at both router entry points: normalise blank → None BEFORE
validating (`""` is the control's own default value; validating the raw field
would 422 every default turn on day one), then the principal gate, then the
closed `WORKSPACE_MODELS` allow-list — never a regex, because the value reaches
the agent as a `--model` argv element. The 422 detail is a STRING:
`deliveryFailureReason` drops anything else to "error 422".

Deviation from the plan, stated: the plan claimed the roster's existing Docker
call already carries the runtime. It does not — that call is `sparse=True`, and
under sparse docker-py's `.labels` RAISES (it reads `attrs["Config"]["Labels"]`,
which only a full inspect populates). The label IS in the summary at
`attrs["Labels"]`, so `agent_container_runtimes()` is a new sparse leaf read the
same way, gathered concurrently with the availability read. That is one extra
`/containers/json` per roster load — O(1) in fleet size, not the N+1 #2160
forbids — rather than re-pointing `_availability_map` at a different leaf, which
would silently unhook the whole #2196 guard suite.

Test churn is all signal: nine `_row_to_card` call sites and three
`_precreate_sync_execution` ones had to state their values (the no-default
decision working), and one `portal_chat` stand-in needed `**kw` like its five
siblings.

tests/unit -k "portal or client_portal or model_catalog or preference or 2133
or 2320": 502 passed, 5 skipped.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…y-enterprise#403)

`portalModelChoice.js` holds every rule as a pure function, for the reason
`portalVoiceMode.js` states: vitest runs `environment: 'node'` with no mount
harness, so a rule kept inside a `.vue` file is a rule no test can reach. The
component is a dispatcher over them.

The control renders only when the SERVER says so — `agent.model_default` is
null for a portal-token client and for a non-Claude runtime, so a missing
field, an older backend, a partial payload and a failed roster read all land on
the same fail-closed result. The roster is the capability channel (#2128); a
gate written against `/api/settings/feature-flags` would be dead for exactly
this audience.

The choice is the user's SERVER record (`workspace_model`) through the existing
`stores/userPreferences.js` engine — no new table, no new identity scheme, and
none of the `anon`-then-email race a browser key on this surface would
reintroduce (`useColumnResize.js`, caught live). Per (user, agent) by
construction, since the server keys the row by user.

Two things keep it honest rather than merely working:

- `reconcileStored` drops a stored id that is no longer on offer. The catalog
  churns by design, and without this a retired id is sent on every turn,
  refused every time, forever, across reloads, with nothing naming the cause.
- a failed turn whose category is `invalid_model` CLEARS the choice — on this
  tab's own settle and on the reattach path, so the server's "switched back to
  the agent's default" is true after a reload too, not just in the tab that saw
  it fail.

The select is disabled with its reason while the draft is room-bound: an
@mention diverts the send into a room whose composer has no model control, so a
live select there would display a setting it is not honouring. `'model-picker'`
joins `VOICE_LOCKED_CONTROLS` for the same class of reason.

Both send paths carry the model, read ONCE before dispatch so the streaming
route and its synchronous fallback cannot run the same turn on different models.

Design contract: `BaseSelect`, never a hand-rolled lookalike — which is also
why `portalComposerAlignment.spec.js`'s h-11 w-11 rule for every `<button>` in
the form still holds. Zero raw palette classes and zero hex added; all chrome
comes from `fieldClasses.js`. An explicit responsive `max-w` because
`FIELD_CLASS` is `w-full` and a native select otherwise sizes to its widest
option beside a `flex-1 min-w-0` textarea — smaller on narrow viewports rather
than hidden, since a control that vanishes on a phone is a capability that
vanishes with it.

Three existing guards moved, each for a stated reason rather than to go green:
`gridStorageKeys.spec.js` (PREF_KEYS is the frontend half of the SERVER
allowlist, so it grows), `portalFailedTurn.spec.js` (its claim is that the copy
and the retryability come from the server's verdict, not that the object has
exactly two keys), and the `computed` getter/setter written as arrow properties
so `portalUndefinedCalls.spec.js`'s `name(` heuristic does not read `get(` as a
call. The self-heal is invoked AFTER `markFailed` so `turnCancel.spec.js`'s
adjacency rule — the more important one — is untouched.

npm run test:unit: 101 files, 2247 passed. npm run check:tokens: OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…prise#403)

Five tests exist because a green suite would otherwise have shipped a feature
that lies about itself, and each names its own bug class:

- `model_used` is persisted at ROW CREATION only, and both portal paths
  pre-create the row. Asserting the persisted kwargs at BOTH sites is the point
  — a test that only proved the value was "passed to the turn" stays green
  throughout the bug. That is #2426's lesson, one column over.
- one turn can produce TWO rows: the cold retry strips `execution_id` and
  re-runs, so `execute_task` makes a second row from the forwarded `model`. The
  test pins that both rows carry the same one.
- `""` is the control's own default-option value, so the four blank forms are
  parametrized: a validator that ran before normalisation would 422 every
  default turn on day one.
- a NON-platform principal resolves the same #894 ladder — the deliberate
  behaviour change, pinned so a later "surely this should be platform-only" has
  to argue with a test. It also asserts the SIGNATURE (`resolve_turn_model`
  cannot see who is asking), which is what makes the two routes agreeing true by
  construction rather than by review.
- AUTH/BILLING/CAPACITY/TIMEOUT copy is asserted UNCHANGED when a model was
  chosen. Rewording those would tell someone their model choice broke a turn
  that an exhausted subscription broke.

The allow-list test feeds it argv-shaped strings (`claude-opus-5
--dangerously-skip-permissions`, a leading `--`, an embedded newline) — the
value reaches the agent as a `--model` argv element, and every one of those
would pass a prefix or regex check.

`_fake_core_db` loads `services.settings_service` BEFORE swapping `database.db`.
That module binds `db` at import, and conftest's #762 restore skips a key with
no baseline — so first-importing it under the fake left every LATER test reading
settings through a stand-in with no `get_setting_value`, surfacing as an empty
ModelContext three sections down. Found by writing the tests; the note is in the
helper so the next person does not re-find it.

Frontend: the pure rules exercised directly plus source-structure assertions for
everything a `node`-environment vitest cannot render. The curated set is checked
against the GENERATED catalog — subset of publicChannel, no "Legacy" in front of
a client, no two options leading with the same words.

tests/unit/test_ent403_workspace_model.py: 35 passed (and green under three
random orderings). npm run test:unit: 102 files, 2301 passed.
tests/lint_sys_modules.py: no new violations.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…inity-enterprise#403)

workspace.md gains the two payload fields beside the `availability` note they
sit next to — why the option list is instance-level and the default per-card,
why both fail closed while `availability` deliberately does not, and why the
three capability arguments to `_row_to_card` carry no defaults.

Plus the two facts a later reader would otherwise re-derive the hard way: the
turn's model is resolved immediately after the availability gate (because
`model_used` is written only at row creation and both portal paths pre-create
the row — the #2426 line), and the runtime read is a SECOND sparse list rather
than a widening of `agent_container_states()`, reading `attrs["Labels"]`
because under `sparse=True` docker-py's `.labels` raises.

backend.md records the new batch leaf beside its single-agent sibling.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…prise#403)

/sync-feature-flows tail step. A new flow doc plus BOTH index rows — the dated
changelog table and the alphabetical Workspace block — because the index entry
is the half that gets forgotten.

The doc carries the reasoning a diff cannot: why curation is a flag on the one
catalog rather than a portal-side list, why the options ride the roster and only
the default rides the card, why `_row_to_card`'s three capability arguments have
no defaults, why the resolution happens right after the availability gate rather
than where the value is used, why the sparse-list runtime read has to go through
`attrs["Labels"]`, and why the usage-limit copy must never mention the model.

`public-channel-model.md` was updated earlier in the branch with the Workspace as
a consuming surface.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…the tests (Abilityai/trinity-enterprise#403)

The full backend unit run (14,398 passed) surfaced exactly one failure, and it
was a real signal rather than a stale guard: `test_2163_roster_latency_floor.py`
pins that `get_roster` contains NO fan-out at all, because the defect #2163
closed was a `gather` over N agents that made every sign-in wait for the slowest
one.

Two fixed O(1) Docker reads are not that defect. But that guard is blanket on
purpose — it says so: "a source pin, because the behavioural test above can be
satisfied by a stub-shaped accident" — and widening it to admit my own change is
how the property it protects stops being true. So the `asyncio.gather` goes and
the two reads serialize. The trade is one extra `/containers/json` (~50-200ms,
O(1) in fleet size) once per roster load, in exchange for a capability gate that
does not offer a Claude-model list to a Codex agent. Both docs say so.

Also the /update-tests tail step: the test-runner catalog gains the Test
Categories row, a dated Recent Test Additions block, and the corrected totals
(~2,487 across 135 files; unit ~386). The block carries the note about
`_fake_core_db` loading `services.settings_service` before it swaps
`database.db`, since conftest's #762 restore skips a key with no baseline.

tests/unit/test_2163 + test_2196 + test_ent403: 115 passed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
… renders

`get_agent_card` resolves `model_default` — and one Docker inspect for the
runtime it needs — on a page that has no composer and never reads the field.
That is deliberate: #2160's own note on this function is that "the page and the
sidebar could not disagree about an agent's capabilities", so two
representations of one card answering differently is the defect, not the cost.
Negligible beside this function's existing availability read and its bounded
briefing HTTP.

(The verification handoff lives at `.plan/issue-ent403-verification.md`, which
is git-ignored by design — local-only, like the rest of the dossier.)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gg6jvTJdaJ4Y4E63D5sZ3z
…22 bounds what it echoes (Abilityai/trinity-enterprise#403)

AC 7 was unmet on the commonest turn there is. `resolve_turn_model` stopped at
`None` for "no explicit pick, no #894 override" — the default state of every
agent — and that None is what got stamped. `execute_task` does resolve the
platform default at :1044, but its paired `model_used=model` write sits inside
`if not execution_id:`, and both portal paths pre-create the row. So the
resolution happened and the stamp never did: the row recorded NULL while the
turn ran on the platform default, blanking exactly the execution-page display
AC 7 pairs with.

The test that pinned this argued a concrete id would "record a value this layer
did not decide". It reads `settings_service.get_platform_default_model()` — the
same function `execute_task` calls — so it is that layer's decision either way;
what NULL actually bought was a blank audit row. The rung makes the row and the
turn hold one opinion and `execute_task`'s lookup a no-op. `None` still reaches
the row when the platform default itself is unreadable: worse than a stamped
row, better than a refused turn.

Second: the 422 reflects the rejected model verbatim, and
`PortalChatRequest.model` carries no `max_length` while every sibling field does
(`message` is 8000). An authenticated caller could post a megabyte-long `model`
and have it echoed into the error body. Truncated at 64 before interpolation;
payload-layer validation stays deliberately absent, since a length rule there
would refuse before the 403 that says this principal has no control at all.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…bilityai/trinity-enterprise#403)

`clearModelChoiceOnFailure` was called from `rememberVerdict`, which also runs on
LOAD and on reattach — off the durable Redis verdict, which lives 15 minutes
(`TURN_OUTCOME_TTL_SECONDS`) and is cleared only at the next dispatch or on a
success. So the clear re-fired on every reload inside that window: a user who
re-picked a model after an `invalid_model` failure had the fresh choice wiped
again on the next refresh, and written through to the server for every device.

The reload arm was buying little. The loop it guarded against — the same model
refused forever — requires a re-send to recur at all, and a re-send settles
through `settleDelivery`, where the clear is kept. The spec's assertion is
inverted rather than deleted, so the absence is pinned as a decision.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…bilityai/trinity-enterprise#403)

`agent_container_runtimes` is the seam ent#403 added, and nothing covered it.
Every way it can fail is silent: it returns None, `_runtime_map` and the roster
both fail open by design, and the Claude control reappears on every Codex agent
while the suite stays green. Its own docstring names the trap and no test held
it — under `sparse=True` docker-py's `.labels` RAISES (it reads
`attrs["Config"]["Labels"]`, which only a full inspect populates), so a rewrite
to `.labels` would be swallowed by the leaf's `except` and answer None forever.

Seven cases, the leaf's twin of test_2196's own sparse guard: a REAL docker-py
Container seeded with a real /containers/json summary (a hand-built object with
a `.labels` attribute is the shape sparse does NOT produce), the name-keying
rule against a renamed container's stale `trinity.agent-name` label, tri-state
{} vs None, a label-less legacy container reading claude-code, `_runtime_map`'s
narrow/validate/never-raise guards, zero rows costing zero Docker calls, and the
fail-open living at the call site.

Proved as a guard, not just as a pass: reverting `attrs["Labels"]` to `.labels`
turns 3 of the 7 red.

Also corrects `_runtime_map`'s docstring, which still claimed the read is
"gathered concurrently with the availability one" — it was made sequential when
#2163's blanket no-fan-out guard was upheld rather than widened.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ads it (Abilityai/trinity-enterprise#403)

/verify-local's full unit suite went red on
`test_an_unreadable_platform_default_degrades_to_none_never_a_failed_turn`,
which is green in isolation and had only ever been run in a slice. Not a flake
and not the suite's fault: the ladder's last rung is `from services import
settings_service`, which walks the PACKAGE ATTRIBUTE, while this file's header
rule — correct for every other seam here — patches `sys.modules`. The two are
normally one object, so the patch usually works by luck. A sibling unit file
that leaves a stub in `sys.modules` splits them, and the patch then lands on the
object the product code never reads: the ladder returned the REAL platform
default, and the test that exists to prove the degrade path was asserting
against a value it did not control.

`_settings_modules` now patches every object the name can resolve to, and the
test proves the stub is reached before asserting what it degrades to (the
`test_the_seam_is_stubbed_not_ambient` discipline #2196 established).

The same run exposed why it survived: the pinned platform default WAS
`claude-sonnet-4-6`, the catalog's real recommended value, so four assertions
passed whether or not the patch landed. Pinned to `claude-opus-4-6` instead —
not the ambient value, and deliberately not workspace-selectable, which is the
last rung's point.

Proved both directions against a plugin that installs exactly that identity
divergence: the pre-fix file fails on that one node-id, the fixed file is 45/45.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…lityai/trinity-enterprise#403)

/validate-pr's feature-flow format gate failed on 8 of its 10 required sections.
Four were genuinely missing and four were present under names of their own.

Added, because they were absent and are worth having: **Entry Points** (the flow
has four doors — the composer, the roster read, the two turn routes, and the
preference write — and they were never named in one place), **Side Effects** (the
write-once row stamp, the preference write, the self-heal's deliberately narrow
trigger, the idempotency scope, and the second Docker read), and **Related
Flows** (#894 upstream, the roster it hangs off, the Workspace siblings that
share this composer and fix the merge order).

Renamed onto the template's names without touching content: `Security` →
`Security Considerations`; `Degradation …` → `Error Handling — degradation …`.
The `Files` wrapper added nothing over its two per-layer tables, so those are
promoted to `Backend Layer` / `Frontend Layer` — the layer inventories the
template asks for, rather than two invented sections.

Also brings Testing up to date: the seven cases for the runtime read added since
the flow was written, and a **⚠️ status** recording exactly how far verification
went — the live sibling stack proved all three ladder rungs stamping real rows
(including the #894 rung reaching an external portal client) and the 403/422
refusals, while a real turn on a chosen model remains unproven because
`ANTHROPIC_API_KEY` is empty locally.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…bilityai/trinity-enterprise#403)

The branch inserted its requirements section as §5.23 right after §5.22, but
§5.23 was already taken by "Workspace — agents at the centre" (ent#523/#524)
— the 5.2x run continues further down the file, after sections 6 and 9, so
"the next heading after 5.22" is not the next free number. Two sections shared
one id, and `feature-flows/workspace-agents-at-the-centre.md` plus
`requirements/scheduling.md` both already pointed at the other one.

Renumbered to §5.32 (dev's highest is §5.31, the Files tab) and moved to the
end of the 5.x run beside §5.30 and §5.31, which is where the two preceding
Workspace slices appended. The one pointer that meant this section —
`client_portal/service.py`'s note on the deliberate #894 behaviour change —
follows it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ost's scrollbar (Abilityai/trinity-enterprise#403)

The `@smoke ... usable typing space at 375px` case failed in CI on all three
attempts with the field at 128px against a `>= 140` floor, and passed locally
at 143px. The 15px is the scrollbar: macOS overlays it and reserves nothing,
the Linux runner reserves it, so the SAME correct layout measures either
number and a floor between them can only be green on one platform. No change
to this feature can move it — the `<form>` is byte-identical to the one on
`dev`, so 128px is the platform's composer geometry at 375px and not something
this PR introduced.

The claim the fix actually makes is that the picker costs the action row
nothing, so it is now asserted that way, from a single render and relative to
the row:

- the picker ends above where the form begins — it is on its own row;
- the field takes all the slack, `form.width - buttons * (44 + 8)`: for B
  buttons the row spends B boxes and, whatever the nesting, B gaps, since the
  field's wrapper is the one item in those rows that is not a button;
- the 44px touch targets and the no-overflow check are unchanged.

Every term is measured in the same render, so both scrollbar regimes agree.
Verified against a live stack: the three width cases plus the rejection case
pass; moving the `BaseSelect` back inside the `<form>` turns all three red
again, so the guard is the fix's and not ambient. `npm run test:e2e:smoke` —
CI's exact selection — is 77 passed / 7 skipped / 0 failed locally, including
the `agent-detail-request-dedupe` case CI reported flaky.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…host's scrollbar

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@AndriiPasternak31

Copy link
Copy Markdown
Contributor Author

Green — ready for the next train. Head ca0622279: 26 checks pass, 0 failing. e2e is 76 passed / 1 flaky / 7 skipped, and the flake is the same agent-detail-request-dedupe case you identified as merely flaky. The count is the proof that the fix is the delta — the ejected run was 75 passed + 1 failed + 1 flaky, this one is 76 + 1 flaky, same 77 tests.

Both ejection reasons are addressed.

The e2e failure was this PR's own test, and the assertion was wrong rather than the layout. workspace-model-choice.spec.js asserted an absolute textarea.width >= 140. It measured 128 on the runner and 143 during local sign-off — that 15px is the scrollbar, which macOS overlays and the Linux runner reserves, so a floor between the two numbers can only ever be green on one platform. Extracting the <form> subtree from this branch and from dev shows them byte-identical, so 128px at 375px is the platform's composer geometry and not something this PR introduced.

Lowering the floor to 128 would have pinned one platform's scrollbar as the product requirement, so the check now states the claim the fix actually makes, from a single render and relative to the row it is in:

  • the picker ends above where the form begins — it is on its own row;
  • the field takes all the slack, form.width - buttons * (44 + 8) (for B buttons the row spends B boxes and, whatever the nesting, B gaps, since the field's wrapper is the one item in those rows that is not a button).

Both terms come from the same render, so the two scrollbar regimes agree. Proved non-ambient rather than merely green: moving the BaseSelect back inside the <form> turns all three width cases red again.

The conflict: rebased onto 105be062f. Two conflicts, both additive and both resolved by keeping each side — PortalAgentCard carries #2582's owned and this PR's model_default, and learnings.md keeps every entry.

One further defect found while checking the docs, unrelated to the ejection: the branch had added its requirements section as §5.23, which was already ent#523/#524's — core-agent.md's 5.2x run continues past sections 6 and 9, so the heading after §5.22 is not the next free number, and two docs already pointed at the other one. Renumbered §5.32 and moved beside §5.30/§5.31.

Re-verified locally after the rebase: tests/unit 14795 passed / 33 skipped / 0 failed, frontend units 2439, production build, and npm run test:e2e:smoke at 77 passed / 0 failed. The raw-color scan over src/frontend/src is identical to dev file-for-file.

Still REVIEW_REQUIRED — not self-merging.

@vybe vybe added the ui PR touches the frontend UI — triggers Playwright e2e tests label Sep 9, 2026
# Conflicts:
#	docs/memory/feature-flows.md
#	docs/memory/learnings.md
@vybe

vybe commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-09-09): pushed a merge of origin/dev resolving the append collision on docs/memory/feature-flows.md docs/memory/learnings.md left by the previous train member landing (keep-both, dev's entry first). No code changed.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: batch validated on train/20260909-0822 (#2639) — full suite green on the combined batch.

@vybe
vybe merged commit 3a048cc into dev Sep 9, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants