Repository navigation
Conversation
…hape fix(ui): the SSH toggle read the ops payload one level too shallow, so it inverted the operator's intent (#2411)
…mbership fix(operator-queue): an approval's decision must be one the agent offered (#2376)
fix(ui): emotion avatars were cache-busted by a constant, so a regenerated avatar kept its old face for 24h (#2374)
…#2424) The sidebar advertised "2 asks are waiting on your answer" and then stranded you: the agent that raised them carried no badge, its tooltip did not mention them, and it could be collapsed out of the roster entirely. The only way to locate a blocked agent was to open agents one at a time. Observed on a 12-agent roster with two asks on ws-sage (11th of 12), so on a fresh load the one row that mattered was behind the "show more" toggle. Three failures, fixed together because separately each is a half-measure — a badge with no destination, or a destination nobody can see. 1. The unit. `askCount` is `openAsks.length`, and the tooltip said "agents": two asks on ONE agent rendered as "2 agents are waiting on your answer". The number was right, the noun was wrong, and they only diverge when a single agent raises more than one ask — which is why it went unnoticed. Resolved toward ASKS rather than agents, because the row badges added here now answer "which agent", leaving the header to answer "how many decisions". 2. The row. `PortalSidebar.vue:139` renders a per-agent badge from `unreadByAgent` — unread REPLIES. Keeping asks out of that count is deliberate and documented at line 9 ("one is waiting on you to decide, the other on you to read"), and is preserved: the ask gets the *own badge* that comment promised, in `status-urgent` — the token the operator NavBar's pending-operator-queue badge already uses, so the two surfaces agree — and visually distinct from the indigo unread pill beside it. `agentRowTitle` had the same hole, so this is an accessibility fix too: a blocked agent's accessible name was the bare "Open ws-sage". 3. The collapse. #2159 capped the roster at five for a good reason (a long fleet pushed chats below the fold), but the slice is plain roster order with no ask weighting. Ask-bearing agents are now never hidden — appended, NOT floated to the top, because re-sorting on a transient count moves rows under the cursor between refreshes, the same reason the roster is not re-sorted by availability. Not a regression: every piece shipped in its intended form; the gap was between them. Everything decidable moved into `portalUtils` (`asksByAgent`, `askBadgeTitle`, `agentRowTitle`, `visibleAgentRows`, `AGENT_COLLAPSE_LIMIT`) because vitest runs `environment: 'node'` with no mount harness — a rule inside the SFC is one no test can reach, which is how all three of these shipped. Mutation-checked: reverting the noun, dropping asks from the title, and restoring the plain slice each turn the suite red. `bg-amber-500` -> `bg-status-urgent-500` is required, not drive-by: new code must be at zero raw palette classes, so the new badge needed a token, and the header had to match it or the two ask indicators would differ. Amber maps to `state-autonomous` (an operating mode), which is the wrong claim. PortalSidebar is now at zero non-gray raw classes. Two pre-existing guards asserted the moved expressions as source strings and are rewritten to assert the properties behaviourally — strictly stronger, since they now fail on a broken bound or a dropped chip title, not only on a reworded one: - portalRosterRow #2159 "shows a fixed number by default" - portalAvailabilityChip #2196 "row title carries the state" Verification: 1518/1518 frontend unit tests, raw-color ratchet exit 0, production build clean. Closes #2424 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…port-back could not fire (#2426) ent#457 gave the Workspace a report-back: an agent that delegates during a chat turn gets the completion posted into that thread. It could not fire on the SYNCHRONOUS path, because the parent execution never received the session binding the report needs. `report_completion` gates on `if not source_channel_chat_id`, and there the field was NULL. Measured on a dev instance — 5 of 8 portal rows NULL, split exactly by path: 07:55 -> 09:04 chat=7d27744d... browser, streaming path 09:06 -> 09:09 chat=NULL POST .../chat, synchronous path TWO CORRECT CHANGES THAT COLLIDE. ent#457 passes the binding down, and `execute_task` persists it — but only inside `if not execution_id:`. ent#365's `_precreate_sync_execution` has already created the row and handed the id over, so that branch never runs, and the pre-create stamped only `source_channel`. Its own docstring named the invariant it broke: "Mirrors `start_portal_turn`'s creation exactly ... so the two paths produce indistinguishable rows and a report published from either can be joined back to its chat." The sibling comment in `start_portal_turn` says "both creation sites or the stamp is a coin flip depending on which path made the row" — ent#457 covered the two sites that existed when it was written; ent#365 had added a third. Fix: stamp `source_channel_chat_id` + `source_channel_client` in the pre-create. `session_id` is a REQUIRED parameter, not an optional one — the value is in scope at the only call site, and a default would let a future caller silently reintroduce the inert row. Rejected: teaching `execute_task` to UPDATE an adopted row, which widens a hot path used by every trigger to repair one caller's omission. ALSO REPAIRS TWO GUARDS THAT WERE RED ON `dev`. `backend-unit-test` is failing on dev right now; both failures are in this feature area and both are guards that had gone inert, so they are fixed here rather than left for the next PR to trip over. Frontend-only PRs pass because the `changes` job path-filters the backend suite away, which is why this went unnoticed. * `test_both_portal_row_creation_sites_name_the_chat` asserted a literal census of `== 2` sites. It went red the moment the third site appeared — the guard WORKING — and the bug it names shipped anyway. Now asserts the rule instead of the count: every site that stamps the surface must also stamp the destination. Census-proof. * `test_portal_turn_kwargs_bind_against_execute_task` parsed `portal_chat` for a literal `run_resumable_turn(...)` call. That call had moved into `_run_sync_turn_and_clear_marker`, where it is `run_resumable_turn(**kwargs)` — a splat, which names nothing — so the walk found no keywords and the guard asserted itself dead. Now reads the keywords where they are actually named (the wrapper's call site), scanning both entry names and subtracting the wrapper's own consumed parameters. Neither rewrite loses coverage; both now fail for the reason their docstring gives rather than because a number or a call site moved. WHY THE BUG SURVIVED ITS TESTS. ent#457's mock the engine and assert the kwargs are passed (they are). ent#365's assert no orphan `running` row (still true). Nothing asserted the PERSISTED ROW, which is the only place the two meet — the same lesson `test_ent457_portal_turn_kwargs.py` states about itself. The new suite asserts at that layer, and adds a derived parity check so a fourth channel field added to one writer and forgotten in another fails here instead of shipping as another silently-inert report path. Verification: 402 passed on the portal/ent457/ent365 selection (was 2 failed before this branch). Mutation-checked: removing the stamp turns 4 red; feeding `execute_task` an unknown kwarg turns the repaired binding guard red. Closes #2426 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…erability fix(workspace): the ask badge said 2 and gave you no way to find them (#2424)
…, never by load alone (#2409) (#2422) ## Summary - `select_best_alternative_subscription` returned the **first** survivor of the 2h failure filter in `agent_count ASC` order and read no headroom — SUB-003 could move an agent onto a subscription at 99% of its weekly window, and an *unused dead-token* subscription (no agents ⇒ no failure rows) sorted **first**. - Now: **filter in the db, rank in the service, never a probe.** The db lists survivors (kind-blind 2h filter unchanged and first, #444/#2352, `agent_count ASC, name ASC`); the service ranks them over the cached provider snapshot (one `MGET`) furthest-from-the-nearest-wall first (the fuller of the 5h/7d windows — the #792 retry lands on the destination immediately), in 10-point bands so load still spreads a storm; a **fresh** provider refusal is dropped; anything unusable sorts in today's order; any failure of the ranking half falls back to today's pick **with a warning**. - `classify_headroom` (ent#434) and the ranker share one usability gate (`headroom_reading`) — verdicts byte-identical, pinned by a differential test against a frozen copy. New-agent auto-assign (#74) rides the same ranker. The switch now records **why** (`destination_headroom` + one notification clause). - Approved deviations from the literal AC, recorded on the issue: nearest-wall key instead of 7d-only; fresh refusals filtered instead of ranked last. ## Changes - `src/backend/services/subscription_headroom_service.py` — gate, MGET reader, threshold-free ranker, `MAX_READING_AGE_SECONDS` (owned here now); `classify_headroom` becomes policy over the gate - `src/backend/services/subscription_auto_switch.py` — service-layer selector (`asyncio.to_thread` under the agent lock), `destination_headroom` on activity / notification / result - `src/backend/services/subscription_service.py` — `select_subscription_for_new_agent` - `src/backend/db/subscriptions.py` + `database.py` — `list_viable_alternative_subscriptions` / `list_assignable_subscriptions` (filter only); first-match selectors retired - `src/backend/services/agent_service/crud.py` — call site; `subscription_headroom_alerts.py` — constant re-export + docstring - Tests: new `tests/unit/test_2409_headroom_ranked_switch.py`; pingpong / 2352 / concurrency / 1484 / 1759 adapted to the list form (assertions kept) - Docs: `architecture.md`, `subscription-auto-switch.md` (+ management, usage-tracking), requirements §20.4, `learnings.md` (2 entries), CSO diff report ## Test Plan - [x] New suite: `pytest tests/unit/test_2409_headroom_ranked_switch.py` — 83 passed; **80/81 fail on the unmodified source** - [x] Full `tests/unit`: 12,718 passed / 30 skipped / 1 pre-existing failure (`test_1920`, private submodule, untouched) - [x] API integration (`test_subscription_auto_switch`, `test_subscriptions`, `test_subscription_usage`): 36 passed - [x] Live: a real switch chose the 18%/9% subscription over the 0-agent 88%/60% one; every-survivor-refused → no switch + WARNING; no snapshot → today's order - [x] `/review` clean (informational findings fixed in-review); `/cso --diff` no findings - Follow-ups filed while testing: #2419 (parser overage), #2420 (destructive integration suite), #2421 (subscription audit gap) Fixes #2409 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ent#430) Slice 5 of ent#364, and the gate: until now the client route recorded an answer and returned. The operator route called `spawn_resume_dispatch`; this one did not. So an ask addressed to a Workspace client — the entire point of ent#364/#428/#429 — was recorded, reached the agent's queue file in about three seconds, and re-triggered nothing. Measured on a live instance before this change: answered from the Workspace, `operator-queue.json` flipped to `responded` with the answer in under 3s, and no execution followed. Unblocked because ent#329 is in dev. WHAT THIS ADDS: one call. ent#430's body rules out the alternative — "a second dispatch surface for the same event is how the cost, trigger-label and loop-prevention questions get answered twice, differently" — so the per-agent opt-in, the idempotency key, the audit row and the failure handling all stay inside `maybe_dispatch_resume`. AC #2 and AC #3 are satisfied by REUSE rather than by re-implementation, and the tests assert the CALL for that reason. Four properties, each load-bearing: * Hung off the CAS WIN only, like the operator route. The 409 above already returned for a lost race, so reaching the dispatch means this answer is the one that landed — two people answering at once produce one resume. * `updated`, never `item`. The pre-answer read still says `pending`; a resume handed that row acts on an ask that does not yet carry its answer. Looks identical in a green test, which is why there is one for it. * The spawn is wrapped. It is fire-and-forget, but a raise ON THE CALLING LINE would still propagate, and a 500 after the CAS landed would tell the client their answer failed while it is committed and already on its way to the agent. The answer is the thing that must not be lost. * #2376's choice validator runs first, so an answer that was never offered cannot spend. AC #5 — `resume_requested` on the answer response, read from the SAME accessor the dispatch gates on, so the two cannot disagree about what is about to happen. It reports INTENT, not success: the dispatch is backgrounded, so at that moment the only honest claim is whether it will be attempted. Fails CLOSED — an unreadable flag claims nothing, because over-claiming is exactly the failure AC #5 names ("the ask does not read as resolved while nothing happened"). RESIDUAL, stated rather than implied: a dispatch that fails AFTER this point surfaces as a FAILED execution row plus an `operator_resume_dispatch` audit entry (ent#329) — operator-visible, and a client cannot see either. The client half of AC #5 is satisfied negatively for now: the ask surface says nothing about work starting, so it cannot mis-claim. `resume_requested` is the field a surface needs to say something true; consuming it is an ent#429 UI change and is deliberately not in this PR. The per-agent flag DEFAULT IS UNCHANGED (`operator_resume_enabled`, OFF, owner-only). "Turn the flag on" is an operator action per agent, not a code default: flipping it would hand every shared agent's client a spend button, which is the one thing AC #3 rules out. Verification: 145 passed across the asks/ent#329/ent#364/#428/#429/#2376 selection. Mutation-checked — removing the dispatch (4 red), passing the pre-answer row (1 red), and making the opt-in read fail open (1 red). Closes ent#430 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…d slice)
Reported: pressing New chat in the Workspace drops you back into the existing
conversation with that agent. Decided at the 2026-08-21 weekly.
ONE VALUE CARRYING TWO MEANINGS. An absent `session_id` meant both "I don't know
which thread" and "I want a fresh one", and the platform resolved it as the
first, in both readers:
_resolve_session_id(..., None) -> resume the client's latest
get_history(..., None) -> return the most-recent thread
Both readings are RIGHT for the case they were written for — a deep link, a
refresh, an API caller that never held a session id — so neither could be
inverted. The intent had to become sayable: `new_thread` on the request,
`newChat` on the component, checked before the resume.
The frontend tell was an asymmetry: New chat with the agent you were ALREADY on
started fresh, while New chat with a different agent resumed. The watcher read a
changed agent as "load that agent's history" and called `fetchHistory(name,
null)`, discarding the `pendingSession = null` that `newChatWithAgent` had just
set to mean the opposite.
MOST OF ent#451 TURNED OUT TO BE BUILT. Recorded because the issue is
complexity-high and this PR is not:
* the data model already allows many sessions per (agent, client) — no UNIQUE
constraint, a `title` column, an index on
`(agent_name, client_email, last_message_at)`, and auto-titling. AC #4's
"migrates cleanly" is nothing to migrate.
* AC #2's list is the existing sidebar: titles, recency, starred lifted out,
search, per-agent avatars.
* AC #3's landing rule is already decided and documented in
`ensure_thread_for_ask` — reuse the latest thread so asks do not accumulate
beside the conversation. UNCHANGED here, and pinned by a test so this cannot
move it silently. It matters MORE once several chats exist, not less.
So what was missing is AC #1, and it is two bits rather than a data model.
Four properties:
* An explicit `session_id` WINS over the flag. A caller sending both contradicts
itself; the id is a fact, the flag an intent, and abandoning a named thread
would strand a turn meant for a conversation the caller could see.
* The ownership check runs first either way — the flag is never a route past it.
* BOTH turn entry points carry it. The Workspace uses the streaming path and
falls back to the synchronous one, so a flag honoured by only one brings the
bug back exactly when streaming fails.
* The intent is spent on adoption. The send guard already ANDs on "no session
yet", so a second turn was never going to open a third thread; clearing it in
`onSessionAdopted` keeps the two bits from disagreeing after a navigation.
Test doubles updated, not worked around: seven `_resolve_session_id` lambdas and
four `_fake_chat` stubs did not accept the new keyword. They take `**kw` now — a
stub that must be edited for every new parameter is a second signature — and one
hand-rolled `_Body` model double gained the field. All are stale stubs rather
than behaviour changes.
Verification: 392 passed across the portal/ent#286/#287/#358/#429/#430/#451
selection; 1497 frontend unit tests. Mutation-checked: making the flag inert, and
letting it override an explicit session id, each turn the suite red. The full
backend suite exceeds a local foreground run and is left to CI.
Pre-existing and NOT from this branch: `test_ent457_portal_turn_kwargs` and
`test_both_portal_row_creation_sites_name_the_chat` fail on `dev` today; both are
fixed in #2427.
Related to ent#451
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…binding fix(workspace): the sync portal turn never carried its session, so report-back could not fire (#2426)
…ee latent desyncs (ent#451) Blocker 1 was real and I had not seen it. `resolveAgentQuery` passed `forceNew` to `resolveAgentLanding` and set `pendingSession = null`, but never raised `startingNewChat` — so `/workspace?agent=X&new=1` rendered an empty conversation and then sent `new_thread: false`, resuming the thread the user asked to leave. The reported bug, intact on the documented `?new=1` contract, in the PR that exists to fix it. The cause is the one this PR is about, one level up: `route.query.new` was read in two places for two different decisions — WHICH THREAD to land on and WHAT THE FIRST SEND ASKS FOR — and only the first honoured it. Now read ONCE into a local that feeds both, so they cannot drift again. AND-ed with the landing result, so a `?new=1` that still resolved a thread never claims a fresh start. Blocker 2: a frontend test, which the change genuinely had none of — the `1497 passed` in the body was the pre-existing suite, as the review says. `workspaceNewChat.spec.js` (9 tests) covers the deep link, the watcher branch ORDER, the first-paint guard, both send conjunctions, and the settle-everywhere rule, using the two established patterns (pure function + source assertion in the `portalLeaveSpecificRoute.spec.js` shape) since vitest runs `environment: 'node'` with no mount harness. Mutation-checked, and M1 is the reviewer's own blocker: reverting it turns the suite red. Blocker 3: `test_history_without_a_session_is_unchanged` cited "the spec in tests/unit/... frontend suite" — a dangling reference asserting coverage that did not exist. It now names the real file. Comments addressed: * Three more sites nulled `pendingSession` without settling the intent — the deep-link watcher (the commonest way in), `openRoom`, `openAgentPage`, plus the unreachable-agent branch. Latent because both consumers AND on "no session yet", but a flag that is only correct because of a second variable is one refactor from being wrong, and the declaration claims it is cleared the moment a real thread exists. Now true. * `test_both_turn_entry_points_forward_it` was `getsource` + a substring, so a comment or a misspelled kwarg satisfied it. It now BINDS the keyword against each service signature and asserts the routes forward `body.new_thread` through a comment-stripped source — verified by mutation. * `workspace-absorbs-session.md` updated at both seams the change touches (`resolveAgentLanding`'s landing rule and `_resolve_session_id`'s three states), and `architecture.md`'s Workspace section documents the new public `new_thread` field on the ent#83 headless surface. * Gating stated rather than inferred: "OSS-core by decision (ent#451)", matching the ent#326/#384/#392 convention. ONE CORRECTION, offered with evidence rather than silently applied. The review says "`test_ent457_portal_turn_kwargs.py` doesn't exist on `dev`, #2427 introduces it". It does exist on `dev` — added by d6a4bc1 (ent#457) — and #2427 modifies it. `git cat-file -e origin/dev:tests/unit/test_ent457_portal_turn_kwargs.py` succeeds, and `backend-unit-test` is failing on `dev` independently of any PR. So the body's "fails on dev today" stands. Everything else in the review is accepted as written. Verification: frontend 1497 -> 1506 (+9). Backend 392 passed on the portal selection, the same 2 pre-existing dev failures unchanged. Related to ent#451 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ed by its own stub (ent#329)
Found by testing this PR's feature against a live local instance. ent#430 wires
a Workspace answer to `spawn_resume_dispatch`, so this PR is dead on arrival
without it — the client path would have hit the same wall the operator path has
been hitting since ent#329 merged.
THE BUG. `operator_resume_service.maybe_dispatch_resume` did:
from services.task_execution_service import task_execution_service
That name has never existed on that module; it exports
`get_task_execution_service()`. The import sits on the FIRST line of the
function, above the try, so every dispatch raised ImportError before it even
read the opt-in.
WHY NOBODY NOTICED, twice over:
* the call is fire-and-forget, so the traceback surfaces only as asyncio's
"Task exception was never retrieved" — nothing fails, nothing 500s, the
answer is recorded and the config audit row is written. It looks like it
worked.
* the ent#329 unit test stubbed `services.task_execution_service` with
`SimpleNamespace(task_execution_service=recorder)` — MANUFACTURING the very
symbol whose absence was the bug. 21 tests green, feature dead.
MEASURED on a live instance, opt-in ON:
before: answer 200, audit row written, executions 0->0, log carries
"cannot import name 'task_execution_service'"
after : answer 200, executions 0->1, triggered_by=operator_response,
audit `operator_resume_dispatch` with the execution id, 0 ImportErrors
(The dispatched run then failed on a missing AGENT_AUTH_SECRET — a limitation of
the test box, and correctly recorded as an honest FAILED row, which is ent#329's
"never silent" requirement doing its job.)
THE GUARD is the durable part, because the stub is the real lesson: a stub that
invents an API the real module lacks converts a production crash into a green
suite. `test_the_names_this_service_imports_actually_exist_on_the_real_modules`
parses the REAL module source with `ast` — never the stubbed `sys.modules`
entry, which is what made this invisible — and asserts every
`from services.X import Y` resolves. Mutation-checked: reverting the import
turns 11 tests red.
Related to ent#430, ent#329
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…-new-chat feat(workspace): New chat means a new chat (ent#451 — the fresh-thread slice)
…ag over-claimed (ent#430) All three blockers from the review, each verified rather than argued. 1. THE FEATURE WAS INERT. `client_portal/asks/router.py` declares `answer_ask` as a plain `def`, so FastAPI runs it through `run_in_threadpool` — a worker thread with no event loop — and `asyncio.create_task` raises `RuntimeError: no running event loop` there. The `except` swallowed it, so every client answer recorded the answer and dispatched nothing: byte-for-byte the behaviour this PR exists to remove. Fixed in `spawn_resume_dispatch` rather than by flipping the route to `async def`, for the two reasons the review names: the route does blocking DB I/O, so `async def` alone would move it onto the loop; and ent#430's stated shape is ONE dispatch site, which moving the spawn back out to the caller would undo. It now detects the absence of a loop and hops back via `anyio.from_thread.run_sync` — Starlette's threadpool is anyio's, so the portal is always there on this path. Any future sync caller inherits the fix. A thread anyio does not own reaches neither branch. That is not a production shape, but it must not become the silent no-op this change removes, so it raises with the cause named instead. 2. THE RACE LOSER SPENT MONEY. `respond_to_operator_queue_item` returns None only when the row is GONE; when the row exists and has left `pending` — the race that actually happens — it returns a TRUTHY dict carrying `_status_conflict`, having written nothing. `if not updated` fell straight through it. The loser then dispatched a paid execution for an answer not in the database, and because the idempotency key hashes the response text, the loser's differing text yields a different digest: one queue item, two paid dispatches. `routers/operator_queue.py` already pops that flag before its own spawn; this is that rule, not a new one. Popped, not read, so the sentinel cannot serialize to the client. 3. `resume_requested` OVER-CLAIMED. It was computed after the swallowed spawn from the opt-in flag alone, so a spawn that raised still answered `true` — the exact failure AC #5 names, and given (1) that was EVERY production answer on an opted-in agent. It now reports what was actually scheduled. TESTS — the reason all three survived 24 green checks is that every existing test replaced `spawn_resume_dispatch` with a synchronous lambda, stubbing out the one call whose runtime context was the defect. `test_ent430_dispatch_actually_runs.py` drives the REAL spawn from a REAL anyio worker thread (the production context, not an approximation) and asserts the premise before the behaviour. The lost-race test uses the truthy `_status_conflict` shape that actually occurs, not the `None` shape that does not. Mutation-checked: reverting fix 1 turns 1 red, fix 2 turns 3 red, fix 3 turns 2 red. Writing those tests also caught a stubbing bug of my own, worth recording because it is the trap that hid the original: patching only `sys.modules` leaves `from services import operator_resume_service` resolving the PACKAGE ATTRIBUTE, so the real function ran anyway. Both paths are patched now. Related to ent#430 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…e caller (ent#430) Non-blocking findings from review pass 2. The three blockers landed in d11956a. STATUS. `_project` mapped every row to pending/expired, so the response to a just-recorded answer read `status: "pending"` beside `resume_requested: true` — one row reporting both that nobody has answered it and that answering it started work. Harmless while the second field did not exist; contradictory once it did. `_status_of` adds `answered` (`responded`/`acknowledged`), reachable only from the answer response since the listing carries neither. Answered is checked BEFORE expiry — an answer that landed is a fact, and an `expires_at` that has since passed does not un-answer it; the obvious refactor is to test expiry first, which would make a slow client's own answer vanish, so the ordering is pinned. The existing test asserted `out.status in ("pending", "expired")` with the comment 'the point is it returned at all' — it was papering over exactly this. It now asserts `answered` and, on the spawn-failure path it covers, that `resume_requested` is False. THE TWO READS. `_resume_requested`'s docstring claimed it read 'the SAME accessor … so the two cannot disagree'. True of the accessor, false of the instant: it is a second read a task hop earlier, and an owner disabling the opt-in in between gets `true` and no resume. Collapsing them is not the fix — they answer different questions (one must produce a value for THIS response, the other is the authority at the moment it would spend), so the window is stated, with AC #5's own remedy named, rather than described away. DOCS. architecture.md's ent#329 section described a single caller and stated the CAS-win property the second caller broke. It now carries the second caller, the truthy-`_status_conflict` shape that defeated `if not updated`, the sync-endpoint/no-loop defect and its `anyio.from_thread.run_sync` fix, and what `resume_requested` actually reports. Related to Abilityai/trinity-enterprise#430 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…2f2c) (#2440) dev's pointer was OLDER than main's — an inversion, not just staleness. The next dev -> main release merge would have carried it backwards and undone ent#443's enterprise-side removal: OSS main -> 2a5def3 (ent#443: shared_sessions removed from enterprise) OSS dev -> a419812 (4 behind enterprise main, 2026-08-19) ENT main -> 90f2f2c 90f2f2c is a fast-forward from BOTH (a419812...main = ahead 0 / behind 4; 2a5def3...main = ahead 3 / behind 0), so nothing is being rewound. WHAT THE FOUR COMMITS ARE 2a5def3 refactor(rooms): remove shared_sessions — it now lives in OSS core (ent#443) ff0a4f1 fix(security): guard the enterprise system_settings sinks against cleartext credentials (ent#435) — the private twin of the OSS sink guard architecture.md already records as "the private submodule owns its twin" 6d82a3f docs(workspace): agent-initiated asks — design of record 90f2f2c feat(credential-vault): governed system credential vault module (ent#279) WHY IT MATTERS RATHER THAN BEING HOUSEKEEPING. ent#443 moved rooms into OSS core, and dev has that. With the stale pin an entitled dev install mounts the OSS rooms routers AND the enterprise shared_sessions module, and relies on main.py's include-order (OSS before register_enterprise) to decide which one serves. architecture.md documents that ordering as the transition safety net — this bump is the follow-through that ends the transition. VERIFIED BY BOOTING BOTH POINTERS against dev, same box, same DB shape: a419812 (today): 17 modules | shared_sessions registered: True | 6 room paths | 0 errors 90f2f2c (this): 17 modules | shared_sessions registered: False | 6 room paths | 0 errors Both boot clean and log "Trinity Enterprise modules registered" — the line deploy-dev greps. Module count is unchanged because shared_sessions leaves as credential_vault arrives. No duplicate room paths in either, confirming the ordering net held; after the bump there is nothing to net. Gitlink only — no OSS source changes, so public CI (which never checks the submodule out) is unaffected. Related to ent#443, ent#435, ent#279
Co-authored-by: Trinity Agent (trinity) <[email protected]>
Bumps the docker-base-images group with 1 update in the /docker/frontend directory: node. Updates `node` from 24-alpine to 26-alpine --- updated-dependencies: - dependency-name: node dependency-version: 26-alpine dependency-type: direct:production dependency-group: docker-base-images ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…on, MIME, CORP (trinity-enterprise#461) (#2439) * fix(files): shared links were unopenable on mobile — Range, disposition, MIME, CORP (trinity-enterprise#461) The bytes were never wrong. Verified from the Cloudflare edge, the object returned HTTP 200 with correct content-length and correct WAV bytes for every user-agent tried, and the signature check worked. The RESPONSE SHAPE was wrong in four ways at once, and each one alone is enough to break playback in an iOS in-app browser: * no Range support — `Range: bytes=0-1023` returned 200 with the whole 2 MB body and no `accept-ranges`. iOS Safari and Telegram's player require a 206 to start audio at all, so this alone made the file unplayable. * `content-disposition: attachment` — a forced 2 MB download inside Telegram's iOS browser is a blank screen. * `audio/x-wav` under `nosniff` — unregistered type, so a strict player declines it and the browser is forbidden from guessing better. * `cross-origin-resource-policy: same-origin` on a link whose entire purpose is to be opened from another platform. Plus `cache-control: no-store`, which forbids the in-app browser from buffering media it will not play without buffering. THE INLINE CHANGE IS A NARROWING, NOT A REVERSAL. The old code forced `attachment` on everything with the note 'defense against XSS via agent-uploaded HTML', and that reasoning is still correct — this route serves agent-authored bytes from the same origin as public chat. So inline is an ALLOWLIST (`_INLINE_SAFE_TYPES`: audio, video, image, PDF) and `text/html`, `application/xhtml+xml` and `image/svg+xml` stay attachments. SVG is called out because it is the one a reviewer waves through: it is an image by name and a script host in fact. The type is python-magic-detected from the file's own bytes at share time, never agent-supplied, and its unavailable-fallback (`application/octet-stream`) sits outside the allowlist, so the failure direction is `attachment`. `nosniff` is kept and matters more now, not less. TWO THINGS THE ISSUE DID NOT ASK FOR, both found while implementing: * `Content-Length` came from the DB's `size_bytes`, written at share time. Any drift from the file on disk is unrecoverable for the client — too small truncates, too large hangs — and Range math against a wrong total produces a `Content-Range` that contradicts the body. It now comes from `os.path.getsize`, with a WARNING on divergence. * a media player fetches one file as MANY ranged requests. Counting each as a download would turn one play into dozens and write an audit row per chunk, so the counter and the audit fire only on the transfer START (a plain GET, or a range beginning at byte 0). VERIFIED end-to-end against the real route, not just the parsers: full GET : 200 | type audio/wav | disp inline | ranges bytes | corp cross-origin | cc private, max-age=3600 range 0-1023 : 206 | body 1024 | bytes 0-1023/2048000 | bytes ok suffix -500 : 206 | bytes 2047500-2047999/2048000 | bytes ok unsatisfiable : 416 | bytes */2048000 HEAD : 200 | accept-ranges bytes | content-length 2048000 no sig / bad sig / unknown id / expired : 401 / 401 / 404 / 410 html file / svg file : attachment That covers the issue's Definition of Done line by line, including that the signature check still rejects unsigned and expired requests. 46 new unit tests, weighted to the allowlist and to the range parser's silent-corruption case (`bytes=-500` is the LAST 500 bytes; reading it as start=0 serves the wrong bytes under a 206, which no client can detect). Related to trinity-enterprise#461 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(files): the CORP header was inert — the security middleware clobbered it (trinity-enterprise#461) Found by testing the PR against a real local instance rather than a TestClient. `main.add_security_headers` runs after EVERY route and set `Cross-Origin-Resource-Policy` with a plain assignment. So the `cross-origin` policy the file-download route sets — one of the four fixes in this PR, and the one that decides whether Telegram, Slack or WhatsApp can embed or preview the link at all — was silently overwritten back to `same-origin` on its way out. The fix shipped INERT and every test passed, because a bare `FastAPI()` + router harness has no middleware. Measured on the running server: before: cross-origin-resource-policy: same-origin after : cross-origin-resource-policy: cross-origin (file route) cross-origin-resource-policy: same-origin (/health, unchanged) `setdefault` rather than a route allowlist: absence still resolves to the strict default, so every other route keeps today's behaviour and a new route has to opt out deliberately rather than inherit an exception. Pinned by a source assertion — asserting it end-to-end needs a live stack, and what must not regress is the `setdefault`; an edit back to `=` would re-break it invisibly. Related to trinity-enterprise#461 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…#1028) (#2437) * refactor(main): lifespan is an orchestrator, not a 580-line procedure (#1028) `main.py::lifespan` was 580 lines at cyclomatic complexity 109 — the longest function in the backend and the first item the 2026-06-02 refactor audit named. It is now 25 lines at CC 1: a flat list of `await _phase()` calls over twelve startup helpers and four shutdown helpers. WHAT MOVED, AND THE PROOF THAT NOTHING ELSE DID. Every body is verbatim. That is asserted mechanically rather than claimed: extracting all non-blank lines from the sixteen helpers in call order and diffing against the original `lifespan` body gives 518 = 518, identical. The only relocated line is `yield`. No behaviour change, no logic touched, no try/except reshaped — each phase keeps its own guard, because a failing phase must not take the boot down, which is what the original did. WHY THE TEST IS THE POINT. Splitting the function is easy; keeping it split is not, and the thing worth guarding is not the line count — it is THE ORDER. Boot ordering is load-bearing in ways invisible at the call site: a reviewer looking at sixteen await lines cannot see that moving one breaks something, because the coupling lives in the bodies. Before this it was implicit in a function nobody could read in one sitting; after it, it is a list — which is an improvement only if something enforces the list. So `tests/unit/test_1028_lifespan_phases.py` pins the sequence WITH the reason for each constrained pair recorded beside it: logging first so a later hang cannot swallow the boot log (#858); the event bus before any WebSocket client needs a live dispatcher (#306); Docker/system-agent before the fleet sweepers; startup recovery before the channel transports, so inbound traffic cannot create an execution that races the reconcile; the event-bus drain LAST on shutdown so late broadcasts still land. A reorder now fails with the reason attached instead of surfacing weeks later as a boot bug nobody connects to this commit. It also pins the `yield` split (a phase appended after it silently becomes shutdown work), the per-helper thresholds the issue asked for (<100 lines, CC <20), and orphan/double calls. Mutation-checked five ways — recovery moved after the transports, event bus after Docker, a dropped shutdown phase, the drain no longer last, a phase pushed past `yield` — all caught. ONE DEFECT THIS FOUND IN ITSELF, worth recording because it is the failure this refactor's shape invites. The extraction moved `@asynccontextmanager` by one definition: it landed on the first phase helper and `lifespan` was left a bare async generator, which FastAPI cannot use as a lifespan. Boot-breaking — and the entire 12,900-test unit suite stayed green, because nothing in it imports `main` and asks what shape `lifespan` is. It surfaced only from an explicit import check (`iscoroutinefunction` on each helper returned False for one, with `co_filename` pointing into contextlib). Fixed, and pinned by its own test. Docs: the `main.py` row in architecture.md now records that the order is the contract and where the constraints are, so the next person to add a startup step knows it belongs in a phase helper. Scope: one file per the issue's own recommendation. The remaining ACs (`routers/settings.py`, `routers/ops.py`, `services/git_service.py`, `services/agent_client.py`, `routers/public.py::public_chat`) stay open on #1028. Related to #1028 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(review): three phase helpers used locals the split left behind (#1028) /review's scope pass caught a real runtime break in my own extraction, and the interesting part is that three separate verifications had already passed on it. `main.py` never imports `database` at module level. The old `lifespan` did `from database import db as _db` once near the top, and three blocks 100+ lines later used it through the enclosing function scope: the system-agent `setup_completed` gate, the Telegram transport and the WhatsApp transport. `message_router` was the same shape — imported in the Slack block, used by the Telegram one. After the split all four are NameError. The severity is in the swallow. Every one of those use sites sits inside `try/except Exception`, so the boot SUCCEEDS: the log carries "Error starting Telegram transport: name '_db' is not defined" and the Telegram and WhatsApp integrations are simply never wired. A silently dead integration, not a failed boot — and the per-phase guard that makes each phase fail-open is exactly what hides the extraction bug. Why the existing checks missed it, all three: the AST equivalence proof compares LINES and the lines are identical; the structural pin asserts order, thresholds and decorators, not name resolution; and the `import main` smoke never RUNS `lifespan`, so nothing resolves those names at import time. Fixed by re-materialising each import in the helper that needs it — the original's own idiom — with a comment saying why it is there, so a later reader does not "tidy" it back out. CORRECTION TO THE CLAIM: the bodies are no longer byte-identical. They are verbatim EXCEPT these four re-materialised imports, which is now what the PR body and the docstrings say. A verbatim claim stops being true the moment a leaked name has to be restored, and quietly keeping the claim is worse than the bug. Also pinned, because this gets more likely with every future split of the same function: test_no_phase_helper_depends_on_another_phases_locals asserts, per helper, that `names_loaded - names_bound - module_globals` is empty. Mutation- checked by deleting the restored `_db` import — reproduces the shipped bug and turns the suite red. Also: the phase-count docstrings said "of 10" in 9 helpers; the transports were split into three after that text was written, so it is 12. learnings.md gains the class: extract-method has a failure mode the diff cannot show and an import smoke cannot reach. Related to #1028 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(review): the verbatim claim survived in three docstrings (#1028) Re-review finding. The previous commit corrected "bodies are byte-identical" in the PR body but left the same claim standing in the code, where it is more likely to be believed: the three helpers that gained a re-materialised import still said "the body below is unchanged". A stale claim next to the exact line that falsifies it is worse than no claim — it is the thing a future reader checks against before deciding the import looks redundant. Now each says verbatim EXCEPT the restored import, and points at the comment explaining why it is there. Related to #1028 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(tests): two pre-existing lifespan guards read a function the split emptied (#1028) CI's regression diff caught 4 new failures, deterministic across all three seeds. Both guards assert properties of `lifespan`'s SOURCE, and #1028 moved that source into phase helpers — so they were asserting things about a function that is now 25 lines of `await` calls. The properties still hold. The guards had stopped being able to see them, which is the worse failure: a guard that silently stops covering its subject reads identically to one that passes. test_1267_lifespan_db_alias — and this one is pointed: #1267 IS the bug class /review caught in this branch. It fired when the transport blocks called a bare `db` while only `_db` was in scope, NameError swallowed by the surrounding try/except and surfaced as a misleading "Error starting Telegram transport". The split re-introduced the same class in a new form (`_db` bound in phase 1, read in three later helpers), and this guard could not see it because it only ever looked inside `lifespan`. So it now follows the calls: `_lifespan_surface()` returns `lifespan` plus the helpers it awaits, and every check scans all of them. The alias check is STRENGTHENED rather than merely relocated — binding `_db` somewhere on the surface is no longer sufficient, because after the split each helper is its own scope, so every function that READS `_db` must bind it. That assertion fails on the exact defect this branch shipped. test_858_dockerfile_unbuffered — the #858 invariant is an ORDERING one (setup_logging -> first-run notice -> event_bus.start), and after the split those three sit in three different functions. `_lifespan_body()` now flattens the phases inline in call order, so the existing index comparisons keep meaning what they meant. An unresolvable helper is left as the bare `await` rather than skipped, so a phase this cannot expand can never silently drop the statements it contains. No production code changed. Related to #1028 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
… fresh ones (#2085) (#2432) #1645 closed #1638 by reverting OPS_SETTINGS_DEFAULTS to the wide historical values and applying the #1039 community floor through explicit system_settings rows seeded on FRESH installs only. Every install that has ever upgraded rather than been created fresh therefore had no rows at all, so cleanup_service resolved all 11 windows at prune time from a dict that ships inside the backend image and is replaced on every rebuild. The only thing between a future edit to that dict and the #1638 failure mode — a silent hard-DELETE of existing data seconds after the next boot, green /health, no error — was a code comment. database._seed_retention_windows{,_engine} now writes an explicit row for every RETENTION_OPS_KEYS member that has none, at the value already in force, on every boot and regardless of install age. Behaviourally inert: it writes the number the prune already used, so nothing prunes differently the day it runs. Three properties are load-bearing: * The key set is DERIVED from RETENTION_OPS_KEYS, never a second hand-written list, so a window added later is covered the day it ships instead of quietly inheriting the image default forever (the issue text said "eight windows"; it was 11 by the time this landed — ent#433 added two, #2216 a third). * Ordering. It MUST run after _seed_fresh_install_retention. Both writers are insert-or-ignore, so the first to reach a key wins: reversed, a fresh install silently gets the wide defaults instead of the #1039 floor — the community floor deleted by the change meant to protect retention. Pinned behaviourally and by a source-order guard on both the SQLite and engine arms. * It must actually run. The first cut imported the constants from services.settings_service, which has a module-level `from database import db`. init_database() is called from DatabaseManager.__init__, i.e. while database.py is still executing its own module body, so database.db does not exist yet and that import raises ImportError — which this seed's fail-safe contract then SWALLOWS. The feature was dead on every boot with a fully green unit suite, because every in-process test calls the function after database has finished importing. RETENTION_OPS_KEYS, OPS_SETTINGS_DEFAULTS and NON_ROW_RETENTION_OPS_KEYS therefore move to config.py (a leaf, already home to OPS_SETTINGS_VALIDATION and validate_ops_setting for these same keys) and are re-exported from settings_service, extending the pattern COMMUNITY_FRESH_INSTALL_SEED already used for exactly this reason. Two tests now pay for a real subprocess import; both fail if the import is reverted. Stated tradeoff: a seeded install stops inheriting later changes to the code default in EITHER direction, so widening a window for existing installs becomes a deliberate migration rather than something that arrives silently with an image. That is the intended consequence — retention becomes explicit per-install config instead of implicit inheritance from whatever image happens to be running, symmetric with the rule the OPS_SETTINGS_DEFAULTS comment already imposes on narrowing. backup_retention_days is seeded too. That makes OPS_SETTINGS_DEFAULTS' value the one that lands in the DB for a key whose private reader (db_backup_service.effective_backup_retention_days, inverted coercion) falls back to its own module constant; the two are now parity-tested. No schema change, no migration — row inserts at boot, same as the #1638 seed. Not fixed here: generic DELETE /api/settings/{key} carries no RETENTION_OPS_KEYS guard (only PUT does), so an admin can still delete a window row. After this it is transient — the next boot re-seeds it — but the asymmetry with PUT remains. Unblocks ops#300 once deployed: with rows on every install, /update step 8e can drop its source-text guessing for a plain assertion over stored values. Closes #2085
…t spawns them (#2433) (#2435) * fix(watchdog): stop false-orphaning executions parked before the agent spawns them The cleanup watchdog's proof-of-life (GET agent/api/executions/running: running ∪ recently-completed) could not see an admitted execution that was waiting in the backend's global agent-call queue, in the agent's CPU-sized default thread pool, behind the agent chat lock, or in the post-exit drain before unregister(). After the 60s grace it wrote a false `failed` ("completed on agent but status not reported"), released the slot, and the parked call then ran anyway — billed, overbooked, its late 200 silently overwriting the row (#378). Reproduced twice locally; three mechanisms, one string. Orphan now means: the agent does not know the execution AND no live backend dispatcher owns it. - agent server: /api/executions/running gains `pending_ids` (accepted at /api/task, /api/chat and the #1083 async spawn but not yet spawned; lazily expired) and `recently_completed_ids` covers exited-but-registered handles. Cancel-while-pending is consumed by register() (SIGKILL at spawn, #679 marker kept); the pre-spawn 409 is only an optimisation. Headless runs use a dedicated 32-thread pool pinned to MAX_PARALLEL_TASKS_CEILING_MAX; the Gemini runtime now registers its subprocess at both Popen sites (it never did). - backend: every outbound agent call is registered for its whole lifetime (track_inflight_dispatch — queue wait, connect retries, POST) in an in-process registry plus a cross-worker Redis liveness marker execution:inflight:{id} (60s TTL, one refresher task per process, 15s tick). The watchdog reads a tri-state verdict (alive / absent / unknown) and withholds recovery on `alive`, and on `unknown` only while a dispatcher could still own the row; a process with no Redis reads `absent` (its own registry is the whole truth). CleanupReport.dispatch_inflight_skipped counts withheld rows; the orphan error string states what was observed. - a park no longer spends the run's budget: at grant, a park ≥ 5s restamps started_at (admission kept in queued_at, the drained-backlog shape, CAS on RUNNING + NULL lease) and renews the slot lease (ZADD XX + EXPIRE together); the refresher renews the slot every tick while parked. - parked rows are cancellable and agent-scoped: terminate consults the in-process registry, then the cross-worker cancel key; a parked phase is finalized CANCELLED and the grant raises BackendAgentCallCancelled, where the dispatcher writes CANCELLED itself (never FAILED; the /chat arm answers 409). - terminate_execution gains ONE agent-scope gate at its entry for all three arms: the row behind the caller-supplied task_execution_id must belong to the agent the route proved (uniform 404; an unreadable row fails closed with 503). The proxy arm's 404 scoped only execution_id while the CANCELLED CAS was keyed on task_execution_id, so a caller authorised on agent A could flip agent B's running row (found by the /cso --diff verifier; report under docs/security-reports/). - packaging: BACKEND_AGENT_CALL_LIMIT / BACKEND_AGENT_CALL_QUEUE_TIMEOUT_S forwarded in prod + hosted compose and documented in .env.example; the >5s queue-wait warning fires on both acquire branches. Verified: full unit suite under CI conditions 12969 passed / 0 failed (baseline origin/dev 12863 / 0); Repro A 10/10 success (2 parked 485s, withheld at both watchdog cycles, re-anchored at dispatch); Repro B 8/8 success (5 parked, two waves); live pending_ids probe on the agent. The agent-side half needs a rebuilt base image; the backend half alone covers old images through the whole-call marker. Fixes #2433 Co-Authored-By: Claude Fable 5 <[email protected]> * fix(watchdog): close the cross-worker cancel race and bound the exited-but-registered set (#2435 review) Review of the #2433 fix found that it reintroduced the #378 symptom in a narrower window and turned a pre-existing registry leak into a permanent one. 1. Cross-worker cancel acted on a marker phase that predated its own write. `entry.phase` flipped parked->calling in memory only; the marker was rewritten by the 15s refresher, so `execution:inflight:{id}` advertised `parked` for up to a full tick after the POST had begun. Under --workers 2 about half of all cancels are served by the worker that does NOT own the coroutine and therefore read it: the row was finalized CANCELLED and its slot released while the agent ran the turn to a billed completion whose SUCCESS then lost the CAS. Closed by ordering, not by narrowing — the owner publishes the transition in the SAME round-trip that reads the cancel key (`_publish_calling_and_check_cancel_sync`), and the remote sets the cancel key BEFORE re-reading the phase (`_set_cancel_then_reread_phase_sync`), so an observed `parked` gives W_remote(cancel) < R_remote(marker) < W_owner(marker) < R_owner(cancel) and the grant is guaranteed to see the key. Neither side pays an extra round-trip. The owner gates the publish on the ENTRY's age rather than this attempt's park, because `track_inflight_dispatch` wraps the whole retry loop and a retry can grant instantly under a marker a tick left saying `parked`; the remote's scope check stays on its first read, so no key is written for a foreign agent. 2. `list_recently_completed_ids` reported exited-but-registered ids with no age bound, so a leaked entry was agent-known forever and the watchdog never recovered that row — a regression against pre-#2433, where `list_running()` self-healed it. Now bounded by the same 300s TTL as the buffer, measured from when the exit was first OBSERVED (not `started_at`, which would drop a long turn the moment it entered its drain). The leak is also closed at source: `register()` SIGKILLs the group for a cancel that arrived while pending, so the following `stdin.write` can raise BrokenPipeError — all three prompt-writing runtimes (claude_code, gemini x2) now pair that write with `unregister()` on failure. 3. `restamp_execution_dispatch` is a sync sqlite write and ran on the event loop, while both semaphores are held and the queue is by definition congested. Now `asyncio.to_thread`, like the slot renewal beside it. Smaller items from the same review: - /api/chat sizes its pending entry to PENDING_CHAT_TIMEOUT_SECONDS (7200s): `ChatRequest` carries no timeout and a chat can wait on the execution lock for the agent's whole budget, so the /api/task default evicted the entry mid-wait. Its discard now wraps the lock acquisition, so a request cancelled while waiting (client disconnect) cannot leak one. - Phase 3 batches its in-flight verdict read (one MGET per cycle, not per row), matching Phase 0. - `renew_slot` refuses, score untouched, when the metadata hash has already expired: `ZADD XX` succeeds while `EXPIRE` no-ops, so it used to report a renewal it had not performed and re-anchor exactly the ZSET-without-hash state canary S-03 calls `missing`. - `register_pending` logs at DEBUG (it fires on every /api/task and /api/chat). - Documented that the in-flight marker is not eviction-proof under the prod `allkeys-lru` policy. Tests: tests/unit/test_2433_review_fixes.py (15) — 11 of them fail against cfc2cfe, verified in a worktree. Full unit suite under CI conditions (clean origin/dev worktree, no submodules): 12985 passed, 0 failed. Refs #2433 Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
…30 review) The reviewer's one condition before merge. `architecture.md`'s 'Two callers, one rule' bullet said the CAS-win rule was 'guarded now by enumerating every caller rather than the one route ent#329 knew about, so a third site inherits the rule instead of re-losing it'. No such guard existed: `test_dispatch_hangs_off_the_cas_win_only` read exactly one hardcoded file, `routers/operator_queue.py` — so `client_portal/asks/service.py`, the caller this PR adds and the one that LOST the rule, was outside its reach. A sentence claiming protection that is not there is worse than no sentence: the next person adding a dispatch site reads it and stops looking. This is the shape #2428 filed a learnings entry about this morning — a comment that names a failure mode is a request for a guard — so it lands the same way. DISCOVERED, NOT LISTED. `_dispatch_call_sites` walks the backend tree for callers, because a hardcoded list structurally cannot catch the case that matters: the file it would need to check is the one being added. ASSERTED AGAINST CODE, NOT FILE TEXT — and this is the part I got wrong first. The initial version tested `"_status_conflict" in source` against the raw file and MUTATION PROVED IT BLIND: deleting the check from the `if` still passed, because the long comment above it explaining the race still contained the string. A source-substring guard cannot tell a check from a paragraph about the check — the same defect the guard exists to prevent, inside the guard. It now parses each dispatching function and compares `ast.unparse` output, where comments do not survive. Verified by three mutations, each caught: 1. delete the check in asks/service.py, keep the comment -> FAIL 2. neuter the check in routers/operator_queue.py -> FAIL 3. add a brand-new third caller with no check at all -> FAIL and all 23 pass on the real tree. `test_the_discovery_walk_finds_both_known_callers` pins the floor, so a rename of the helper cannot leave the loop iterating an empty list and passing in silence — the failure a discovery guard trades for the one it fixes. ALSO (non-blocking, from the same review): `WorkspaceAsk.status`'s comment still read 'pending | expired (terminal ones are not listed)' after `_status_of` gained a third value. Corrected to say where each value is reachable from. The remaining non-blocking item — `resume_requested` and the new `answered` status are unconsumed by any surface — is deliberately NOT in this commit. It is a product decision about where a transient confirmation lives, and it is filed so it stays a decision rather than becoming an oversight. Related to Abilityai/trinity-enterprise#430 Related to Abilityai/trinity-enterprise#329 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…er-resumes feat(workspace): an answer given in the Workspace resumes the agent (ent#430)
… an ungated restart, a broken export round-trip, and prefix-collision membership (#2373) The deploy half has been hardened by every commit since ent#124; the four post-deploy endpoints were essentially untouched since 2025. ## Membership is now ONE predicate `get_system`, `restart_system` and `export_manifest` each matched `startswith(f"{system_name}-")`, so an operation on `acme` also captured every agent of a system named `acme-extra` — including `restart`, which stops and starts containers. Three copies of a wrong rule. `system_service.system_member_names` is the one rule, and it prefers TAGS: `configure_tags` already applies the system name to every member, so a tag is a RECORD of membership where a prefix is an inference from a naming convention. The prefix survives only as a fallback for pre-tag deployments, narrowed so an agent claimed by another system's own tag is excluded — a tagged `acme-extra` agent is never captured by `acme` even there. A failing tag read degrades to the prefix rather than 500ing. Residual, stated rather than hidden: two systems deployed BEFORE tagging where one name is a prefix of the other remain ambiguous, because nothing distinguishes them. This is also the prerequisite for the teardown verb, where the same collision would delete rather than restart. ## GET /{name} returns real schedules It called `db.get_agent_schedules`, which does not exist — the facade exposes `list_agent_schedules` and `database.py` deliberately has no `__getattr__` fallback. The AttributeError was swallowed by the surrounding `except Exception`, so every response omitted `schedules` for every agent and logged one warning each, while `tests/test_systems.py` never asserted on the key. Exactly the failure mode the db facade's own comment warns about — so the test also pins that the fallback stays absent, since adding one would turn the next typo into a silent Mock. ## POST /{name}/restart is creator-gated It was bare `get_current_user` — below `POST /deploy` and below even the READ-ONLY bundled-catalog routes — so any authenticated principal, including `role: user`, could stop and start every container in a system whose agents it could see. A mutating fleet-wide verb under a lighter gate than the catalog it reads is an oversight, not a decision. `require_role` also rejects agent principals (#1890), which matters because an agent-scoped MCP key resolves to its owner carrying the owner's role. ## Export round-trips The non-full-mesh permissions branch sliced `target_agent[len(name)+1:]` with no membership filter — the sibling branch had one — so an edge pointing outside the system exported as a blind-sliced garbage short name that then failed `validate_manifest`'s unknown-agent check on re-deploy. The export broke its own round trip. Both branches now test membership. And the export no longer embeds the instance-global `trinity_prompt` as the manifest's `prompt:`. Deploying that manifest elsewhere overwrote THAT instance's platform-wide prompt — a fleet-wide side effect from what reads like a copy of one system. Nothing records whether the source system ever set a prompt, so there is no honest way to distinguish it from whatever the instance happens to have configured, and the only correct export of an unknown is to omit it. ## Two preview hardenings Unknown PER-AGENT keys now warn like top-level ones (ent#126): `credentials:`, `skills:` and `display_label:` are the fields people try first and they vanished in silence. Preview and deploy now resolve the identical resource default. Deploy hardcoded `{"cpu": "2", "memory": "4g"}` while `_preflight_template` validated against the admin-configurable `get_agent_default_resources()`, so the two disagreed the moment an admin moved the fleet default — the one spot that escaped ent#126's pure-resolver no-drift pattern. ## Verification 14 unit tests, one per defect plus the exempt shapes. Two mutation-checked: the restart gate and the tag-first membership each turn a test red when reverted. 414 pass across the system/manifest/ent#126/#1884 suites. `tests/test_systems.py` is live-backend tier and cannot run without a stack — which is part of why these survived — so the coverage added here is unit-tier, where the per-PR gate can see it. Closes #2373 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…uire_role
Review found the agent-principal test tautological: it asserted
`"reject_agent_principal" in inspect.getsource(require_role)` and passed
because `getsource` returns the DOCSTRING, which contains the sentence
"Deliberately does NOT call `reject_agent_principal`". The assertion matched
its own refutation.
`require_role` rejects CONNECTOR principals only, and that omission is
deliberate — `require_role("creator")` on `POST /api/agents` is what makes
ent#69 Part 2 agent-spawned creation work. It is not touched here.
The decision the reviewer asked for: human-only is correct, because it closes
a BYPASS rather than merely widening a gate. `POST /agents/{name}/start`,
`/stop` and `/delete` each call `enforce_agent_spawn_scope`, so an agent-scoped
caller may only start or stop agents it actually SPAWNED (name *and* key id).
`restart_system` loops every member calling `container_stop` +
`start_agent_internal` with no per-member check at all — so reaching it with an
agent key performs, in bulk and unscoped, exactly the operation that is
spawn-scoped one at a time. On a default admin-owned install an agent key
resolves to its owner carrying the owner's role, so `require_role("creator")`
alone admits the whole fleet (trinity-ops-agent#232 class).
Scoping per member was considered and rejected: a system whose every member the
caller spawned is a near-empty set, so it would be a strange capability rather
than a useful one. If an agent-driven restart is ever wanted it needs its own
design.
- `restart_system` calls `reject_agent_principal` explicitly, above the `try`
- docstring + `docs/memory/feature-flows/system-manifest.md` state the real
reason; both previously carried the false "require_role also rejects agent
principals since #1890"
- the tautological test is replaced by three real ones: `require_role` does NOT
reject agent principals (the false premise pinned as its opposite, read
through `_code_only`), `restart_system` refuses an agent principal BEFORE
touching anything (driven for real, with `get_accessible_agents` stubbed to
raise so a late refusal fails loudly), and a human creator is still admitted
(so the guard is about principal KIND, not role). Mutation-checked: removing
the guard turns the last two red.
- export: `set(member_names)` was rebuilt per row inside a comprehension, and
the sibling branch held a redundant `_member_set` copy — `member_names` is
already a set, so both branches now read it directly
- MCP `restart_system` description carries the tightened gate and the tag-first
membership resolution, so an agent caller's 403 is legible
Behaviour changes (release-note material):
- `POST /api/systems/{name}/restart` now requires the `creator` role and a
human caller. Previously bare `get_current_user`. Agent-scoped MCP keys get
403.
- `GET /api/systems/{name}/manifest` no longer exports `trinity_prompt`.
Related to #2373
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…roken export slice (#2373) All four blockers are real. The first is the serious one: my own fix created it. **1. Credential disclosure.** Fixing the three-year-broken `schedules` key made it reachable — `list_agent_schedules` returns whole `db_models.Schedule` rows and `GET /{system_name}` declares no `response_model`, so FastAPI serialized every column including `webhook_token`, the bearer for the UNAUTHENTICATED `POST /api/webhooks/{token}`, plus `webhook_secret_encrypted`. The route is bare `get_current_user` + `get_accessible_agents`, so any chat-level shared `role: user` received schedule-trigger credentials for every member agent. `db_models.py:182-189` states neither is ever surfaced in a response model. Projected through `ScheduleResponse` — the model, not a hand-picked dict, which would be a second field list free to drift. Precedent: `get_agent_schedule_names` (#2161) projects for the same reason. A second test asserts the disjointness against `Schedule.model_fields` rather than a literal list, so a fifth webhook field is covered without anyone remembering. **2. Partial tagging dropped members.** `if tagged: return tagged` let ONE tagged agent hide every other member. Reachable three ways, none exotic — `PUT /agents/{n}/tags` is a full-set replacement, an agent added post-deploy is untagged, and `configure_tags` sits in a try/except so a mid-loop raise still reports "deployed". `restart_system` then restarted a subset and called it success; `export_manifest` wrote an incomplete backup and called it one. Now `tagged ∪ narrowed-prefix`, returned in roster order so a tag edit does not reshuffle what the caller renders and restarts. **3. A tag-read failure re-opened #2373 itself.** The `except` set `tags_by_agent = {}`, which made `claimed_elsewhere` unconditionally False and degraded to the RAW prefix — so `restart_system("acme")` stopped and started `acme-extra-worker`, logging a WARNING and returning a byte-identical response. The docstring's "never captured even on that path" and "degrades to the prefix" could not both be true. With tags unreadable the narrowing is now structural (`"-" in name[len(prefix):]`), so membership that cannot be justified is dropped rather than assumed. The old failure test used `["acme-web", "other"]`, which never reached the collision; the new one does. **4. The export slice broke on tag-only members.** `full_name[len(system)+1:]` assumes the prefix, which tag-first membership no longer guarantees — and this PR's own test asserts such members ARE members. `content-production` + `bot` and `assistant` both sliced to `''`, colliding as a dict key (silent agent loss) and failing `validate_manifest`'s name regex, so the export could not re-deploy: the same "export broke its own round trip" class this PR set out to fix. Skipped and reported, following #1759's `templateless` precedent in the same function — a manifest that silently loses an agent is worse than one that names what it could not represent. Mutation-checked, all four. The export test is BEHAVIOURAL — it invokes `export_manifest` and parses the YAML — because the first version was a source grep that matched a leftover variable declaration and survived deleting the very skip it guarded. That is the self-matching class the review named, reproduced by me while fixing it. Related to #2373 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t a whole system (#2373) Both remaining blockers, and both were the same shape as the originals — the correction applied at one call site while the test was written around the surviving half. C1 — export_manifest's permission branches still blind-sliced. The prefix skip landed only in the agent_configs loop. Both explicit-permission loops kept slicing name[len(system)+1:] with no prefix test, and the membership filter added beside them ADMITS tag-only members, whose names carry no prefix at all. System `acme` with tag-only member `helper` exported `explicit: {web: ['r']}`; two tag-only members under `content-production` both sliced to `''` and collided on one key. Either way `validate_manifest` rejects the export on re-deploy — the round trip broken by the exporter. Fixed with ONE `_member_short_name()` used on both sides of every edge and by the agent_configs loop too, so a guarded slice in one place and a blind one in another cannot drift apart again. No blind length-slice survives in the module. C2 — the degraded path lost a whole system. `excluded = "-" in name[len(prefix):]` is strictly NARROWER than the raw prefix it claimed to degrade to, and the bundled flagship manifest is entirely inside the gap: config/manifests/vc-due-diligence.yaml names all eleven agents `dd-*`, so every deployed name is `vc-due-diligence-dd-<x>`, every remainder has a hyphen, and a transient tag-read error returned 404 System not found and an empty export for a correctly tagged, healthy fleet. Measured on head: 0 of 11 members. Now narrowed on ROSTER EVIDENCE — a name is excluded only when another agent on the same roster is a longer system prefix of it. Measured after: 11 of 11 for vc-due-diligence, and `acme-extra-worker` still excluded when `acme-extra` itself is present. THE RESIDUAL IS STATED, NOT HIDDEN. On a roster of names alone, with tags unreadable, `acme-extra-worker` and `vc-due-diligence-dd-lead` are genuinely indistinguishable — any rule excluding one excludes the other. So the pre-#2373 residual stands on that transient path, and losing a healthy system entirely is the worse of the two errors. The flow doc now says exactly this instead of 'degrades to the prefix', which was false in the other direction. TESTS. `test_a_failed_tag_read_does_not_re_open_2373` used `["acme-web", "acme-extra-worker"]` — a roster with no evidence the sibling system exists — so it could only ever be satisfied by a shape heuristic. Its fixture now carries `acme-extra` itself, which is what makes the sibling observable, with the residual recorded beside it. `test_export_scopes_permission_edges_to_members_in_both_branches` was a source count that passed while C1 was live; it now asserts the property (no blind slice anywhere) rather than counting guards. Added: the eleven-agent vc-due-diligence case, the evidence case, the no-evidence case, and five short-name cases. Related to #2373 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…#2373) Self-review found the roster-evidence narrowing is the same defect as the rule it replaced, one door along — and one variant is worse than the original. MEASURED, by driving the real function with the tag read raising: 'acme' roster=[acme-api, acme-api-worker, acme-web] -> [acme-api, acme-web] # acme-api-worker DROPPED 'vc-dd' roster=[vc-dd-dd, vc-dd-dd-lead, vc-dd-dd-tech] -> [vc-dd-dd] # 2 of 3 dropped 'acme' roster=[acme, acme-web, acme-db, acme-worker] -> [] # the whole system `acme-api-worker` is an ordinary member of `acme` whose manifest key is `api-worker`, sitting beside key `api`; nothing about it belongs to another system. And an agent named literally `acme` anywhere on the accessible roster is a name-prefix of EVERY member, so one unrelated agent's name turned a healthy system into `404 System not found` and an empty export — the exact C2 symptom returning through a different door. WHY THERE IS NO THIRD RULE. From names alone `acme-extra-worker` is `worker` of `acme-extra` or `extra-worker` of `acme`. Only a tag separates them, and the tag read is what failed. So this is a choice between two errors, not a puzzle with a better answer. The errors are not symmetric, and the commit that introduced the union already said so: `restart_system` shares this predicate, so over-capture restarts one agent too many and logs a WARNING, while under-capture restarts a SUBSET and reports success — 'silent partial success on a fleet-wide verb', the thing the union rule exists to prevent. `export_manifest` writes a short backup and calls it complete. So the unreadable-tag path degrades to the RAW PREFIX, which is what the docstring and the flow doc have always promised, and the residual is stated: `acme` may capture `acme-extra-worker` while tags are unreadable, ending when the read recovers. The narrowing is untouched on the tag-READABLE path — the path that actually runs — pinned by the existing test_the_prefix_fallback_still_excludes_another_systems_tagged_agents. THE TEST IS A PROPERTY, NOT A CASE. Two case-by-case tests were satisfied by two different member-losing rules, so the fallback is now pinned as a SUPERSET of the raw prefix over five rosters. Any future narrowing here fails by construction, whatever shape it narrows on. ALSO (I1): export_manifest re-derived membership the caller had already resolved — a second tag read per export, and if that read degraded where the first had not, member_names became a strict subset of agents and permission edges to real members were dropped from the backup in silence. It now reuses the caller's set. Related to #2373 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ue 422 (#2696) (#2702) * fix(workspace): the /stt provider error says why, instead of one opaque 422 (#2696) `transcribe_portal_audio` mapped every non-200 from ElevenLabs onto `422 "Could not transcribe the audio"`. A missing endpoint permission, a rejected key, exhausted credits, a provider rate limit and a rejected audio container all read identically, while the actionable status word sat in a backend WARNING one line above — a live instance cost an operator with container access a full round-trip to answer a question the system already knew. `stt_capability_service.classify_stt_failure()` (pure) maps a provider answer onto a named category with its own client status and sentence: permission / auth / quota 401·402·403 by status word → 503, operator-actionable rate_limit 429 → 429, the existing retry wording audio 400·413·415·422 → 422, "the recording could not be read" provider 5xx → 502, the existing transport wording unknown anything else → 502, still says who failed No arm returns the old string; a test sweeps every status 300-599 to pin that, so an unrecognised provider answer cannot regress to it. The client sentence never carries the provider body. `record_live_failure` keeps the status word + category for THIS key (`stt:last_failure:<digest>`, 24h; per-process fallback) and still feeds #2695's capability cache on a 401/403, so the mic hides on the next load. `GET /api/settings/elevenlabs` (admin-only) carries it as `stt_last_failure`, and Settings -> Voice renders "Last voice-input failure: <why> (HTTP <status> <word>) — <time>" under the capability badge. Fail-soft is unchanged: every branch raises ClientPortalError, never a 500, and the client can always type instead. Fixes #2696 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015owqMKD5QDjzZrUTF2Joht * fix(stt): a quota word in the provider's prose is not a quota verdict (#2696) Review finding, reproduced by driving the classifier: a 401 whose body carries no status token was classified `quota` whenever its SENTENCE happened to contain one of `_QUOTA_WORDS`. 401 {"detail":"Invalid API key for your plan"} -> quota 401 {"detail":{"message":"…not valid for this subscription"}} -> quota Both are ordinary auth failures. The client was told "the account is out of credits or not on a plan that allows it" and the admin panel said the same, so an operator whose key simply needed replacing was sent to a billing page. That is worse than the opaque 422 this issue replaces — it is confidently wrong in a direction someone acts on. The cause is that `provider_status_word` collapsed two different things: `det["status"]`/`det["code"]`, which are machine tokens the provider documents, and `det["message"]`/a bare string detail, which is prose written for a human. The comment above `_QUOTA_WORDS` already claimed matching happened on "the status token"; the code matched whatever came back. `provider_status_parts(body) -> (token, prose)` keeps them apart, and `classify_stt_failure` matches ONLY the token. A 401/403 carrying prose alone is now `auth` — the honest reading of "the key was rejected and the provider did not say why". `provider_status_word` stays as the operator-facing display value (token else prose), so nothing is lost from the panel: the prose still shows, it just no longer votes. Verified in the backend image: 38 passing in this suite (5 new table rows + 3 new tests), 66 with #2695's alongside it, and the portal/settings sweep has the identical non-passing set on this branch and on its base — no new failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q19uRCksdn4DiRAJ55rfpZ * docs(architecture): the stt_capability_service bullet carries the #2696 provider-error branch Re-applied after rebasing onto dev: #2699 squash-merged with its own final wording of this bullet, so the branch's copy of the paragraph conflicted and dev's was taken; this is #2696's one addition to it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * fix(stt): the last-failure row obeys the verdict's cross-worker rule, and invalidate forgets it (#2696) The /review on #2702 (I1): `read_last_failure` fell through to this worker's local copy on a Redis MISS — the pre-#2695-fix shape of `read_cached`, which that PR was held for. After the rebase the two readers in one module disagreed about what a miss means; now they share the rule (Redis answers ⇒ authoritative, miss evicts the local copy; local only when Redis cannot be asked). `invalidate` also drops the key's last-failure row, so re-saving a fixed key does not show the operator the pre-fix failure for 24h beside a fresh `capable` verdict. Mutation: restoring the fallthrough turns the new two-worker test red. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * merge-train: the operator-facing stt detail is scrubbed of the key (#2702) — mechanical, per the merge-train note on the PR `record_live_failure` stores the provider's status word / prose as the operator `detail` for 24h and the Settings panel renders it. The client half is a constant, so this row is the only place a provider body reaches any surface; the panel promises the key is never echoed, so enforce it here with `scrub_secret` instead of assuming it of the provider. One test drives a body carrying the key and asserts neither the returned failure nor the stored row contains it (mutation: scrub removed → red). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…ing — git_dir_bytes BIGINT (#2800), int4 coercion (#2827) (#2805) * fix(db): agent_sync_state.git_dir_bytes is BIGINT on PostgreSQL (#2800) `git_dir_bytes` was declared INTEGER for the PostgreSQL backend (tables.py Integer + Alembic 0019 `INTEGER`), i.e. int4 with a 2 GiB ceiling. The column exists to observe workspace-repo bloat (#1596), so the values it is there to record are exactly the ones that overflowed: any agent whose `.git` passed 2,147,483,647 bytes made every SyncHealthService upsert raise `psycopg2.errors.NumericValueOutOfRange: integer out of range`, and that agent's sync health went dark at the moment it mattered. SQLite never showed it (its INTEGER is 64-bit), which is how it shipped on 2026-07-14. Dual-track (Invariant #9): - schema.py: `git_dir_bytes BIGINT` — single source of truth for both backends (init_schema_postgres translates the same string), so fresh PG builds get int8 via 0001_baseline. - tables.py: `BigInteger`. - Alembic 0062: `ALTER COLUMN git_dir_bytes TYPE BIGINT` (proven on a real postgres:16 upgraded from 0061 with the column forced back to int4: information_schema reports `bigint` afterwards and a 44 GiB insert lands). - SQLite `agent_sync_state_git_dir_bytes_bigint`: a declared-type rebuild via the #1160 rename-swap, NOT a bare no-op. schema-parity compares a fresh init_schema DB against an upgraded one by declared column type, so a no-op would leave upgraded files reading INTEGER against a fresh BIGINT and turn that guard red forever. One row per agent, all columns copied verbatim, the one index re-created, idempotent. CI regression seam: `TestGitDirBytesRoundTrip` in test_1596_git_sync_observability.py is now `requires_postgres`, so the schema-parity PostgreSQL tier (#2434) runs its [postgres] leg — the leg that had been red for two months while the tier selected only marked tests. A new information_schema assertion names the column type rather than a stack; two SQLite tests pin the rebuild (rows preserved, index back, no-op pre-#1596). Audit of sibling byte-count columns: `agent_shared_files.size_bytes` stays Integer — bounded by MAX_FILE_SIZE_BYTES (50 MB) at the only writer, so it cannot reach int4's ceiling by construction. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(db): #2800 rebuild refuses to drop a column it does not name The rename-swap copies exactly the columns its INSERT...SELECT lists and DROPs the old table. Compare the live agent_sync_state column set against that list first and raise — before touching anything — on an unknown column, so a future/unforeseen column is surfaced as a boot failure (`first_pending`, #1160) rather than silently destroyed. No known path produces one today; this is a belt on a migration whose failure mode is data loss. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(learnings): #2800 — Integer is int4 on PostgreSQL; growth columns are BigInteger, PG tests need the marker Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(db): #2800 rides dev's Alembic head, and the SQLite track carries nothing — the rebuild's justification was false Two merge-train findings on #2805: 1. dev's head moved to `0062_execution_fan_out_task_id` (#2532) after this branched, and this revision declared the same parent — a live #2068 fork, two heads, `upgrade head` applying zero revisions. Re-chained as `0063_agent_sync_state_git_dir_bytes_bigint` off `0062_execution_fan_out_task_id`; `check_alembic_heads.py` on the merged tree: 64 revisions, 1 head. 2. The SQLite rename-swap rebuild was justified by "the schema-parity suite would go red forever" — disproved by a one-line negative control (registration removed, suite still green): both parity fixtures build from empty, so `init_schema` creates the table in both snapshots and the guard cannot see this column's declared type. A boot-time DROP TABLE of a live table for a CI benefit that does not exist is the wrong trade. The rebuild, its column list and its three tests are gone; a note beside `_migrate_agent_sync_state_git_dir_bytes` says why the SQLite track deliberately carries nothing, a test pins that it stays that way for a reason, and the learnings entry now states the honest lesson: run the negative control before writing a guard's behaviour into a durable file. The seven sibling columns with the same int4-vs-`< 2**63` mismatch are filed as #2827. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * fix(db): coerce every agent_sync_state integer at its own column's ceiling (#2827) `_coerce_nonneg_int` admitted anything up to INT8_MAX for all eight int columns, but only `git_dir_bytes` is BIGINT on PostgreSQL (#2800). The other seven are int4, so a value the boundary admitted but the column could not hold made the whole upsert raise NumericValueOutOfRange and the agent's sync health went dark. The four ahead/behind counters were not coerced at all. - default ceiling is now INT4_MAX; `git_dir_bytes` and the lock-report ints opt into INT8_MAX explicitly - `_coerce_counter` bounds ahead_main/behind_main/ahead_working/ behind_working (and the legacy ahead/behind keys) the same way Tests drive INT4_MAX+1 through `_sync_agent` per column (rejected → NULL/0, BIGINT admitted), pin that INT4_MAX itself lands, and round-trip each column's admitted maximum through SyncStateOperations on both backends. Mutation (default ceiling back to INT8, counter left raw) → 3 red. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Eugene Vyborov <[email protected]>
…t gated (#2836) `workspace_available` was still computed by GET /api/settings/feature-flags, still shipped `false` in `.env.example` and all three compose files, and was still described as *the* Workspace opt-in by `settings.py`'s docstring, the endpoint catalog, the voice-chat flow's env table and the single-server deploy guide — while nothing in `src/` gated on it. ent#438 merged the per-agent workspace page into the Workspace and removed every consumer. That is worse than a dead key. An operator following the docs sets WORKSPACE_ENABLED=true and changes nothing, or reads the default `false` and concludes the Workspace ships dark when it does not — and a release note could repeat the claim. Found by /release-plan as the one *forgotten* item in the 0.9.5 payload: not a forgotten flip, a forgotten removal. Removed: the flag key and its docstring bullet (`routers/settings.py`), the `is_workspace_enabled()` resolver (`settings_service.py`), the store field and its two writers (`stores/sessions.js`), the declaration in `.env.example` and the three compose files, and the four LIVE doc claims. Deliberately kept: the historical references in `observability.md`, `requirements/core-agent.md`, `feature-flows/agent-canvas.md`, `router/index.js` and `AgentHeader.vue`. Each narrates the retirement in the past tense and is how a future reader learns why the knob went away. Also kept: `voice_available`, which has no reader either but is a separate #2559 follow-up — its `sessions.js` comment justified itself by the `workspace_available` derivation, so that sentence is corrected here. `config.py` and `requirements/runtimes.md` described VOIP_ENABLED's default as "mirrors the workspace_available opt-in"; VoIP is independent (`VOIP_ENABLED and gemini_key`), so the stale cross-reference is dropped. Tests: `tests/unit/test_workspace_flag_retired.py` pins the removal four ways — the key is absent from the handler payload, the resolver is gone, no shipped config declares the variable, and no live source reads it. The source scan strips comment REGIONS rather than testing line prefixes, because the reference that motivated it sits on a continuation line of a multi-line `<!-- -->` block in `AgentHeader.vue`. Verified by mutation: re-adding the key as code turns two of the seven red, and restoring turns them green. The two #860 tests in `tests/test_platform_default_model.py` asserted the key must be PRESENT — the contract ent#438 invalidated — and are replaced by one that asserts its absence over the wire. Two now-dangling `is_workspace_enabled` stubs dropped from the #2217 and #2380 unit tests. Verification: 155 backend unit tests pass across the touched files. The frontend vitest suite was NOT run locally (Docker is not running and this clone forbids falling back to local npm); `frontend-build` covers it in CI. Co-authored-by: sim <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
… read never mints (#2835) `origin/dev` pinned `fd25b47b`, one commit behind `enterprise-main`. The missing commit is Abilityai/trinity-enterprise#545/#570: `get_activation_funnel` read through the minting `get_or_create_installation_id`, so the first admin open of Settings → Activation persisted the durable identity row from a GET. That is the private counterpart of #2669, which IS in this payload — the OSS guard pinning the caller set of the identity-minting accessors. Shipping the pointer as-is ships the guard without the fix it guards. Ordering prerequisite verified before bumping: the enterprise commit imports the OSS non-minting twin `get_installation_id`, which is present on public dev at `services/operator_intake_service.py:148` (its docstring already cites ent#545), and `tests/unit/test_2669_minting_accessor_callers.py` is in the tree. The bump is a clean fast-forward of exactly one commit. Co-authored-by: sim <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…ords its mutation (#2829) (#2833) Three of five ejections on the 2026-09-15 merge train — the third train running — were tests that prove the code was written rather than that it runs: source-text regexes over the module under test (#2811), a bound check at the one value where both bounds coincide (#2817), a docstring claim about CI never negative-controlled (#2805). All green. - docs/testing/STRATEGY.md: a new "Evidence bar for a test" section beside the harness bar — the three spellings, the two greps (the live-consumer grep is the one that decides), guard-vs-source-only with the train's own pair (#2819 kept, #2811 ejected, same shape), mutation as the fix standard, bound tests away from the coincidence — each with what enforces it. - .github/pull_request_template.md: a Testing checkbox for "every new test executes the changed path" and a `Mutation:` line naming the test(s) that go red with the fix reverted ("n/a — not a fix" otherwise). The trailing space after the colon matches the existing `Journey Impact:` line — a fill-in prompt. - docs/memory/learnings.md: the class, with the prior occurrences. The skill half — /review Step 2.5 and /validate-pr §5.4 answered first and in writing, /implement's two done-criteria — is trinity-dev#29. Fixes #2829 Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Eugene Vyborov <[email protected]>
…host (#2812) (#2837) * fix(tests): the journey model gate asks the instance, not the pytest host (#2812) J03's first turn and J10's "I can read what they said" / "every fan-out subtask completes" gated on `os.getenv("ANTHROPIC_API_KEY")` in the pytest process. That is the harness host, not the instance under test. A stack whose agents authenticate by subscription (SUB-003) has no such variable on the host yet answers normally, so those journeys skipped PERMANENTLY — and invisibly, because the reason is allowlisted in `tests/harness/audit_skips.py`. A gate that cannot fail is worse than no gate: #2336's per-PR journey-smoke and #2350's merge-enforced Journey Impact declaration were both green while asserting nothing about a real model answer. One helper now decides for both files (AC 1): `conftest.skip_unless_agent_can_answer` reads the CALLEE's own `auth_mode` from `GET /api/subscriptions/agents/{name}/auth` — "what the callee will actually have" (AC 2) rather than what the instance has somewhere. J10 passes B, the agent that has to produce the words, not the caller. `GET /api/subscriptions` being non-empty was rejected for the reason #2812 gives: it describes the instance, not the callee, and would turn today's permanent skip into a false FAILURE when a freshly created ephemeral agent never gets a subscription assigned. Asking the agent cannot make that mistake, and the endpoint reports the MODE, never the value. The skip reason keeps the verbatim substring `journey needs a real provider key`, so it stays allowlisted (AC 3), and now names the agent and its mode — so a permanent skip is diagnosable from the run output, the property that was missing. A collection-time `skipif` could not do this: it cannot ask a live stack about an agent that does not exist yet, so the gate moved into the tests. Deliberate behaviour change, called out for review rather than discovery: a stack advertising a credential that cannot actually answer (the classic case being a literal `ANTHROPIC_API_KEY=placeholder`, which the backend does not special-case) now FAILS instead of skipping. The old host-side gate vetoed that sentinel by string comparison; an instance-side gate cannot see the value and should not. This tier's doctrine is that a stack which cannot deliver the promise is a finding, not a silent pass. `docs/testing/STRATEGY.md` gains acceptance item 11 stating how the gate decides and naming both rejected shapes (AC 4). Tests: `tests/unit/test_2812_journey_model_gate.py` — 10 tests driving the helper with a fake client, so the gate's logic is covered in the unit tier with no live stack. Covers both working modes, the not-configured skip, the real `audit_skips` matcher run over the real message, three unreadable-endpoint degradations, that the named agent is the one asked about, and per-agent caching. The regression pin matches over the AST, not source text: the prose in these files necessarily names the variable to explain why it is no longer consulted — once inside a docstring, which no comment-prefix check can see. Mutation-verified: re-adding a host read turns it red, removing it green. Not done: registry.json entries for the two new test files this work adds. The registry is ~32% complete and unenforced, and it is a hot file (40 commits this cycle); two release-day branches editing it would conflict by construction. Worth a `/update-tests` sweep after the cut. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(tests): the model gate needs the instance credential too, not just the route (#2812) journey-smoke went red on the first push and the failure was the fix's own assumption. `get_agent_auth_mode` derives PURELY from DB state, and `use_platform_api_key` is a per-agent ROUTING FLAG — not evidence that a key exists. `.env.example` ships `ANTHROPIC_API_KEY=` empty and CI copies it verbatim, so on the credential-free stack a fresh agent still reports `auth_mode="api_key"`: it is configured to USE the platform key, there just isn't one. Gating on that alone ran the three keyed journeys against a keyless stack and failed them — the #2812 defect pointing the other way. `auth_mode` answers "which credential source is this agent routed to", not "can it answer". The gate is now a composite of two instance-side reads: 1. the callee's own `auth_mode` (`subscription` / `api_key` / `not_configured`) 2. `claude_auth_configured` from `GET /api/settings/feature-flags` — a non-empty platform Anthropic key OR any registered subscription, the one definition behind the flag and ent#582's first-credential check Both must hold. Neither reads the pytest host's environment; neither discloses a credential value. The #2812 case still works: a subscription-authenticated stack has no `ANTHROPIC_API_KEY` anywhere yet reports `claude_auth_configured=True`, so its journeys run. Residual unchanged and still stated: a credential that is present but INVALID (revoked key, or the literal `placeholder`, which the backend does not special-case) passes both reads, so the journey runs and fails rather than skipping. Only a real turn could close that, which is #2812's other candidate signal and a heavier change than this gate warrants. Tests: 13 now (up from 10). Two new pins carry the lesson — the exact journey-smoke combination (routed to `api_key`, instance holds nothing) must SKIP, and the subscription-stack case #2812 exists to fix must still RUN. Mutation-verified: deleting the instance half turns the regression pin red. `docs/testing/STRATEGY.md` item 11 now names all three rejected shapes with the failure each one produces. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: sim <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…the gate a mechanism (Abilityai/trinity-enterprise#628) (#2826) * fix(mcp): gate the loop tools on the agent permission edge, and make the gate a mechanism (Abilityai/trinity-enterprise#628) `run_agent_loop` resolved its target from the caller's parameter and called no gate, and the backend behind it resolves an agent-scoped key to its owner (Invariant #8) — so an agent key could start a loop on any same-owner sibling with no `agent_permissions` edge. Verified live: the loop ran on the sibling. The per-tool gate had ten spellings across nine modules and the tool added last called none of them, so this closes the class, not the tool. - src/mcp-server/src/access.ts (new): ONE implementation of the agent-scope edge (`checkAgentEdge` — system bypasses; an agent key reaches itself and its permitted targets, the permitted list read fail-closed; a user key passes through because the backend already scopes it by role and per-user grant; any other scope is denied — an allowlist, #2323); `TOOL_ACCESS_POLICY`, one row per registered tool (enforce / in-tool / baselined:<owner> / none:<why>); `policyFor` (no row, an enforce on an undeclared parameter, or a none on a tool whose parameters name an agent throws at registration); and `withAgentAccess`, the enforce wrapper. - server.ts: every tool passes `policyFor`; enforce rows are wrapped before `withAudit`; dynamic tools declare their policy as an argument. - tools/loops.ts: `run_agent_loop` is an enforce row; `get_loop_status` / `stop_loop` resolve the loop's agent, gate, then act — a denial withholds the payload behind a compound uniform reason (the id was the caller's only input), and a failed resolve sends no stop and names the escape hatch. - tools/chat.ts: the agent/system branch delegates to the shared gate; unknown scopes are denied before the user branch (closes a fall-through that promoted an unnamed agent key to the same-owner rule); `resolveClient` moves to access.ts. types.ts / client.ts: `LoopStatus`, `getLoopStatus` typed. - .github/workflows/mcp-server-test.yml: an offline boot smoke of dist/server.js — bundler module resolution hides a missing `.js` until the container dies. - tests: access.test.ts (createServer boots against the real table, every row names a tool and every tool has a row; policyFor refusals; the wrapper never reaches execute on a denial; the read fails closed), tools/loops.test.ts (all three tools through the real row and wrapper with a fake client; a denial means the side-effecting call never happened; the reason is byte-identical to chat_with_agent's), J10: the strict xfail comes off, and a loop-id read or stop after the edge is removed is refused without naming the loop's agent while the owner can still stop it. - docs: the flow, the requirement (§38.1 said cross-agent loops were out of scope, the flow said "backend enforces", the code did neither), the architecture area file and the P-02 catalog entry now say one thing: a tool-surface gate at the MCP layer; the REST routes stay owner-equivalent, which is Abilityai/trinity-enterprise#629's ruling. The 53 `baselined` rows are that issue's work list. Learnings ledger +1; diff-scoped CSO report. Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(mcp): execute the line that wires the gate — run_agent_loop over a real transport, an agent key, and a counted backend (Abilityai/trinity-enterprise#628) Review C1 on #2826: `server.ts::addToolWithAudit` composes `withAgentAccess` around an `enforce` row's `execute` and hands the result to `withAudit`. Both existing files proved the wrapper — `access.test.ts` calls it directly, `tools/loops.test.ts` builds the composition by hand — and neither executed the composition site. Build the wrapper there and discard it (`withAudit(tool.name, tool.execute, …)`) and the suite stayed at 406 green with `run_agent_loop` ungated: the #2811 class, the reaction tested and the wiring that calls it not. `access-wiring.test.ts` drives the tool the way an agent does: a real `createServer` in key mode, a real MCP client presenting an agent-scoped key over the streamable-HTTP transport, and a stub backend that answers `/api/mcp/validate` and the permission-edge read and COUNTS every `POST /api/agents/<target>/loops`. Without an edge the count stays at zero and the caller reads the denial; with an edge the loop starts; a self loop starts without a permission read. Under the reviewer's mutation the first case is the one red (`loopPosts` = ["bravo"], `success: true`); restored byte-identical, 409/409. Pattern: `inline-auth-transport.test.ts` (#2035). Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
… — one bad frontmatter field no longer nulls the skill record (#2850) (#2851) The skill scanner fed the raw `allowed-tools` frontmatter value into `SkillInfo.allowed_tools: Optional[List[str]]`. Claude Code's canonical form is the comma-separated string (`allowed-tools: Read, Bash`) — what the agent guide teaches and the marketplace wizards scaffold — so Pydantic rejected the record, the outer `except` caught it, and the fallback re-added the skill with only its directory name. Every such skill rendered "No description available" in the Playbooks tab, the `/` popup and the chat empty state, and the warning re-fired on every `GET /api/skills`. - `normalize_allowed_tools`: both spellings (`Read, Bash(git:*)` and `[Read, 'Bash(git:*)']`) yield the same list. Linear scan splitting on commas at group depth 0, so `Bash(npm run lint, npm test)` stays one entry; quotes are deliberately not tracked (an apostrophe in shell text must not drop the field). Bool / mapping / number / unbalanced group → field skipped. - Every field is normalized on its own (`_field`), so a bad value drops THAT field to None and the rest survive; the outer `except` is a last resort for an unreadable file only. YAML 1.1 scalars (dates, numbers) coerce to text; `argument-hint: [file]` — Claude Code's idiom, a YAML list once parsed — is restored to the bracketed string. - A skipped field is warned once per (file, field, value), then DEBUG. - `path` falls back to the absolute path outside `/home/developer` instead of raising (also what made the scanner untestable under tmp_path). - `allowed_tools` is documented as display metadata only — nothing enforces it. Release note: the fix lives in the AGENT BASE IMAGE. Existing instances see it only after `./scripts/deploy/build-base-image.sh` and an agent recreate (the #2213 trap); the backend and frontend are unchanged. Fixes #2850 Co-authored-by: sim <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
…t of the central column (Abilityai/trinity-enterprise#625) (#2841) * test(frontend): a spec can mount a component — jsdom + @vue/test-utils, opt-in per file `vitest.config.js` stays `environment: 'node'` for the pure-rules suite and gains `@vitejs/plugin-vue`, so a spec that must MOUNT an SFC opts into jsdom with a leading `// @vitest-environment jsdom`. First consumer: the Workspace theme switch (trinity-enterprise#625), whose AC asks for a click that reaches `setTheme` — a regex over the SFC cannot prove a click (#2829). Dev-only deps; the lock was regenerated lock-only with the image's npm (node:26) so the diff is the two packages and their tree (57 entries, none with install scripts, `npm audit` unchanged at dev's one pre-existing low). npm 11 also drops a stale root `dependencies` line for `@rollup/rollup-linux-arm64-musl`, which package.json declares under `optionalDependencies` (it stays there). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * feat(workspace): theme switch (light / dark / system) at the top right of the central column (trinity-enterprise#625) The Workspace followed the global theme with no way to change it — its only control was the NavBar's appearance menu, and the Workspace has no NavBar. A platform user could not switch from the Workspace; an external client with no stored preference could not switch at all. - `components/portal/PortalThemeSwitch.vue`: trigger showing the RESOLVED theme (icon + "System · dark" / "Light" / "Dark"; icon-only below `sm`) over a popover; Esc + click-outside close, focus returns to the trigger. Reads and writes `useThemeStore` only — no auth/agents/clientPortal import — so a client session gets it. One store, one key: a choice here is what the platform UI shows next, and vice versa. - `components/base/ThemeChoice.vue` (+ `ThemeIcon.vue`): the ONE light/dark/system picker — `radiogroup` of `role="radio"` buttons with `aria-checked`, roving tabindex, arrow keys. The NavBar's inline raw-palette picker is replaced by it (its raw-colour entry shrinks 35 → 23 non-gray, re-frozen exactly and named in the baseline); the new files stay at zero. - `#header-end` slot at the tail of both column headers (`PortalConversation.vue`, `PortalRoom.vue`), filled by `views/Portal.vue` — new chat, thread, agent landing and room; the skeleton heads the branch chain and gets none. Only the root `dark` class flips and the slot carries no `:key`, so scroll, draft and thread survive a switch. - `utils/themeSwitch.js`: the decidable half, executed. - `tests/unit/portalThemeSwitch.spec.js`: the suite's first MOUNTED component test — renders "System · dark" from an empty store, three checked/unchecked radios, a click calls `setTheme('dark')`, writes `trinity-theme`, flips the root class, closes and re-labels; a NavBar choice is reflected. Mutations (click never reaches the store / label hides the resolved state / Esc ignored / aria-checked frozen) → red. Verified live in Chromium on a dev server: light, dark, `system` resolving honestly, icon-only at 390px with no collision, Enter opens, Tab lands on the checked radio, ArrowLeft selects. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * test(workspace): focus follows the arrow key in ThemeChoice; learnings: regenerate the lock with the image's npm (trinity-enterprise#625) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * fix(workspace): the theme menu claims the Escape that closes it (Abilityai/trinity-enterprise#625) merge-train finding. The popover closed on Escape from a bubble-phase `document` listener and never marked the event. The conversation's own `document` listener cancels an in-flight turn, or ends a live voice call, on any Escape nobody claimed, so closing the menu mid-turn also killed the turn. That is the #2582/#2598 class in learnings.md. The popover now follows the same protocol as PortalFilePreview and PortalRailFiles. It listens in the capture phase, returns early on `defaultPrevented`, and calls `preventDefault()` only while the menu is open. With the menu closed it claims nothing, so Escape still cancels. Tests: - A mounted test runs the conversation's real `shouldCancelOnEscape` and `shouldEndCallOnEscape` against the same keystroke, with the menu open (both false) and closed (both true). - A second test checks that an earlier owner's claim leaves the menu open. - The "choose dark" test now clears the `dark` class first. `system` already resolved dark in beforeEach, so the assertion used to hold before the click. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: sim <[email protected]>
…2487) * refactor(settings): routers/settings.py becomes a ten-module package (#1028) 3,529 lines — the largest file in the backend, 4.4x the 800-line critical threshold — split into ten domain modules composed onto ONE router, so the mounted API is byte-identical and `from routers.settings import router` is unchanged. Largest resulting module: credentials.py at 778 lines. Inclusion order is load-bearing (Invariant #4): `generic` owns the GET/PUT/DELETE /{key} catch-alls, which match any single segment, so it is included LAST — before its siblings it would swallow /ops/config, /brain-orb, /api-keys/anthropic and answer 'setting not found' for routes that exist. test_1028_settings_package.py pins: - the mounted route SET equals the pre-split module's, compared against the real blob out of git (60/60, none lost, none invented) - no route is shadowed by an earlier registration (the property that actually matters — literal order is deliberately NOT pinned, since regrouping specific routes relative to each other is inert) - the catch-all include stays last, named at the include line a human edits - every module stays under the 800-line threshold - the import surface callers depend on still resolves (resolve_mcp_url, the key sets, _REPO_PATTERN) Collaborators (db, platform_audit_service, settings_service) are deliberately NOT re-exported on the package __init__: ~20 tests patch them as module attributes, and after a move such a patch would apply cleanly to a module nobody reads — a test asserting nothing while hitting the real accessor. Absent attributes make every stale patch raise AttributeError instead, which is exactly how the 14 affected test files were found and repointed to the modules that own their handlers. GET '' (the root listing) is registered on the parent router because a prefix-less sub-router cannot carry an empty path (FastAPI refuses). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux * refactor(git): services/git_service.py becomes a six-module package (#1028) 2,322 lines split by responsibility — conflicts, gitignore, remotes, trinity_files, sync, provisioning — with the full public surface re-exported from the package __init__, so `from services.git_service import sync_to_github` and `git_service.<name>` callers are unchanged. Largest resulting module: gitignore.py at 649 lines. Cross-module calls go THROUGH the sibling module object (`gitignore._detect_git_dir(...)`), never a from-import of the function: a from-import freezes the binding, so a test patching the owning module would silently stop reaching the caller. Pinned structurally by test_1028_git_service_package.py, alongside the size threshold and the import surface. Private names are re-exported ONLY where another backend module imports them or a test reads them as data. A private function mirrored on both the package and its owning module can be monkeypatched on the wrong one and silently detach — which is exactly what happened to test_2069's readiness probes mid-split (the multiline setattr sites patched the package's re-exported copies while merge_gitignore_after_clone read the module's own), so the collaborator-shaped names are deliberately not mirrored: a stale patch raises AttributeError instead of testing nothing. ~15 test files repointed to the modules that own their handlers, including the three sys.modules-isolated file loaders and test_github_init_push, whose exec fake must now land on every module binding the driven function awaits through (provisioning + gitignore + remotes — patched via the loaded package instance, since its harness purges and reloads the package). The #2069 merge-caller guard now walks the whole package and matches qualified calls, so a caller cannot fall out of its census by moving between modules. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux * refactor(client): services/agent_client.py becomes a three-module package (#1028) 1,294 lines split by responsibility — circuit (the #631 transport breaker: constants, Lua, CircuitState, dormant alerting, admin read/reset), http_pool (the per-agent httpx pool + drop-grace stamps), client (AgentClient, typed errors, get_agent_client) — public surface re-exported from the package __init__, so every existing import is unchanged. Largest module: client.py at 698 lines. Same discipline as the git_service split, pinned by test_1028_agent_client_package.py: cross-module calls go through the sibling module object, collaborators are not mirrored on the package, and no module may from-import a sibling's function (a frozen binding silently detaches monkeypatches on the owning module). test_circuit_breaker.py's direct file-load gains package plumbing (submodule_search_locations + a sys.modules registration before exec — the __init__'s relative imports cannot resolve their parent otherwise), and its patches land on the owning modules. The #1677 caller-parity allowlist entry for _emit_dormant_alert follows the file to services/agent_client/circuit.py — that guard firing on the move is exactly what it is for. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux * refactor(ops,public): the heavyweight handlers move behind their routes (#1028) The last two ACs. `public_chat` — 289 lines of session identity, access gating, rate accounting, upload decoding, memory injection and dispatch, inside routers/public.py — moves to services/public_chat_service.py in the #1483 shape (service raises PublicChatError, the thin route maps it 1:1); client-IP extraction, the per-IP limit and token resolution stay router-side because they are HTTP concerns. agent_requires_email / agent_allows_open_access move with it and the router re-imports them — one definition, not a copy. public.py: 1,239 → 901 lines. routers/ops.py's five heavyweights — fleet health, the #1860 locked fleet restart, fleet stop, emergency stop, the cost rollup — move to services/fleet_ops_service.py (704) and services/ops_costs_service.py (208). The auth gates stay IN the router deliberately: the #2389 fence-vs-gate scans read live handler source there, and a gate that moved with the body would satisfy auth while blinding the scan. ops.py: 1,304 → 506 lines. test_1028_extracted_services.py pins the thinness, the gates' location, the size class — and an unresolved-module-scope-name walk, added because the move surfaced exactly that class twice: PublicChatResponse was unresolved in the chat service while 623 tests passed (nothing drives the sync-success return), and utc_now_iso the same in the costs service. py_compile cannot see this; the walk can. test_1860 / test_1917 fixtures now hand back the SERVICE module with the route entry points attached, so collaborator patches land on the bindings the moved bodies actually read while the gate patch stays on the router. The #894 override-wiring census follows public_chat's two execute_task call sites to their new file. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux * test(1028): repoint the settings source-guards at the package; satisfy the sys.modules lint Four guards read routers/settings.py as SOURCE TEXT (the ent#12 consent AuditEventType pin + generic-PUT block, the ent#434 catch-all window) and went FileNotFoundError when the module became a package — repointed at the package glob (or generic.py where the guard scopes a specific handler window). The new test files' own sys.modules registrations move onto monkeypatch.setitem / the _restore_sys_modules precedent, and the lint baseline is regenerated DOWNWARD (140 across 49 files — the patch migrations in the split commits removed ~66 stale entries). Related to #1028 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux * test(1028): the size guard counts blank lines out, comments in Self-review finding, and the more serious of the two: my previous commit changed the guard's METRIC so that my own edit would pass. That is the re-baselining this file exists to make hard, wearing a docstring as cover. Measured rather than argued. `credentials.py`: at 6d8c93a raw 778 non-blank 687 after raw 806 non-blank 687 (blank-line restoration only) non-blank-non-comment 643 Excluding blanks is exactly invariant under the change that prompted it. Excluding comments as well moves the calibration: these files carry 110-208 comment lines each, so a comment-blind count hands `credentials.py` ~160 lines of headroom the 800 ceiling never gave it, and `generic.py` 208. So the metric now excludes blank separators and nothing else. Restoring a PEP-8 blank line between two defs still does not read as a module growing, and the ceiling still means what it meant when these files were authored against it. Related to #1028 * test(1028): name the size metric for what it counts Re-review of my own fix. The metric was corrected to exclude blank lines only, and left named `_logical_lines` — which in Python means the opposite, since a logical line excludes comments. That is not a cosmetic mismatch. Reading the phrase "logical lines" in this test's docstring is precisely what talked the previous pass into excluding comments and re-baselining the guard by 160 lines. Leaving the name in place leaves the same trap armed, one identifier along, for the next reader who "corrects" the body to match it. `_non_blank_lines`, and the AC's docstring says "800 non-blank lines" in its own words rather than delegating the definition to a helper name. Related to #1028 * fix(1028): make the split's own safety nets actually run Addresses the `/validate-pr` CHANGES_REQUESTED on #2487. Every item is about a guard that is present and inert, which is why the refactor landed green. **C1 — the 60/60 route-set proof never ran in CI.** It read the pre-split module out of git, and every checkout in `backend-unit-test.yml` is `fetch-depth: 1`, so `git show dd91056:…` failed on every run and the test skipped — leaving "no route lost or invented" across a 3,529 → 10 module split proven nowhere. The fork-point set is now a frozen 60-tuple literal (a fork point is a historical fact, so freezing it costs no maintenance; a route added since goes in `_ADDED_SINCE_SPLIT`, one reviewed line at a time). The git read survives as a separate test that re-derives the literal wherever history is deep enough, so the transcription cannot drift. Its temp module is written under `tmp_path`, not `src/backend/` — an interrupted run there left a top-level module `Dockerfile:131` would bake into the image. **C2 — the integration suite broke at collection**, in FOUR files, not three: `test_monitoring_service.py` too. All of them `spec_from_file_location` on `services/agent_client.py`, which is now a package, so they raised FileNotFoundError before any test ran; this only stayed green because integration runs nightly rather than per-PR. Replaced with plain imports: the loaders existed to bypass `services/__init__.py`, and that has not been true since the module started importing `services.agent_auth` at import time (it is on `dev` too). Privates come from the module that owns them (`circuit._CIRCUIT_HASH_PREFIX`, `http_pool._client_pool`), per the package's own no-mirrored-collaborators rule, and the caplog assertions key on the parent logger name so they still capture from every submodule. Collection is back to 83 = `dev`'s 83. **Two invariant guards went blind on 3,529 lines.** `routers/settings/` is the first subdirectory ever created under `routers/`, and both `test_1310_auth_wiring.py` (Invariant #8) and `test_models_centralized.py` (Invariant #14) globbed one level deep — all ten modules escaped, and it fails open, so nothing showed. `rglob`, keyed by path relative to `routers/` so two packages cannot share an allowlist key (a top-level file's relative path is its bare name, so neither allowlist changes). 73 → 84 files scanned. **A dead constant with a live test guarding it.** `routers/public.py` still declared `MAX_CHAT_MESSAGES_PER_IP`/`_PER_TOKEN` while enforcement reads `public_chat_service`'s copy, so `test_ip_rate_limit_fix.py` was asserting a constant nothing enforces — equal values today, so only the guard had broken. Now re-exported from the enforcing module. **Split-detachment in `public.py`.** The two #311 gates were from-imported under private aliases while the service called its own module-locals: one function, two monkeypatch targets. Now called through the sibling module object, which is the rule both package `__init__` docstrings state; the two tests that patch or read it are repointed, and the `files.py` guard now bans both spellings so the retired alias cannot let a re-import through. Docs: `architecture.md` Invariant #1 gains the package paragraph (re-export the public surface only; reach siblings through the module object; guards use `rglob`), and the four stale `.py` references in the shards are corrected. Also: nine modules carried a duplicated module-level `logger`; and `fleet_ops_service` renames the fleet-restart log channel from `routers.ops`, which is now stated in the code rather than left for an operator to discover. Verified: unit suite 6269 passed, 1 failure — the pre-existing `::ffff:` IPv4-mapped parsing case (local 3.12 vs the repo's 3.13 target), byte-identical on clean `dev`. Related to #1028 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Bd71qsYbFodvofba8P69eP * refactor(1028): split gitignore.py three ways after the dev merge The dev merge brought #2529's ~715 lines into `services/git_service/gitignore.py`, taking it to 1305 raw lines — past the 800-line threshold this PR exists to enforce, and its own guard (`test_1028_git_service_package::test_every_module_is_under_the_critical_threshold`) said so. Re-baselining the guard under cover of a fix is precisely what the settings-test docstring in this PR warns against, so the module is split instead: gitignore.py 686 the patterns, the regions, the command builders gitignore_sweep.py 418 what a sweep DID — tags, parse, alert, report gitignore_clone.py 273 the once-per-agent merge after clone The seam is "what the file CONTAINS" vs "what did that just do" vs "the one-shot at creation". Cross-module references go through the module object (`gitignore.<name>`, `gitignore_sweep.<name>`), never a from-import: a from-import freezes the binding and a monkeypatch then lands on a detached copy — which is how test_2069's readiness probes went dark mid-split. Three real defects surfaced while wiring it and are fixed here, not carried: - `_gitignore_merge_semaphore` and `_inflight_gitignore_merge_tasks` were referenced bare in `gitignore_clone` with no such globals — a NameError on the live clone-time merge path. The five merge constants + the semaphore + the in-flight set now live in `gitignore_clone`, their sole consumer. - `_shadowed_negations` read `_GITIGNORE_MANAGED_LINES` bare after the move. It now reads it off `gitignore` through a deliberately function-local import — `gitignore` imports this module at its top level, so a module-level one would close the cycle at import time. - `datetime` was left behind by `_augment_commit_message`. The sibling suites are repointed at the module that OWNS each name, so every symbol still has exactly one monkeypatch target: test_2529's sweep names to `gitignore_sweep` (new `_sweep()` accessor beside `_gs()`), and test_2069's readiness/merge collaborators to `gitignore_clone`. 741 passed, 3 skipped across the git/gitignore/1028/1310/models families. Related to #1028 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Bd71qsYbFodvofba8P69eP * test: dev's post-fork tests reach the split modules the way every earlier one does (#1028) Five files landed on dev after the fork with patch targets and source reads on the monoliths. Re-pointed the same way the split re-pointed the rest: - test_ent582_platform_keys: `is_claude_auth_configured` / `connect_agents_to_first_credential` on `settings.credentials`, `platform_keys_service.check_resend_key` on `settings.provider_keys` - test_2695_stt_capability_probe: `_elevenlabs_settings_state_with_capability` on `settings.integrations` - test_2691_public_url_reachability: the save-path source read on `settings/generic.py`, the flag-surface read on `settings/flags.py`, `update_setting`/`db`/`platform_audit_service` on `generic` - test_github_init_push: the exec recorder also installed on `git_service.token_scrub`, which the ent#615 seed now runs through - routers/settings/generic.py: the #2572 hook reaches `credentials` through an absolute function-local import — `test_2216_backup_observability` and `test_2572` load this module in isolation via `spec_from_file_location`, where a module-level relative import raises at collection Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * test: dev's two new settings tests reach the split modules (#1028) `test_workspace_flag_retired` patches `settings_service`, `telemetry_sharing_service` and `db` on the module it calls `get_public_feature_flags` from, and `test_2696_stt_provider_errors` calls `_elevenlabs_settings_state_with_capability`. Both imported the flat `routers.settings`. Now they import the `flags` and `integrations` submodules, like the earlier re-points in 9c34662, so the patches land on the globals the handlers actually read. Full unit suite on this tree: 16468 passed, 32 skipped, 0 failed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * test: patch the modules that own the moved globals, and let #1917 follow the moved ops code (#1028) merge-train validation findings. Collection was fixed earlier; these are the runtime half. - `tests/integration/test_circuit_breaker.py`: 19 `monkeypatch.setattr(agent_client, ...)` calls and 34 `agent_client.CIRCUIT_*` reads now target `services.agent_client.circuit`, which reads its own globals. Patching the package re-export changed nothing, and `_get_circuit_redis` is not re-exported, so it raised AttributeError. Against a fakeredis server: 8 failed / 26 passed before, 34 passed after (dev: 34 passed). - `tests/git_sync/test_s5_conflict_classifier.py` loads `git_service/conflicts.py`, because the flat `git_service.py` no longer exists. - `tests/git_sync/test_s7_reserve_instance_id.py` patches `check_remote_branch_exists` and `db` on `git_service.provisioning`, where `reserve_and_generate_instance_id` looks them up. Both git_sync files: 33 passed. - `tests/unit/test_1917_stack_trace_exposure.py`: the raw `str(e)` ban now also scans `services/fleet_ops_service.py` and `services/ops_costs_service.py`, where the ops handler bodies moved. Neither file has any hits today. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: sim <[email protected]>
…nd a hardening guide that does not call a tunnel privacy (#2848) * fix(onboarding): plain-language first-run copy, one inline surface, and a hardening guide that does not call a tunnel privacy Three things a fresh DigitalOcean droplet walk surfaced. Copy. The secure step spoke to whoever built it: "whatever terminates TLS in front of it", "reach rather than address", and a TUNNEL_TOKEN in .env on a page whose own text conceded the reader cannot act on it from there. That is ent#581's AC 3 ("plain language, without security jargon") unmet. The mechanism is still named; the implementation is not, and the docs link carries it. The honesty guards all stay: no sentence asserts a property of a connection nothing here has inspected, and the two assertions that pinned the old jargon now pin the same claims in plainer words, each with a comment saying why it moved. The domain-reached copy also stops opening on what is left after a green Done, and the face copy drops to two short lines. One inline surface. ActivationChecklist was the last first-run card rendering in the dashboard flow, against AC 1 ("no first-run card renders inline"). It is removed, NOT folded into the overlay: its four milestones are observed from DB state during use and cannot be true while a blocking setup overlay is up, so the AC's "absorbs" wording never fitted this one surface. The enterprise _activation.py milestones now have no surface -- tracked on ent#238. Restore with: git checkout a5ac3cf -- src/frontend/src/components/onboarding/ActivationChecklist.vue Hardening guide. It presented a Cloudflare Tunnel and a private network as equivalent postures differing only in integrations, then told most readers to pick the tunnel. Its own table says a tunnel leaves the web UI reachable by anyone with the address, so that is not privacy -- it is closed ports and no exposed origin. The guide now says so, and adds Step 2c: an identity gate in front of the tunnel, which is what actually delivers working callbacks plus a UI that does not answer strangers. Step 2c is honest about the cost: a bypass list per inbound integration, failing quietly in both directions. The exposure sentence stops rebutting a belief the reader never held. Raw-color baseline: the deleted component's entry removed. Not regenerated wholesale -- that would have newly blessed two hardcoded colours in CanvasDocument.vue that predate this change. Refs #2691, #2692, trinity-enterprise#581 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(deploy): the tunnel and a private network compose — stop presenting them as a fork The Step 2 table offered two columns and put five Broken cells in one of them. Nobody reads that and picks the private network, so Step 2b was dead copy: carefully written, unreachable, and the table two inches above decided for the reader. It was also a false fork. Every Broken cell is true only of Tailscale ALONE. Run cloudflared and tailscaled on the same droplet, publish only the paths third parties call, and leave the admin UI off the tunnel: the callbacks arrive over Cloudflare, the UI answers your devices only, and nothing listens on the public interface. That needs no Trinity change — public-access.md has carried the path-split table all along. The table is now three postures, tunnel-only and tailnet-only and both, with both named as the one to aim at. Step 2c is rebuilt around that composition rather than around Cloudflare Access; Access stays as the secondary option for anyone who wants the UI public but gated. Two specifics found on the way: public-access.md's narrow ruleset is introduced as "publish only the webhook surface rather than the whole UI" and its last row is a `/` catch-all to the frontend — which publishes the whole UI. Anyone following it believed they had narrowed the surface and had not. The row is replaced by a note saying what adding it back costs, and by the observation that this list fails in the SAFE direction: a missing entry breaks one integration loudly, where the inverted port list in docker-firewall.sh failed open and shipped 8081 serving plain HTTP. Telegram's Broken is ours. Trinity calls setWebhook and nothing else — zero hits for getUpdates across src/ and docker/ — so Telegram's servers have to reach the instance. The Bot API's long polling is outbound and would survive a tailnet exactly as Slack's Socket Mode already does. Stated as our gap where it was implied to be Telegram's, and filed as #2849. Refs #2692, #2849 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(deploy): cut the sentences that argue with an earlier draft Copy that only parses if you know what the page used to say: "together, not instead of each other", "not two options to pick between", "the wrong column to read as a verdict", "reached the long way", "fails in the safe direction", "needs no Trinity change". A reader arriving cold has no earlier draft to compare against, so each of these spends a sentence on a position they never held -- the same defect as the exposure line in What You Start With. Each one is now either a statement of what happens to the reader or gone. Step 2 states the three outcomes and who should pick which; Step 2c is the two actions plus the one thing to keep up to date; the public-access note says what to add and what breaks if you forget. Refs #2692 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(onboarding): the domain save says what it did Pressing Save emptied the field and changed a badge. That was the whole feedback for an action that stores a setting AND re-registers every live Telegram webhook and rewrites every WhatsApp binding URL. Walked on a fresh instance, it reads as though nothing happened. A confirmation now names the value and, in the same breath, the part that is still unknown: Saved. Nothing has reached <url> yet — open it in a browser to confirm it works. Two different facts on purpose. The write succeeded; whether the name reaches this server has not been established and cannot be from here. The second is what an operator would otherwise assume the opposite of, and assuming it is how a typo'd domain sits broken while Settings reads fine. Deliberately NOT validation. A DNS check at save time would compare the name against this server's address and reject every domain behind a Cloudflare Tunnel, a load balancer or a reserved IP — the tunnel resolves to Cloudflare by design, and that is the configuration the hardening guide recommends. There is no reliable answer available at save time; the only proof is a request arriving, which is what flips the posture to reached. So this is not a claim the domain works. `postureCopy` owns that claim and still makes it only once a request has landed. `role="status"` so it is announced rather than only seen. Semantic tokens (`status-success-*`), so the raw-colour ratchet stays at zero for this file. Refs #2691 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(marketplace): the first submission cannot use the tooling the runbook pointed at The runbook offered the Vendor Portal and a TRINITY_DO_APP_ID build as two ways to do the same thing. They are not interchangeable. The portal's listing form has a required System Image field that picks from the snapshots already on the account, so a listing is built AROUND a snapshot and its app_id only exists once the listing does, read from its URL. There is no app_id to supply before the first submission, so mp-submit.sh cannot make it -- the one route someone would reach for first is the one that does not work yet. Split into First submission and Later releases, which is the real shape. Also recorded: submitting CONSUMES the snapshot. The picker says so -- "the selected snapshot will no longer be available once the listing is submitted" -- and the runbook implied the opposite by having you keep using it. Build one for the submission rather than spending the snapshot you still boot droplets from. Nothing about the built image changes between the two routes. TRINITY_DO_APP_ID is read by an optional post-processor after the build; unset, the build does not submit, and the image carries no listing identifier either way. Stated explicitly because the field name invites the opposite assumption. The submission gate is restated rather than dropped. Its substance was always "a human boots it and uses it before anything is submitted", which img_check cannot do; the second-pair-of-eyes part is a preference that a team of one cannot meet. Written as the preference it is, with the reduction in cover named, so the file stops asserting a process nobody is running. Refs #2281 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(onboarding): the review's decision-independent findings From vybe's review on #2848. Four items that hold whichever way the ActivationChecklist question goes; the contingent ones wait for it. DOMAIN_PREREQUISITE ended "The guide below shows how." That string renders on BOTH the first-run step and Settings.vue:372, where nothing follows it. A pointer that resolves on one surface and dangles on the other is exactly the drift the shared constant exists to prevent, and I introduced it while shortening the copy. The pointer is gone; the sentence stands alone on both. FirstRunOverlay.vue named the private `_activation.py` in public source. The comment now describes the loss without naming where the code lives. The save confirmation had no test. It has one, asserting the element, the `role="status"`, and the ordering that makes the message truthful: the value is remembered AFTER the write resolves and BEFORE the field clears. It also asserts the message never claims the domain works -- `postureCopy` owns that claim and waits for a request to arrive. That test failed on its first run and was right to. An earlier edit meant to reset `savedUrl` at the start of each attempt never applied -- an indentation mismatch, silently a no-op -- so a save that failed after one that succeeded showed the error beside a stale confirmation. Fixed, and now pinned. Still open, and not mine to settle: whether ActivationChecklist goes. The review is right that ent#238 is CLOSED, so "tracked on ent#238" tracked nothing -- said in the commit, the PR body and my ent#581 comment. The docs drift, the dead store and the deleted-files list all follow from that decision and are held until it is made. Refs #2691 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Revert "remove ActivationChecklist from the dashboard" — ruling B The product owner ruled the checklist stays, and corrected the premise I argued from. I read ent#581's AC bullet and the merged #2715 code as two contradictory calls. They are not: the AC bullet is the earlier text, and ent#581's design comment of 2026-09-10 — later, specific, operator-reviewed — already says ActivationChecklist "stays inline", "deliberately not absorbed", with the same reasoning I then re-derived independently. #2715 implemented that faithfully. Only the AC bullet's verb was stale, and amending it is gated on Eugene, not on this PR. AC 1 does not force removal either. Its target was the ladder of stacked setup cards, which is gone regardless; a self-retiring ambient marker that renders only when entitled and hides on completion is not a first-run card. Restored to the state on dev: the component, the Dashboard import and render, the firstRunSteps.spec.js expectations and the raw-color baseline entry. FirstRunOverlay.vue's header comment goes back to naming the checklist as deliberately inline — which also removes the private-path reference I had introduced, since the sentence needing it is gone. One correction to my own cost framing, in the ruling's favour: no data was ever at risk. db/product_events.py derives first-value events on read from audit_log and agent_activities and never emits them, so the milestones live server-side whatever the frontend does. The loss would have been the surface, not the record. The hardening-guide, public-access, packer README and StepSecure work in this PR is unaffected and ships as it stands. Refs #2691, trinity-enterprise#581, trinity-enterprise#238 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
… launcher (#2854) * feat(onboarding): the getting-started checklist moves behind a header launcher The checklist stays (ruling on ent#581) and its content is untouched. This changes only where it lives, and removes the layout shift rather than timing around it. Inline, the card could not appear without pushing the fleet grid down ~150px. ActivationChecklist fetches in its own onMounted and renders under `v-if="store.visible"`, so the answer deciding whether a card exists arrives one round-trip AFTER the dashboard paints. Neither remedy offered works on its own: gating on overlay-complete moves when it pops, not that it pops, and reserving space unconditionally leaves a permanent gap on every unentitled build, where the endpoint 404s and no card is ever coming. Behind a launcher the question does not arise. The pill sits in the header's controls row, a fixed-height flex line, so a late answer changes nothing below it — stability by construction rather than by timing (contract p.4/6). When the module is unentitled, dismissed or complete, nothing renders and the absence costs no space. A popover, not a modal. ent#238's principle is that this is ambient: never a mandatory tour, dismissible, gating nothing, retiring itself on the last milestone. A blocking dialog would make it the tour it must not be. It follows the Tags dropdown's pattern — right-aligned, click-outside, Escape — so the two read as one family of header controls rather than a new idiom. The meter carries the state when the words are gone: four dots, filled to `completedCount`, so the collapsed control still says how far along you are. The trigger is labelled for screen readers with the same count. Two events close the panel, both cases where leaving it open is wrong: a dismissal retires the control the panel is anchored to, and following an item's action navigates away underneath it. Honest limits: the endpoint 404s on this local stack and on the rc3 droplet, and published images are built without the enterprise submodule, so this could not be rendered before committing. It has no mount test either — vitest runs `environment: node` with no harness (the ent#392 constraint), so the spec pins placement textually: the checklist is no longer in Dashboard.vue at all, and the launcher sits ahead of the Tags dropdown and above the stage. Refs trinity-enterprise#238, trinity-enterprise#581 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(onboarding): the X means "not now"; retiring the checklist says so The X on the card called `store.dismiss()` — permanent, per-user, persisted server-side, and unrecoverable: nothing in the store or the UI restores a dismissed checklist. So the most innocuous-looking control on the panel was its most destructive one, and a user who meant "later" got "never" with no way back. Two controls now, and they mean different things: X closes the panel. The checklist returns next load. Don't show this again dismisses it for good, and says so. The X keeps the position and the affordance people expect of it; the permanent action is a labelled text button in its own footer row, quiet by default because it is the exit rather than the thing the card is asking for. Its title states the consequence, since there is no undo to fall back on. Both emit `close`, so the launcher's popover shuts either way — the distinction is whether `dismiss()` was called, not what the panel does afterwards. Following an item's action still closes it too. Refs trinity-enterprise#238 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(frontend): re-freeze the raw-colour baseline for ActivationChecklist Its own commit, as the ratchet asks. The dismiss footer added six GRAY classes (a border pair and four text states) to a file that was already at 16: raw_gray 16 -> 22, raw_nongray still 0, hardcoded still 0. Only that entry is touched. A wholesale regeneration would also have blessed two hardcoded colours in CanvasDocument.vue that predate this work, which is the quiet way a ratchet stops biting. Refs #2605 * feat(dashboard): the systems rail opens expanded, and carries getting started vybe's call: expand the left rail by default, labelled, and put the checklist there — rather than the header pill the previous commit added. The rail defaulted to collapsed, so a first-time visitor met a 48px strip of unlabelled glyphs: the systems it lists were unreadable, and anything added below them would have been too. It now opens expanded. A saved preference still wins; only the first-visit default moved. The checklist becomes a row in that rail, in the footer above New View. Same reasoning as the header pill it replaces — the entitlement answer lands a round-trip after paint, and in a fixed-width column that adds a row to a scrolling list instead of pushing the fleet grid down ~150px — but it reads as what it is: an item in a menu, beside the other places you can go. The meter takes the icon slot the view rows use, so a collapsed rail still shows progress rather than going mute, and the title carries the count. The panel opens to the RIGHT of the rail, not below it. The rail is 224px and the card is 304px, so downward would either clip or force a second, narrower rendering of a card that already exists. Refs trinity-enterprise#238, trinity-enterprise#581 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(frontend): re-freeze the raw-colour baseline for SystemViewsSidebar Its own commit, as the ratchet asks. The getting-started row added two GRAY classes (a border pair on its divider): raw_gray 29 -> 31, raw_nongray still 16, hardcoded still 0. Only that entry is touched. Refs #2605 * fix(dashboard): rail collapsed by default again, and the divider belongs to the row e2e went red on this branch — `dashboard-list-view` and `agent-detail-request-dedupe` — while `fix/2691-first-run-copy` and two other branches passed the same suite today, one of them after this run. So it is this branch, and the only change here that affects anything outside the rail is opening it by default: that takes 176px from every dashboard pane, and the list view's desktop layout is an eleven-column grid that only just fits at 1280. The dedupe failure fits the same shape — a narrower pane mounting a second, width-conditional copy of a component that fetches. Reverting the default isolates that instead of assuming it. The rail's getting-started row is unaffected either way, so if CI comes back green the conclusion is that the list view has to survive a 1056px pane before the rail can open by default — which is its own change, in its own PR, not a rider on this one. Not reproducible locally: this stack fails the same specs on clean dev, because it has no seeded `trinity-system` agent, so it cannot act as a control. CI is the only instrument that distinguishes them here. Also: the divider was rendering unconditionally. On every unentitled install that is a separator and its padding around a launcher that renders nothing. It is now gated on the same visibility the row is. The placement spec no longer asserts the rail's default — widening the rail is a dashboard-layout question, and that test is about where the checklist lives. Refs trinity-enterprise#238 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(dashboard): the checklist lives in the systems rail, under the view labels The checklist renders inline in the rail instead of behind a launcher row and popover. It sits after the last view row, inside the same scrolling list, so it stays under the labels however many there are, and it is not mounted while the rail is collapsed — it goes away with the labels. Its header is a disclosure: expanded on first start, collapse remembered per browser (`trinity-checklist-expanded`). That replaces the X as the "not now" control; "Don't show this again" still retires it for good. The next step's action sits under its title, since the rail is too narrow for both on a line. The rail opens expanded by default again (vybe's call), reversing the previous commit's revert: collapsed by default, the checklist is invisible on first load. The known cost stands — an open rail takes 176px from every dashboard pane, and `dashboard-list-view` / `agent-detail-request-dedupe` e2e went red the last time it was open by default. The placement spec asserts the default again, since the checklist's first-load visibility now depends on it. The divider moves inside the checklist's own root, so it is gated on the same `store.visible` as the content and never renders on an unentitled install. ActivationLauncher.vue is removed — nothing mounts it any more. The raw-colour baseline entries for the two touched components are lowered to their new counts (SystemViewsSidebar 31 -> 29 gray, ActivationChecklist 22 -> 17 gray). Refs trinity-enterprise#238 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * test(e2e): run the list-view smoke test at 1440 With the systems rail open by default, a 1280 viewport leaves the lg row grid's name track too narrow to show the system agent's name link, so `dashboard-list-view` failed on its visibility assertion. Test-only change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(dashboard): the list's desktop grid switches on its own width, so the rail can open on first launch The systems rail opens expanded by default (bb8cab7). At a 1280 window that leaves the list 992px wide, but the desktop grid's non-name tracks need about 920px. The `1fr` name track fell to ~72px, and the system agent's name shrank to 10px behind its SYSTEM badge. That is the `dashboard-list-view` e2e failure. Running that test at 1440 (5938056) turned CI green but left the list broken for real 1280 screens. It also only passed because CI has two agents: on a ten-agent stack, 1440 with the rail open still squeezed names. The desktop grid now switches on the LIST's width via a `list-wide:` container-query variant (tailwind.config.js, 68rem on the `agent-list` container wrapping the grid), instead of the viewport `lg:`. Below 68rem the existing tablet layout renders. Measured in Chromium against a live stack: | window | rail | layout | name track / link | |---|---|---|---| | 1280 | open | tablet | full name, 95px link | | 1280 | collapsed | grid | 248px | | 1440 | open | grid | 232px | | 900 | open | tablet | full name | | 600 | open | mobile | full name | - The tablet block uses a stacked `md:list-wide:hidden`. Tailwind 3 emits screen variants after custom ones, so a bare `list-wide:hidden` loses to `md:flex`. The tablet block then sat in the desktop row as an extra subgrid item and widened track 1 to 630px (first cut, caught in the browser). - The query container is a wrapper around the grid, not the panel root, so the root's fixed-position toast is unaffected by containment. - 68rem rather than 72rem: 1440 with the rail open leaves 1152px, which must still get the grid even with a classic scrollbar. Tests: - `dashboard-list-view` smoke test runs at the 1280 default again, asserting on the visible name link. The row carries one link per layout. - The #2358 alignment and meter tests seed the rail collapsed, since they measure the desktop grid. - `schedules-toggle-scroll` clicks the visible name link. - `agentName.spec.js` follows the `lg:` to `list-wide:` rename and pins the mechanism: the variant definition, the container on the grid's parent, no viewport `lg:` left in the list, and the stacked tablet class. Verified: frontend unit suite 3074/3074, and `dashboard-list-view` e2e 11/11 against a live stack, including the four label-borrowing tests CI skips. Other dashboard e2e specs pass, except three `@interactive` stats-overflow checks at 640px. Those fail with the rail collapsed too (the enterprise Tags button overlaps the agent count), so they predate this change. Refs Abilityai/trinity-enterprise#238 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Eugene Vyborov <[email protected]> Co-authored-by: sim <[email protected]>
Bumps VERSION to 0.9.5-rc4 and points scripts/deploy/trinity-do-create.sh's default TRINITY_IMAGE_TAG at v0.9.5-rc4 (tied to VERSION by test_2380_installer_release_pin), so the v0.9.5-rc4 tag can be cut off dev for the DigitalOcean Marketplace snapshot.
…ilures in test_ent615 (0.9.5 M1) (#2861) * fix(tests): evict the whole git_service package family, not just its parent — 13 leaked failures in test_ent615 (0.9.5 M1) #2487 made `services.git_service` a package. Three test helpers still did `sys.modules.pop("services.git_service")` before re-importing it with stubbed deps. Evicting only the parent leaves `services.git_service.<sub>` cached, and Python's import re-binds a cached submodule onto a NEW parent only on first load — so the re-imported package had no `.token_scrub` / `.conflicts` attribute, and every later `git_service.<sub>` read in test_ent615_token_free_remotes.py failed with `AttributeError: module 'services.git_service' has no attribute 'token_scrub'` (13 failures on dev; the file passes alone). Evict the family (the shape test_reset_preserve_state_guardrails.py already uses) in test_1704_git_service_plugins, test_data_paths_allowlist and test_data_paths_gitignore, and make 1704's autouse restore family-aware for the same reason. Reproduced: `pytest unit/test_data_paths_allowlist.py unit/test_ent615_token_free_remotes.py` → 13 failed; after: 118 passed in both orders. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(tests): the fourth polluter + a named regression guard for #2859 #2859 names four files; the first commit covered three. test_2075_detect_git_dir.py swept the family but recorded only the package key for undo, so the submodules its own re-import CREATED outlived monkeypatch's teardown — same half-state, same 13 failures. It now carries the lint_sys_modules.py-sanctioned pair (_STUBBED_MODULE_NAMES + an autouse _restore_sys_modules) restoring the whole family; the two data_paths files get the same family-aware restore as 1704 (their parent-only restore fixture was a second leak behind the pop). tests/unit/test_2859_git_service_eviction.py: (1) the mechanism on a throwaway package — parent-only eviction loses the submodule attribute, family eviction rebinds it; (2) an AST guard over tests/unit that fails on `sys.modules.pop("services.git_service")`, `del sys.modules["services.git_service"]` or `monkeypatch.delitem(sys.modules, "services.git_service")` outside the family shape (self-tested on the exact lines the polluters carried; proven red by reintroducing the pop on a copy). Issue's repro table (-p no:randomly, each file then ent615): 102 / 101 / 93 / 101 passed, 0 failed. lint_sys_modules.py: no new violations. Fixes #2859 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…first boot serves again (#2862) * fix(onboarding): the getting-started checklist updates without a reload The store fetched the checklist once per page load, so a milestone reached mid-session (creating an agent from the dashboard, or chatting, scheduling or connecting a channel on another page) stayed unticked until a browser refresh. Re-read on every mount, so returning to the dashboard picks up milestones reached elsewhere, and whenever the agent count changes, since agents are created and deleted from the dashboard itself. Refs Abilityai/trinity-enterprise#238 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(deploy): make the rendered Caddyfile readable by the caddy user The 1-Click first boot runs start.sh under `umask 077`. Since the Caddyfile is rendered to Caddyfile.new and moved into place, the new file came out 0600 root, the `caddy` service user could not read it, the restart failed, and provisioning stopped before Trinity started: a droplet created from the v0.9.5-rc4 snapshot never served HTTPS. Overwriting in place had kept the package's 0644, so rc3 booted. chmod 0644 before the move (the file holds no secrets). The new test runs provision_caddyfile under umask 077 and asserts the installed mode. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore: set version to 0.9.5-rc5 Bumps VERSION to 0.9.5-rc5 and points trinity-do-create.sh's default TRINITY_IMAGE_TAG at v0.9.5-rc5 (tied to VERSION by test_2380_installer_release_pin), so the v0.9.5-rc5 tag can be cut off dev with the Caddyfile permission fix for the DigitalOcean Marketplace snapshot. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(onboarding): don't re-ask an absent checklist surface on every forced read The checklist now forces a read on every mount, sidebar expand and fleet-size change. On OSS (404) and unentitled (403) builds that turned one swallowed request per session into one per event, each with a console 404, for a card that never renders. A 404/403 now marks the surface absent for the session; a genuine failure (5xx) stays retryable. Addresses review finding I1 on #2862. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Revert "chore: set version to 0.9.5-rc5" The rc5 bump moves to its own chore PR, as #2838 did for rc4, so this fix can merge on its own and the bump is not coupled to it. Review finding I1 on #2862: the bump must not land ahead of #2861 while dev is red. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore: set version to 0.9.5-rc5 (restored) Reverts the split in ea0649a. Agreed with the reviewer to keep the rc5 bump here and merge in order instead: #2861 (green dev) first, then this PR, then tag v0.9.5-rc5. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…tch on its own paid wake-ups (0.9.5 M3, ent#329) (#2860) An agent-scoped MCP key resolves to its OWNER on REST, so `OwnedAgentByName` alone was satisfied by the agent's own injected key: a (prompt-injected) agent could enable the respond→resume opt-in whose whole point is "each answer may now spend the owner's money". Add `reject_agent_principal` as the first statement (grant-vs-use line: the GET stays agent-reachable). Test pins the guard by source and at runtime — 403 with the human-only detail before the DB write or the audit write — and that a JWT owner still flips it. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…e 0.9.5 cut (F1) (#2863) * fix(mcp): fence get_agent_assignments — built, not registered, for the 0.9.5 cut (work-order F1, ent#500) The assignments layer is not shipping in 0.9.5, so the MCP tool that reads it must not be advertised. `server.ts` no longer imports/registers `createAssignmentTools`; `access.ts` drops the policy row (the ent#628 totality test forbids a row for an unregistered tool); `tool-visibility.test.ts` pins the ABSENCE of the registration instead of its presence. `tools/assignments.ts` and `assignments.test.ts` stay — re-enabling is one import + one line + the row. Docs rows (architecture, user-docs, feature-flow) say "fenced". MCP suite: 409/409; `tsc --noEmit` clean. Related to Abilityai/trinity-enterprise#500 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * test(2638): pin the fallback's ambient reads in test_it_never_raises `fallback_to_api_key` fails OPEN on a raising settings read, so the test kept running past its mocked `db` into two call-time reads it never stubbed: the agent container and the platform API key. Whatever the pytest process held decided the outcome — on CI under one randomly order a key leaked in from an earlier test, the fallback ran for real, and the `is None` assertion failed on a PR that touched only the MCP server (regression-diff job on #2863). Reproduced locally with ANTHROPIC_API_KEY set: identical assertion message. Stub both reads so the assertion states its actual premise — no key ⇒ nothing to fall back onto ⇒ None, and no exception. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * merge-train: test titles match the fenced block, user-doc tool count 129 (F1) — mechanical /review I1: the ent#500 describe/it names said the tool is advertised to operator scopes; those cases exercise the operatorOnly gate, and the block now pins that the tool is NOT registered. /review I2: the booted server registers 129 tools (124 operator) with inline login on; the user doc said 130/125. The architecture doc already reads 129. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: sim <[email protected]>
….0 too (#2419) (#2864) * fix(subscriptions): read the utilization header as a fraction, past 1.0 too (#2419) The provider's anthropic-ratelimit-unified-{5h,7d}-utilization header is a fraction of the cap. _parse_utilization multiplied by 100 only up to 1.0 and passed anything larger through as an "already-percent" value, so an overage reading of 1.2 came out as 1.2%: the ent#434 weekly alert filed an exhausted subscription as has_headroom and the #2409 ranker rated it the best destination. The parser now always scales, matching the provider's own client; non-finite or negative results are None (the guard sits on the scaled value, since a finite 1e307 overflows only after the multiply), and -0.0 is normalised. A window reading past 100% logs the raw header strings at INFO, the capture path for the first real overage sample. Residuals: cached Redis snapshots self-heal within one refresh interval; pre-fix history rows cannot be repaired (1.2 from "0.012" and from "1.2" are identical); the first post-deploy sweep may raise critical items for every overage subscription; a negative reading now classifies as unassessable rather than has_headroom. Fixes #2419 Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(security): the #2419 diff audit's appendix item now cites its follow-up, #2865 Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
…e that slides up, for every live run; the chat scrolls to the card on your own send (Abilityai/trinity-enterprise#620) (#2844) * feat(workspace): the Work card says what the agent is doing — one line that slides up, for every live run; the chat scrolls to the card on your own send (trinity-enterprise#620) The card's "current step" slot was blank: its handler matched `evt.type === 'tool_use'`, a shape the raw stream-json frames never carry, so only the backend-injected `error` ever labelled — and no run but the chat's own turn had a live path at all. One vocabulary, two feeds: - `utils/workActivity.js` composes the line from `{tool, summary}` — "Reading .../x.py", "Running pytest …", "Searching for …", "Fetching …", "Using <server>", "Delegating to <agent>: …", "Thinking". The Chat tab (`execution-status.js`) and Agent Detail (`useSessionActivity`) compose from it too. The stream path parses the real frame shape and summarises the input with a port of the agent's `get_input_summary`, held to parity by `tests/fixtures/tool_input_summary.json` (pytest + vitest). - The agent server keys its active tool PER EXECUTION (`session_activity.by_execution`, threaded through both live parse sites and the Codex parser) and the 5 s heartbeat carries a bounded `executions[]` for the registry's running set — a finished run leaves by construction. `HeartbeatPayload` bounds it (≤20, summary ≤120, tool ≤64, id shape, extra keys refused). `heartbeat_service.read_execution_activity` keys it; the Work read folds it onto live, non-stale rows of rostered agents as `WorkItem.activity` through the title sanitiser + roster mask, dropping a line older than 30 s; `GET …/work/activity` (Redis only, same gates) is polled every 2.5 s while a card is live. - `PortalWorkCard` reserves one `h-4 overflow-hidden` row for the live life; a keyed slide-up `<Transition>` (a swap under reduced motion); `createActivityLineQueue` holds ≥700 ms, collapses a burst, never re-keys an identical line, keeps the last line on a quiet run, clears at terminal. The Work tab's Now rows and the room's cards receive the line too. - A person's own send re-pins the transcript once the card mounts, guarded by `following` (#2624). Mutations (all red): stream parser on the old shape, queue without the minimum, identical line re-keyed, stale line kept, summariser drift; fold onto stale rows, no roster mask, age ceiling ignored. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * fix(agent-server): the heartbeat prunes activity slots against every running execution, not the capped slice (trinity-enterprise#620 /review C1); drop the dead Sync branch A 21st concurrent execution is still alive; forgetting its slot on every beat reset it to "Thinking" for as long as the fleet stayed that busy. The wire stays bounded at ACTIVITY_MAX_EXECUTIONS; the prune set is the registry's whole running set. Pinned by test_a_run_past_the_cap_keeps_its_slot (mutation: prune from the slice → red). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * ci: TEMPORARY diagnostic — verbose per-test output + thread timeout to name the shard that hangs on this branch (revert before merge) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * Revert "ci: TEMPORARY diagnostic — verbose per-test output + thread timeout to name the shard that hangs on this branch (revert before merge)" This reverts commit 125df89. * fix(tests): stop a unit test from SIGKILLing the CI runner and the dev desktop (trinity-enterprise#620) The #620 heartbeat work added test_ent620_agent_activity.py, which evicts the whole `agent_server` package from sys.modules at module level, unconditionally. Collected after test_drain_bounded.py, that re-registers the package under a fresh module object, so the drain test's dotted-string monkeypatches (`monkeypatch.setattr("agent_server.services.subprocess_lifecycle...", ...)`) land on the wrong copy. The REAL `_drain_bounded` then runs with a MagicMock process (pid=99999): `terminate_process_group` + the cgroup orphan sweep SIGKILL whatever real process group that pid resolves to and everything in the host's root cgroup. That took the CI runner down on every pytest shard ("The runner has received a shutdown signal") and a developer's whole desktop session twice in one afternoon (`[email protected]: code=killed, status=9/KILL`). The #728 class, third occurrence. Four independent layers, so this cannot ship again: 1. Production fence (docker/base-image/.../orphan_sweep.py): `kill_cgroup_orphans` refuses to sweep unless the `cgroup.procs` it read lists PID 1 — true inside an agent container (cgroupns=private, verified live), never true of a host/runner root cgroup or a cgroupns=host agent. Fail-safe: leak an orphan rather than kill the host, logged. 2. Test signal guard (tests/signal_guard.py, installed for the whole unit suite in tests/unit/conftest.py): wraps os.kill/os.killpg — one module, no package copy can bypass it — and refuses any signal to the session's own group/ancestors or to a process outside the session's cgroup, recording it so the autouse fixture fails the test even when the caller swallows the exception (the production drain catches Exception). Cgroup membership, not parent chain, so a test's own setsid-reparented child is still recognised as ours. 3. test_drain_bounded.py patches through `_drain_bounded.__globals__` (the one dict the bound function reads regardless of how many copies exist) instead of dotted strings, and stubs `_terminate_process_group` for every test. 4. Lint (tests/lint_sys_modules.py): an unguarded module-level `for ... in list(sys.modules): ... pop` registry-scan eviction is now a hard failure, never baselined. The five files that legitimately evict `agent_server` (heartbeat, auto_sync, git_maintenance, 2742, ent620_agent_activity) are converted to the path-guarded form (test_git_status_dual_ahead_behind.py precedent). Verified: the full local unit suite (16503 passed) and the previously-lethal subprocess/drain/orphan set under xdist × three CI seeds now run on the host with zero signal refusals and the session intact. New tests test_2845_orphan_sweep_host_fence.py and test_2845_signal_guard.py pin the fence and the guard. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * docs(learnings): the unguarded sys.modules eviction that SIGKILLs the runner and the desktop (trinity-enterprise#620) Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01VpvcfgWkmQPD7DrDLmATTf * merge-train: skip the signal-guard tests where the guard is not installed (Abilityai/trinity-enterprise#620) — mechanical Where /proc cgroup is unreadable (macOS) install() returns False and the real os.kill/os.killpg stay in place, so test_our_own_process_group_is_refused SIGTERMed the session's own process group (pytest, xdist, the shell). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * merge-train: cut the heartbeat tool name to the backend's 64-char ceiling (Abilityai/trinity-enterprise#620) — mechanical HeartbeatExecutionActivity.tool has max_length=64 but the agent never bounded it (codex MCP names are server.tool, Task:<type> comes from the model); one over-long name 422'd every beat and read as a lost heartbeat. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: sim <[email protected]>
…2807) (#2855) Every access gate on the MCP tool surface RETURNS its denial as JSON (the envelope agents parse), and the audit wrapper labelled a call by throw/no-throw. So a refused chat_with_agent / chat_with_<slug> / fan_out / run_agent_loop call left an mcp_operation row reading `success: true`, and an operator reading the audit log could not tell a permitted call from a refused one. Reproduced live before the fix: the refused call's row was {"tool": "chat_with_agent", "duration_ms": 32, "success": true}. The deny sites now serialise through one helper, access.ts::accessDenied, which stamps `context.outcome = {kind: "denied", reason}` on the per-call tool context (the seam #905 already uses for requestId); withAudit reads it after execute and writes `success: false`, `denied: true`, `error: <reason>`. A thrown backend 403 is marked denied too. The caller's JSON is byte-identical. All 29 deny branches across 10 tool modules go through the helper, and a decision-based guard fails `npm test` for a `!allowed` branch or an `error: "Access denied"` envelope that bypasses it. createServer injects the audit URL and secret (configureAudit), so a test can observe the row. Tests: audit-denial.test.ts (captured audit POST, byte-identical envelopes, root-context-only stamp, stamp-then-throw, thrown 403, the guard); access-wiring.test.ts records /api/internal/audit over the real transport and runs deny-then-allow on one session; the J10 strict xfail test_the_operator_can_see_that_a_call_was_refused is flipped. Fixes #2807 Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: sim <[email protected]>
…New + DigitalOcean install guide (#2869) * docs(user-docs): sync with dev since the 09-15 review — Workspace work line and room stop, token-free git remotes, fan-out async mode, DigitalOcean install guide, 0.9.5 What's New Covers the 38 commits merged to dev after the last full review (dbc9698), plus the 0.9.5 user-facing release page. Documented: - Workspace: the Work card's one-line activity status and scroll-to-card on send, the theme switch, cross-tab sign-in sync, a Dictation section (the mic shows only when speech-to-text can work; failures name their cause), room turns can be stopped, and 1:1 attachments travel with an @mention. - GitHub: git asks a credential helper, so the token is out of remote URLs, .git/config and process listings (the agent can still read GITHUB_PAT); upgrade section + runbook link; sync-health polling takes no index lock and SYNC_HEALTH_POLL_INTERVAL_SECONDS; comma-separated allowed-tools. - MCP / automation: fan-out async_mode, and the batch deadline bounds the wait rather than the tasks; loop tools check the agent permission edge; refused calls are audited as refusals; unknown model ids get 422; wake-on-answer is human-only; post-run validation (previously undocumented); utilization over 100%; the post-switch retry keeps the remaining timeout. - Onboarding / deploy: new guides/deploying/digitalocean.md converted from the docs site and checked against trinity-do-create.sh; the Getting started checklist now lives in the Systems sidebar; Public URL labels; ops-agent /update on hosted installs. - whats-new/v0.9.5.md, linked from both indexes. Corrections found against code: the troubleshooting FAQ pointed at the target agent's Permissions tab (grants live on the caller's); schedule retries default to 0 in the UI and REST (only the MCP create tool defaults to 1); Workspace clients do see the live card; voice-replies' settings location and STT fields; the sync-poll interval is a default; two heading anchors and a leftover issue link. FAQ 474 -> 499 questions; index regenerated from headings (two underscore anchors that never resolved are fixed). Verification: relative link + anchor check 0 broken over 110 pages; issue-number / codename grep 0 hits in added lines; deploy public-safety greps and the enterprise-docs-guard pattern 0 hits. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(user-docs): drop the managed-hosting option — Trinity is self-hosted only for now Ability.ai does not currently offer managed Trinity hosting. Remove the "Cloud Hosted (ability.ai)" comparison and Option A walkthrough from the deploying hub (install paths become the section; the self-hosted options are re-lettered A–D), and rewrite the FAQ answer that pointed users at a hosted sign-up. The licence answer no longer mentions "a managed instance". Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: sim <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
- VERSION 0.9.5-rc5 → 0.9.5 - docs/releases/0.9.5.md: the complete technical record (152 public + 76 private-tracker issues, abilities marketplace sweep, upgrade notes, known limitations) - docs/releases/v0.9.5-freeze-plan.md: the confirmed coherence review - What's New: the install story is the guided DigitalOcean install (a few steps, not one click), linked to the new Deploy on DigitalOcean guide Co-authored-by: sim <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Comment on lines
+599
to
+602
| return { | ||
| "valid": False, | ||
| "error": f"Error testing token: {str(e)}" | ||
| } |
Comment on lines
+454
to
+458
| return { | ||
| "success": True, | ||
| "masked": mask_api_key(key), | ||
| "propagation": propagation_payload, | ||
| } |
Comment on lines
+400
to
+403
| return { | ||
| "valid": False, | ||
| "error": f"Error testing key: {str(e)}" | ||
| } |
The release cut bumped VERSION to 0.9.5, and test_2380_installer_release_pin failed as designed: trinity-do-create.sh still defaulted to v0.9.5-rc5, so a script fetched from the v0.9.5 tag would have installed the previous release candidate. Point the default at the release being made. Co-authored-by: sim <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
vybe
approved these changes
Sep 17, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
v0.9.5 release — checklist passed; approving so the merge gate is only CI + operator go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release v0.9.5: cumulative changes since v0.9.0.
877 commits · 1,570 files · 152 public + 76 private-tracker issues · enterprise submodule 65182c1 → 08cd4dd.
Full record:
docs/releases/0.9.5.md· What's New:docs/user-docs/whats-new/v0.9.5.md· Freeze plan:docs/releases/v0.9.5-freeze-plan.mdHighlights
Workspace and every agent gets a canvas (ent#438). A conversation rail sits
beside the chat with Info, Loops, Files and Canvas tabs, and all three columns
are resizable and remembered per user (ent#474/fix(execution): MCP sync task triggered_by=mcp attribution (#473) #475/chore(#488): ship status-in-dev automation to main #492/Release: v0.5.0 #608, bug(workspace): the rail stops at 560px — the canvas column cannot be dragged past ~20% of a wide screen #2617). An agent
holds several topic-scoped chats as tabs, with a pinned Main chat and Reset
(ent#451/bug: claude subprocess stdout inherited by MCP child processes — leaks reader threads, eventually wedges agent-server #523). Running work shows up in the chat: a live execution card
that says in one line what the agent is doing, plus a Work tab history
(ent#457/feat: idempotency keys at all execution trigger boundaries (RELIABILITY-006) #525/fix(agent-runtime): kill npx MCP orphans outside claude pgid that hold stdout pipe open (#618) #620), and loops can be started, stopped and watched from chat
(ent#458). Agents can ask a named person a question, answered inline on any
of three surfaces, and an answer can wake the agent back up (ent#364/refactor: consolidate ExecutionQueue + SlotService + BacklogService into CapacityManager #428–decision: fold process engine agent_task through TaskExecutionService, or delete the engine #430,
ent#329). Also: deliverables as first-class objects, message and deliverable
ratings with report-a-problem (ent#365/feat(ui): data source visibility - show connected MCP servers #366/feat: configurable file/image exchange policy for public-channel agents #499), multi-file drag-and-drop and
a file preview (ent#524/bug: child processes inherit agent-server stdout pipe → reader thread stuck, false '0 tool calls' failures #548), unread markers (ent#557), chat rename
(ent#473), agent search and recency ordering (ent#402/feat(files): FILES-001 outbound file sharing — MVP + Phase 1 hardening #491), a model dropdown
(ent#403), a light/dark/system switch (ent#625), Escape/Stop cancels a turn
(ent#155), and multi-agent rooms moved into OSS core (ent#443).
the orb takes the conversation, the canvas stays in the right column, and the
transcript is written back into the thread (ent#440/fix(tests): update orphaned-recovery mocks to CapacityManager (#533) #534). The call acts as the
agent with a per-agent tool manifest (ent#535). A long task runs in the
background while you keep talking, and the result is brought back when it lands
(ent#551), with spoken etiquette for the whole tool cycle (ent#576).
same everywhere (ent#536), a platform design kit plus a
canvaslibrary skill(ent#537), canvas lifecycle with sort, search, pin and bulk delete (ent#553),
read-only share links and PDF export (ent#554), and the open canvas is shared
context the agent can see and operate on (ent#555).
(
scripts/deploy/trinity-do-create.sh) takes you from your own terminal toTrinity on its own Droplet, behind HTTPS, in about ten minutes. You install and
authorise
doctl, create a Claude subscription token, choose the adminpassword, and run one command. Guide:
Deploy on DigitalOcean.
Underneath it: prebuilt GHCR images, a pull-only hosted compose
(
start.sh --hosted, pinned byTRINITY_IMAGE_TAG) and an unattendedcloud-init first boot (feat: prebuilt images + pull-only hosted compose + unattended cloud-init first boot — the gate for every one-click / marketplace channel #2280). The DigitalOcean Marketplace image also ships;
its listing follows vendor review. Marketplace installs record their provenance
and show a first-run hardening guide (feat: record install provenance (DO Marketplace) + first-run HTTPS/VPN hardening guide #2380/docs: step-by-step hardening for a marketplace install — Cloudflare Tunnel and Tailscale VPN #2692). First-run setup happens in
the browser: a Marketplace admin is claimed there (ent#580), one setup overlay
(ent#581) configures the Claude, GitHub, email and Gemini keys (ent#582), a
front-desk agent demonstrates the primitive (ent#319), and the Trinity plugin
really is pre-installed in agents now (ent#411, bug: plugin install always withheld —
claude plugin install --yesuses a flag the CLI doesn't have (#1704/ent#411 delivery broken) #2305).breakdown and rate-limit history (feat: Subscription usage observability — 5h/7d usage dashboard, per-agent breakdown, and rate-limit event history #471), a Subscription pressure grid tile
(ent#259), durable headroom history (ent#433), and an operator alert at ≥75% of
the weekly limit (ent#434). Auto-switch now ranks alternatives by headroom
(auto-switch picks an alternative subscription without checking headroom — it can move agents onto a nearly-exhausted one #2409). A sweep fixed subscriptions misreported as rate-limited and gaps in the
switch-and-retry path (bug: subscription reports "rate-limited" for auth failures — is_subscription_rate_limited ignores failure_kind #2352/bug: subscription pressure tile shows "rate-limited" for a rejected provider token (invalid_token hidden in tooltip) #2353/bug: subscription reports "rate-limited" for the provider's own warning tier — allowed_warning fails the _headroom_indicates_limited catch-all #2396/
_parse_utilizationreads a >1.0 fraction as an already-percent value — an overage subscription would display and rank as ~1% #2419, ent#447, bug(subscriptions): a Workspace message on a rate-limited subscription fails instead of switching and completing — close the SUB-003 gaps on the turn path #2638/bug(subscriptions): a pull-dispatched terminal never triggers SUB-003 — the switch hook is missing onapply_task_result#2643/bug: SUB-003 post-switch auto-retry is capped at 300s regardless of the agent's execution timeout — long turns die mid tool-use #2789,bug: adding the first subscription leaves every credential-less agent stranded on API-Key auth — fleet stays "Not logged in" #2572, bug: Workspace thread titles use the instance Anthropic API key over the agent's own subscription #2766).
installs, off until an admin consents (ent#437). Product-update consent gets a
Settings home (ent#463), the send log records where each share went (bug(telemetry): the send log does not record where a share went, so a test-receiver 200 reads as a production acknowledgement #2571),
and the sharing heartbeat survives daily restarts (bug(telemetry): the sharing heartbeat's 24h timer restarts with the backend, so an install that restarts daily shares once and never again #2618).
durable queue (feat(pull): let scheduled work reach the durable queue — Option 2 deferred from #2048 #2391), loops are terminal-driven (feat(pull): make loops terminal-driven so they can run on the durable queue #2523), fan-out joins
asynchronously (feat(pull): async fan-out join + sync edge adapter — the last blocking dispatch caller #2524), and a pulled turn once again carries its model, tools,
turn cap, timeout and session (bug(pull): claim envelope reads task_overrides, a key no producer writes — every pulled turn drops the row's model, tools, turn cap, timeout and session #2317).
Fixed: agent-server event-loop starvation (bug: agent-server event loop starves under sustained parallel headless_executor load — 1 core pegged, localhost:8000 stops accepting, DORMANT breaker fires #2398) and the reader-thread drain
deadlock (bug: reader-thread drain deadlock discards a COMPLETED headless run as timeout, then wedges agent-server — #1502 mitigation fails (reader stuck 600s post-SIGKILL) #2455); watchdog mislabelling and overflow (bug: watchdog fails admitted-but-undispatched executions as "completed on agent but status not reported", releasing their slots and masking the real terminal #2433/bug: watchdog cannot close an execution stale >24.8 days — fabricated duration_ms overflows PostgreSQL INTEGER, and the sweep then fails every cycle forever #2434); background
work killed at CLI exit leaving no trace (Background task killed at CLI exit leaves no trace — execution records clean success while the work is lost #2467); headless runs being offered
wake-ups and loops that never fire (bug: agents route "run a loop" to Claude Code's built-in /loop + ScheduleWakeup — success is reported, nothing ever fires in headless runs #2454/ScheduleWakeup is offered in one-shot headless runs — it schedules a wakeup that never fires and tells the model it WILL be re-invoked #2468); the sync-health poller taking
.git/index.lock(bug(sync-health): the 60s poller takes .git/index.lock ~2×/min in every agent workspace and orphans a 0-byte lock on churn — silent commit failures fleet-wide #2742); PostgreSQL int4 overflows inagent_sync_state(bug: git_dir_bytes is int32 on PostgreSQL — git-bloat alerting is inoperable above ~2 GiB #2240/bug: agent_sync_state.git_dir_bytes is a 32-bit INTEGER on PostgreSQL — .git over 2 GiB breaks the sync-state upsert #2800/bug(db): seven more agent_sync_state columns accept a 63-bit agent value into an int4 column on PostgreSQL #2827); multi-agent rooms going dead after ~6h (bug(workspace): every multi-agent room goes dead after ~6h — room participants are missing from the session-JSONL reaper keep-set #2610); missing
gateway-timeout receipts on sync
/taskandfan_out(bug(mcp): the sync /task route has no queued_timeout receipt — the MCP gateway kills the held fetch and the caller sees 'fetch failed' while the target keeps running (#914, second route) #2661/bug(mcp): fan_out has no gateway-timeout receipt — the third route of the #914 class, and the one that runs longest #2670). Also:an integrity contract for
deploy_local_agent(bug: deploy_local_agent (archive path) silently deploys incomplete agents — archive rides the LLM turn, symlinks dereferenced/fatal, zero integrity verification #2060), Codex API-key auththat works (bug: Codex API-key auth is inert — every turn 401s because nothing writes $CODEX_HOME/auth.json #2208), and Push no longer untracks committed files (bug: Push untracks already-committed files — the appended canonical .gitignore block overrides the agent's own negations, and .env.example (F-004) is a casualty #2529).
could overwrite the admin password (bug(security): fresh install leaves setup_completed=false with a real admin — unauthenticated /api/setup/admin-password overwrites the admin password #2381). New: machine identities for
admin/ops APIs that survive enforced 2FA (feat: machine identities for admin/ops APIs — service credentials that survive enforced 2FA #2323), and
/tokenno longer returnsan unusable token while a 2FA challenge is pending (bug: /token returns HTTP 200 with an unusable access_token while a 2FA challenge is pending — silent break for password-grant machine clients #2322). Credential settings
are encrypted at rest (ent#435, rotation needed, see upgrade notes). Git
asks a credential helper for the token, so it is no longer in agent remote
URLs,
.git/configor process listings (ent#615). Guardrail hooks are out of an agent's reach(ent#345).
/wsactivity is scoped to the agents a user can access (ent#467).Audit attribution is honest, and denied calls are logged as refusals (ent#614,
bug(mcp): a denied chat_with_agent / fan_out call is audited as a successful tool call #2807).
run_agent_loopenforces the permission edge (ent#628). Approvalintegrity: a mobile Deny no longer records as an approval, and responses are
validated against the offered options (bug: /m mobile admin approval card records every option tap as response:"approved" (a Deny becomes an approval) and lacks the desktop note field #2370/bug: Workspace asks panel sends a typed answer as response_text (the agent reads response: "") and answers approval asks one-tap — same class as #2370 #2375/bug: POST /api/operator-queue/{id}/respond accepts any string as an approval decision — no layer checks response ∈ options #2376). The platform and
Workspace sessions now agree (fix(workspace): a client session that EXPIRES on a browser holding a platform login falls back to the platform identity #2261/bug(session): main app and Workspace disagree about the platform session — two credential sources, no cross-tab sync, three 401 logout paths; a stale Workspace tab logs a fresh re-login out #2791), and an agent can no longer switch on
its own paid wake-ups.
task_execution_service.pydecomposed (refactor: decompose task_execution_service.py — uncovered top-3 code-health hotspot (dispatch hot path) #2314), theremaining oversized backend modules split (refactor: split oversized backend routers & services (settings, public, agent crud, git, agent_client) #1028), ~2,800 lines of dead Vue plus
a dead-module sweep removed (refactor(frontend): delete 11 unreferenced Vue components and views (~2,800 lines with zero importers) #2492/refactor(backend): remove dead modules — utils/errors.py, the two OSS-move schema shims, scripts/poc, and 14 vulture hits #2493), and
architecture.mdsplit into alean core plus on-demand area files (docs: split architecture.md into a lean always-loaded core + per-area reference files #2306/docs: architecture area files are read deliberately — drop the unwired PreToolUse hook, state the rule in the core #2642). A user-journey test tier
arrives with a per-PR journey-smoke gate and Journey Impact declarations
(feat(tests):
tests/journeys/tier +run-full.sh --tier journeys#2335–docs: consolidate docs/testing — 17 files to STRATEGY.md plus pointers #2339/J10: Agent calls agent — journey harness #2349/feat(process): Journey Impact declaration on epic + PR templates, enforced at merge #2350). Loading states use skeleton placeholders, andbackground polls no longer re-flash content (refactor: replace bespoke spinners with skeleton placeholders on non-chart surfaces (scanline stays on charts only — design-system p12 as amended 2026-09-06) #1921/bug: background polls re-flash loaded content and reset UI state (design-system p13/p14) #1927/refactor(ui): the scanline reveal is for chart loading only — take it off the Workspace stage, thread and briefing; pages and lists load with skeleton placeholders #2540, ent#253).
See the full record for upgrade notes (restart policy,
CREDENTIAL_ENCRYPTION_KEY+ rotation, base-image rebuild,TRINITY_IMAGE_TAGpinning) and known limitations.Closes #471
Closes #848
Closes #1028
Closes #1855
Closes #1921
Closes #1927
Closes #2029
Closes #2060
Closes #2085
Closes #2106
Closes #2110
Closes #2163
Closes #2208
Closes #2240
Closes #2246
Closes #2261
Closes #2277
Closes #2280
Closes #2305
Closes #2306
Closes #2314
Closes #2320
Closes #2322
Closes #2323
Closes #2335
Closes #2336
Closes #2337
Closes #2338
Closes #2339
Closes #2349
Closes #2350
Closes #2352
Closes #2353
Closes #2358
Closes #2361
Closes #2370
Closes #2373
Closes #2374
Closes #2375
Closes #2376
Closes #2380
Closes #2381
Closes #2391
Closes #2396
Closes #2398
Closes #2409
Closes #2411
Closes #2419
Closes #2423
Closes #2424
Closes #2426
Closes #2433
Closes #2434
Closes #2443
Closes #2446
Closes #2448
Closes #2449
Closes #2454
Closes #2455
Closes #2461
Closes #2462
Closes #2464
Closes #2467
Closes #2468
Closes #2469
Closes #2492
Closes #2493
Closes #2515
Closes #2523
Closes #2524
Closes #2528
Closes #2529
Closes #2533
Closes #2536
Closes #2538
Closes #2539
Closes #2540
Closes #2541
Closes #2545
Closes #2550
Closes #2559
Closes #2571
Closes #2572
Closes #2577
Closes #2578
Closes #2579
Closes #2580
Closes #2582
Closes #2583
Closes #2585
Closes #2593
Closes #2597
Closes #2598
Closes #2605
Closes #2610
Closes #2616
Closes #2617
Closes #2618
Closes #2620
Closes #2624
Closes #2625
Closes #2638
Closes #2640
Closes #2641
Closes #2642
Closes #2643
Closes #2661
Closes #2662
Closes #2666
Closes #2669
Closes #2670
Closes #2676
Closes #2689
Closes #2691
Closes #2692
Closes #2693
Closes #2694
Closes #2695
Closes #2696
Closes #2700
Closes #2703
Closes #2718
Closes #2726
Closes #2730
Closes #2733
Closes #2734
Closes #2742
Closes #2744
Closes #2759
Closes #2763
Closes #2766
Closes #2767
Closes #2789
Closes #2791
Closes #2792
Closes #2794
Closes #2795
Closes #2796
Closes #2800
Closes #2802
Closes #2807
Closes #2812
Closes #2814
Closes #2815
Closes #2822
Closes #2827
Closes #2828
Closes #2829
Closes #2850
Closes #2859
Pre-release checklist passed 2026-09-17: CI green on the dev tip, no open P0s in either tracker, secrets scan clean, VERSION = 0.9.5, and every freeze-plan gate cleared. Ready for squash-merge.
v0.9.5publish-images.yml(moveslatest),publish-cli.yml(src/cli/**changed),sync-docs-to-vertex.yml(docs/user-docs/**changed)🤖 Generated with Claude Code