Skip to content

feat(workspace): the live execution card in chat + the Work tab history (abilityai/trinity-enterprise#525) - #2549

Merged
vybe merged 1 commit into
devfrom
feature/ent525-workspace-work
Sep 6, 2026
Merged

vybe merged 1 commit into
devfrom
feature/ent525-workspace-work

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Summary

  • The live execution card (PortalWorkCard) under the message that started a job — status word, elapsed, the stream's last line as the current step (ent#286), the steps of a published pipeline with the agent holding each, delegated children found by the chat (a child's agent_name is the delegate, so the agent filter alone can never return it), Stop (ent#155) and Open in Work. The terminal card renders from the durable bug(workspace): failed turns are invisible to the client — fast failures misreported as "lost track", backend error discarded, Retry suppressed where it is safe #2320 verdict, so it survives a reload; success collapses into the reply; Ask about it is a composer prefill, never a send (the ruled lesser control — a step-level restart is feat(mcp): introspect agent pipelines via standardized ~/.trinity/pipelines/ + ~/.trinity/pipeline-state/ #919 territory). The room renders the card for the agents the server says are working.
  • The Work tab (PortalWork, docked into #tab-work in both rail mounts): Waiting on you (PortalAsks over store.asks filtered to participants — the fourth rendering of the same operator-queue row, ent#428), Now, Earlier ("N in the last 30 days · latest 3 shown", Show all expands in place, "30+" when the page is full). Rooms group by participant, absence visible. Loop runs are one execution kind here — ent#458 AC 3 lands, no parallel surface.
  • client_portal/work/ — one platform-door-only read (GET …/client-portal/work?agents=&chat_id=; a portal token gets a uniform 404 before any read, ent#78's auth-path invariant per the 2026-09-06 ruling). Under the portal roster, never the fleet ACL: accessible_agent_names resolves through list_all_agents_fast(), a Docker read that answers [] on a daemon fault (the bug: Workspace roster lists agents with no container (DB-sourced roster vs Docker-as-truth) #2196 class). Reuses get_fleet_executions / get_fleet_execution_stats (the SELECT gains source_channel, source_channel_chat_id, loop_id; FleetExecutionSummary deliberately drops them, so the operator dashboard's payload is byte-identical) + get_running_for_chat on idx_executions_status — no migration, no table, no MCP tool.

Honesty rules (the review's contribution)

  • Three steps states, not two: reported (stages) / none ("this agent doesn't report steps") / unknown ("could not be read right now" — stopped, unreachable, unreadable, or two runs on one agent so no instance can be attributed). A stopped agent must never be described as one that doesn't report.
  • A ghost row is not live: a RUNNING row past 1.5× the agent's turn bound (floor 30 min) is stale — no clock, no signal, no poll — because the 120-minute sweep leaves rows after a restart.
  • One signal, merged by execution id (workSignalFromItems): the conversation's emit and the feed's row for the same turn count once, never two signals summed.
  • can_stop is computed once server-side as exactly what the terminate route accepts; every off-roster name on the payload is masked to null (ent#467); title/error sanitized and bounded; only a portal stamp becomes a chat_id.
  • The feat(mcp): introspect agent pipelines via standardized ~/.trinity/pipelines/ + ~/.trinity/pipeline-state/ #919 read is hardened like pipelines.ts: id grammar before any path, size from the listing before the download, a streamed byte cap, safe_yaml, no retries, 2 s per call in a 3 s wall budget, a 10 s per-agent cache.

Changes

  • Backend: client_portal/work/{__init__,models,service,pipeline_state,router}.py, db/schedules/{executions,stats}.py, database.py (facade re-export), models.py (comment only), main.py (mount)
  • Frontend: components/portal/{PortalWorkCard,PortalWork}.vue, portalWork.js, stores/portalWork.js, usePortalRailFeeds.js (the Work feed joins the one owner; chatId + workEmit inputs), portalRail.js (feedsFor.work, the emit carries the id), Portal.vue, PortalConversation.vue (the card replaces the dots; reattach sets the execution id so Stop works after a reload), PortalRoom.vue, PortalAsks.vue (agentNames), clientPortal.js (fetchWork), websocket.js
  • Docs: requirements §5.21, architecture/workspace.md, api-endpoints.md, new feature-flows/workspace-work.md + index, residuals in workspace-rail.md / workspace-loops.md / scheduling §38.7, learnings.md (the facade-re-export class, with the derived guard)

Test Plan

Notes for review

  • /autoplan taste decisions, decided per the 2026-09-02 / 09-06 rulings: steps from the pipeline contract + delegated children (not children alone); the portal route rather than /api/executions?agents= (the ACL, above); the terminal card only for non-success — and, after the live pass, only for non-retryable verdicts (a dispatch that never reached the agent keeps the red message + Retry as its honest UI).
  • /review caught the missing facade re-export (database.db.get_running_for_chat) — every stubbed test was green over an AttributeError the service's broad except would have turned into a 503. Fixed, and guarded by a test that derives the required facade methods from the service source.
  • Deferred and registered in the debt inbox: a backend broadcast for pipeline-state writes (steps ride the 12 s poll while a run is live). ent#367's profile scope inherits when it lands.
  • Cross-tracker: the closing keyword does not auto-close the private issue; ent#525 is closed at release.

Fixes abilityai/trinity-enterprise#525

🤖 Generated with Claude Code

https://claude.ai/code/session_019jmsjUAT1Q7VQbAw12YxGZ

…ts its history (abilityai/trinity-enterprise#525)

The visual half of ent#457. When a message starts a long-running job the
Workspace now shows it happening: a live card under the message (status word,
elapsed, the stream's last line as the current step, the steps of a published
pipeline with the agent holding each, delegated children found by the CHAT,
Stop, Open in Work) and the rail's Work tab — Waiting on you · Now · Earlier
("N in the last 30 days · latest 3 shown", Show all in place). Loop runs are
one execution kind here (ent#458 AC 3), rooms group by participant with
absence visible, and the terminal card renders from the durable #2320 verdict
so it survives a reload; "Ask about it" is a prefill, never a send — the
ruled lesser control for a restart Trinity cannot do.

Backend: client_portal/work/ — a platform-door-only read (a portal token gets
a uniform 404 before any read, ent#78) over the executions ledger under the
PORTAL roster, never the Docker-backed fleet ACL (#2196). Reuses
get_fleet_executions / get_fleet_execution_stats (the SELECT gains
source_channel, source_channel_chat_id, loop_id; the fleet model drops them,
so the dashboard payload is unchanged) plus get_running_for_chat, driven by
idx_executions_status — no migration. Every off-roster name on the payload
is masked (ent#467); titles/errors sanitized and bounded; can_stop mirrors
exactly what the terminate route accepts; a RUNNING row past 1.5× the
agent's turn bound is stale (not live, no clock, no signal, no poll). Steps
via the #919 pipeline files, hardened like pipelines.ts (id grammar before
any path, listing size before download, a streamed byte cap, safe_yaml, no
retries, 2 s in a 3 s wall budget, 10 s cache) and THREE-state: reported /
doesn't report / could not be read.

Frontend: stores/portalWork.js fed by the one owner (usePortalRailFeeds),
12 s poll only while something is live, push on agent_activity (started and
terminal) + loop events, debounced; the Work signal is ONE set merged by
execution id, never two signals summed. reattach() now sets the execution
id so Stop works after a reload.

Review fixes: the facade re-export the mixin method was missing (the
ent#277 class — a stubbed test cannot see it; a derived guard now scans the
service for every core_db call), the verdict memo beside #2320's extracted
function with its tail rule, no card for a retryable dispatch refusal.

Tests: tests/unit/test_ent525_portal_work.py (59), portalWork.spec.js (31),
neighbouring rail/loops/failed-turn specs re-pinned; full frontend suite
1965 green; live pass on the Docker stack (route 200/422/401, tab in light
and dark, Ask about it → prefill, Show all, in-chat terminal card).

Fixes abilityai/trinity-enterprise#525

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019jmsjUAT1Q7VQbAw12YxGZ

@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.

/validate-pr: APPROVE.

  • Targets dev, on the dev tip; 36 files (+3481/-60), single conventional commit.
  • Cross-tracker closing keyword (Fixes abilityai/trinity-enterprise#525) — accepted; ent#525 gets status-in-dev by hand after merge, closes at release.
  • Docs: requirements (core-agent §5.21, scheduling §38.7), architecture/workspace.md + api-endpoints.md, new feature-flows/workspace-work.md + index, learnings.md.
  • Security scans clean (keys/emails/IPs/secrets/cred files/symlinks/host paths); no compose/Dockerfile change; client_portal/ already COPYed; no new env var.
  • Auth: platform-door-only via get_portal_principal.is_platform → uniform 404; roster-scoped, off-roster names dropped/masked (ent#467); chat_id honoured only for a session the caller holds; #919 read hardened (id grammar, size-before-download, streamed cap, safe_yaml, no retries, 3 s wall).
  • No schema change, no migration, no MCP tool; router carries its # mcp: none header.
  • Tests: 59 backend (door, roster, tables, children-by-chat, hardened pipeline read, facade guard, dashboard-payload pin) + 31 vitest; backend-unit-test 6 seeds + regression diff, frontend-build, frontend-e2e, secret-scan, pg-migrations all green.

@vybe
vybe merged commit f4e39c4 into dev Sep 6, 2026
29 checks passed
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.

2 participants