Skip to content

fix(workspace): a room inlines only its own live work, joined by the chat id it now stamps (#2792) - #2793

Merged
vybe merged 3 commits into
devfrom
feature/2792-room-work-chat-id
Sep 15, 2026
Merged

vybe merged 3 commits into
devfrom
feature/2792-room-work-chat-id

Conversation

@trinity-ability

@trinity-ability trinity-ability commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A Workspace room inlined every live execution of a working participant as a room work card (schedule runs, loop turns, 1:1 threads, other rooms, MCP tasks), because the room turn stamped no source chat and the room could only filter the Work feed by agent name.
  • The room turn now stamps source_channel_chat_id = room_id under its own channel value, config.ROOM_SOURCE_CHANNEL = "room", and PortalRoom.vue selects live cards by that chat id (still ∩ the server's working list). No row for the room yet → the existing server-derived "thinking…" line, never unrelated cards. The rail's Work tab is unchanged.
  • Deviation from the issue's technical note, on purpose (plan review, two independent reviewers converged): the stamp does not reuse portal. Every reader of that value branches on "this is a 1:1 thread" — _resolve_portal would look the room id up as a session, and the voice-reply route would tell a room's delegated child (mcp trigger + inherited stamp) about a speaker control rooms do not have (the bug(voice): agents tell Workspace clients the surface is text-only — portal TTS is never advertised, and the channel/portal voice gates disagree #2157 false-claim class). room is in neither map, so parent and child are suppressed by construction; the work projection is the one reader that opts in.

Changes

  • src/backend/config.py — ROOM_SOURCE_CHANNEL = "room", with the reasoning.
  • src/backend/shared_sessions/service.py — _wake_agent stamps source_channel, source_channel_chat_id, source_channel_client.
  • src/backend/client_portal/work/service.py — _project exposes chat_id for room rows; work_kind classifies a room's delegated child delegated.
  • src/frontend/src/components/portal/portalWork.js — pure liveItemsForRoom(items, roomId, workingAgents).
  • src/frontend/src/components/portal/PortalRoom.vue — the selection line uses it.
  • docs/memory/feature-flows/workspace-work.md, channel-completion-report.md — the room stamp, the room value, the stated participant-scope residual; docs/memory/learnings.md — one entry on reusing a discriminator value.

Test Plan

  • tests/unit/test_2792_room_work_chat_id.py — the stamp (first + chained wake, no-email principal), no resolver reached for parent or child (spy over every existing resolver), not_a_channel_turn on the voice route for both, the projection (turn → room, child → delegated, Telegram → no chat)
  • src/frontend/tests/unit/roomWorkChatId.spec.js — the AC pin (one room row + one foreign row on the same working agent → exactly one card) and the component's real selection line executed against a stub feed; portalWork.spec.js pin updated
  • Neighbouring suites: 337 backend tests green; full frontend unit suite 2918 green (ratchets included)
  • Manual: open a room with an agent that also has a schedule running; send a message; only the room turn's card appears, the schedule run stays in the rail's Work tab

Fixes #2792

🤖 Generated with Claude Code

https://claude.ai/code/session_018qjDKyEzcQF7ejgLFgv3r4

…chat id it now stamps (#2792)

A Workspace room picked its live cards from the Work feed by agent name, so
while a participant was marked working, every execution on that agent — a
schedule run, a loop turn, a 1:1 thread, another room, an MCP task — rendered
as a card in this room. It could not do better: the room turn stamped no
source chat on its execution row.

The room turn now stamps `source_channel_chat_id = room_id` (the 1:1 thread's
shape) under its OWN channel value, `config.ROOM_SOURCE_CHANNEL = "room"`, and
`PortalRoom.vue` selects `liveItemsForRoom(feed, roomId, working)`: chat id
equals the room, still intersected with the server's `working` list, masked
agents excluded. With no row for the room yet the server-derived "thinking…"
line renders, never unrelated cards. The rail's Work tab is unchanged.

Why not reuse `portal` (the plan review's finding, both reviewers): every
reader of that value branches on "this is a 1:1 thread" — `_resolve_portal`
would look the room id up as a session, and the voice-reply route would tell a
room's delegated child (an `mcp` trigger carrying the inherited stamp) about a
speaker control rooms do not have. `room` is in neither map, so parent and
child are suppressed by construction; the work projection is the one reader
that opts in (`chat_id`, and a room's child classifies `delegated`).

Tests: the stamp on a first and a chained wake, no resolver reached for parent
or child (spy over every existing resolver), `not_a_channel_turn` for both on
the voice route, the projection; and on the frontend the pure rule plus the
component's real selection line executed against a feed holding a room row
and a foreign row on the same working agent.

Fixes #2792

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_018qjDKyEzcQF7ejgLFgv3r4
@trinity-ability trinity-ability added the ui PR touches the frontend UI — triggers Playwright e2e tests label Sep 14, 2026
@github-actions

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

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.

Mechanical, per the merge-train note on the PR. This branch had never been
tested by CI — every run was skipped on the conflict — so the merge is what
lets it run for the first time.

- src/backend/shared_sessions/service.py — both sides edited the same
  execute_task(...) call. dev's #2794 added `images=images or None` and hoisted
  `client_email = getattr(current_user, "email", None)` (:1160); this branch
  added the #2792 room stamp. Union of both. `source_channel_client` now reads
  `client_email`, which is the same expression dev hoisted, so the value is
  unchanged — not a re-decision.
- src/frontend/src/components/portal/PortalRoom.vue — import union:
  liveElapsedSeconds, liveItemsForRoom (this branch), soleStoppableItem (#2795).
- docs/memory/learnings.md — routine same-day append; both kept, dev's first.
- tests/registry.json — rebuilt from the git stages rather than spliced:
  dev's 254 entries in dev's order, plus this branch's one new entry
  (unit/test_2792_room_work_chat_id.py) at its original neighbour position.
  Diff against dev is exactly those 12 lines.

Verified on the merged tree: tests/unit/test_2792_room_work_chat_id.py 11
passed; frontend 134 files / 3025 tests passed, including dev's
roomStopWork.spec.js (the #2795 coupling) and both the raw-colour and
loading-gate ratchets, with no baseline edits.

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

vybe commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

merge-train: four conflicts resolved and pushed to this branch

Commit c73a820, plus a body edit. Net diff against dev is unchanged — still 12 files, +536/−17 — so nothing from dev leaked into this PR's scope.

This branch had never been tested by CI. statusCheckRollup was empty on 91f41c34; both nightly bots posted "skipped — merge conflict against dev". The merge is what lets it run for the first time, so treat the incoming run as this PR's first real signal.

File Resolution
src/backend/shared_sessions/service.py Union. Both sides edited the same execute_task(...) call: dev's #2794 added images=images or None and hoisted client_email = getattr(current_user, "email", None) at :1160; this branch added the #2792 room stamp. source_channel_client now reads client_email — the same expression dev hoisted, so the value is identical, not a re-decision.
src/frontend/src/components/portal/PortalRoom.vue Import union: liveElapsedSeconds, liveItemsForRoom (yours) + soleStoppableItem (#2795).
docs/memory/learnings.md Routine same-day append; both kept, dev's first.
tests/registry.json Rebuilt from the git stages, not spliced around the markers: dev's 254 entries in dev's order, plus your one new entry (unit/test_2792_room_work_chat_id.py) at its original neighbour position. The diff against dev is exactly those 12 lines — no gratuitous reorder.

Verified on the merged tree: test_2792_room_work_chat_id.py 11 passed; frontend 134 files / 3025 tests passed, including dev's roomStopWork.spec.js and both the raw-colour and loading-gate ratchets, with no baseline edits.

Body: Fixes abilityai/trinity#2792 → Fixes #2792. The same-repo issue written in cross-repo form still closes, but the promotion workflow doesn't fire on it (#2644).

Validation notes not fixed — yours to judge

None blocks the merge; the code is correct and fully consumed end-to-end (a five-mutation battery turned the suite red on every changed line, and the chain service.py:1124 → create_task_execution → get_fleet_executions → _project → WorkItem.chat_id → portalWork.js → PortalRoom.vue:458 → a rendered <PortalWorkCard> was walked hop by hop — this is not the #2648/#2619 inert-client-half shape).

  1. source_channel_client has no live consumer for a room row. shared_sessions/service.py:1126. Its only reader, channel_completion_report.py:615, sits downstream of _CHANNEL_RESOLVERS.get("room") → None → return False at :589. The field equals source_user_email, which is already stored, so it carries no new information — harmless forward-compat, but it is literally the "definition + test, no consumer" shape. Worth dropping or justifying in a comment.
  2. "The rail's Work tab is unchanged" (PR body) is false of behaviour. PortalWork.vue:212 childrenForChat(...) is guarded by if (!chatId) return []; room rows previously had chat_id === null and now match. Two concurrent room turns in one room render as each other's "held by X" children — a mislabel, since siblings handed nothing to each other. (The @-mention chain is sequential at :975-1000, so that path is safe; this needs two humans posting at once.) Your own workspace-work.md states the grouping change, so the PR body is the part that's out of date.
  3. Room delegated children flip kind "other" → "delegated", which also flips can_stop. Consistent with the terminate route's real gate (mine and on_roster and running), so the button isn't lying — but it's a second Work-tab behaviour change not named in the body.
  4. Post-merge coupling with bug(workspace): running executions in a room cannot be stopped — no Stop on room tiles or the Work tab #2795 is pinned by regex only. roomStopWork.spec.js:93 matches the escapeStoppable = soleStoppableItem(roomLiveItems.value, …) line as text and never executes the composed pipeline. Net effect is a fix (on dev today, Escape in a room can stop a participant's unrelated schedule run), but the combination is unproven by execution.
  5. roomWorkChatId.spec.js:100-112 couples to single-line formatting — a cosmetic reformat breaks it, though loudly (SyntaxError), so the failure direction is safe.

The issue's own flagged hazard was handled correctly: minting ROOM_SOURCE_CHANNEL = "room" rather than reusing portal was verified safe by execution at all three readers, so terminal report-backs are not routed into the room.

🤖 Generated with Claude Code

Mechanical. #2816 merged to dev between this branch's first resolution and its
merge slot, and both append to docs/memory/learnings.md — the routine same-day
collision. Both entries kept, dev's (#2814) first.

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

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

merge-train 2026-09-15: four conflicts resolved mechanically and verified on the merged tree (11 backend + 3025 frontend); first-ever CI run fully green.

@vybe
vybe merged commit 0bddbc9 into dev Sep 15, 2026
29 checks passed
@vybe
vybe deleted the feature/2792-room-work-chat-id branch September 15, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants