Skip to content

fix(mcp): show an agent's writes without reloading the page - #56

Merged
praxagent merged 1 commit into
mainfrom
fix/library-live-update
Jul 26, 2026
Merged

fix(mcp): show an agent's writes without reloading the page#56
praxagent merged 1 commit into
mainfrom
fix/library-live-update

Conversation

@praxagent

Copy link
Copy Markdown
Owner

A card filed over MCP didn't appear until the browser was refreshed.

Why

The Kanban and note queries have no polling and no subscription — they only refresh when the UI itself made the change. So a write from anywhere else was invisible by construction, and worst for exactly the case this feature exists for: an agent working in the background, while you're not thinking to press reload.

A successful mutation now broadcasts library:update carrying the space, and the browser invalidates the Kanban, the columns, and the Library tree.

Three deliberate details

Fires only after the write succeeds. Announcing the attempt would put the UI a step ahead of the data — it'd refetch, see the old state, and quietly disagree with what the agent was just told.

Reads announce nothing. Nothing changed, so there's nothing to refetch — and a listing agent shouldn't make every open browser do work.

A failed broadcast doesn't fail the write. The write already happened; reporting failure would tell the agent its change was rejected when it wasn't, and a reload still shows the truth. A missed notification is the smaller harm, so it's logged and swallowed.

Shape

The announcer is injected by the route rather than reached for inside mcp_server — same as the comment poster. The websocket manager is a thing only the HTTP layer has, and keeping it out means the tool layer still tests without a running app.

Broadcast to all clients: a Library space isn't scoped to a TeamWork project, and a client with no query for it ignores the event.

Verification

45 MCP tests, 282 TeamWork tests green, tsc + build clean. Found by using it on the live box.

A card filed over MCP did not appear until the browser was refreshed. The Kanban
and note queries have no polling and no subscription, so they only refreshed when
the UI itself made the change — which means a write from anywhere else was
invisible by construction. That is worst for exactly the case this feature
exists for: an agent working in the background, while you are not thinking to
press reload.

A successful mutation now broadcasts library:update carrying the space, and the
browser invalidates the Kanban, the columns and the Library tree.

Three deliberate details:

- It fires only AFTER the write succeeds. Announcing the attempt would put the
  UI a step ahead of the data — it would refetch, see the old state, and quietly
  disagree with what the agent was just told.
- Reads announce nothing. Nothing changed, so there is nothing to refetch, and a
  listing agent should not make every open browser do work.
- A failed broadcast does not fail the write. The write already happened;
  reporting failure would tell the agent its change was rejected when it was
  not, and a reload still shows the truth. A missed notification is the smaller
  harm, so it is logged and swallowed.

The announcer is injected by the route rather than reached for inside
mcp_server, same as the comment poster — the websocket manager is a thing only
the HTTP layer has, and keeping it out means the tool layer still tests without
a running app.

Broadcast to all clients: a Library space is not scoped to a TeamWork project,
and a client with no query for it ignores the event.

45 MCP tests, 282 TeamWork tests green, tsc + build clean.
@praxagent
praxagent merged commit 8f8046b into main Jul 26, 2026
1 check 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.

1 participant