Skip to content

feat(site/src): show the chat todo list in the composer - #43

Merged
ibetitsmike merged 12 commits into
mainfrom
mike/todo-transcripts-5-todo-ui
Nov 9, 2026
Merged

ibetitsmike merged 12 commits into
mainfrom
mike/todo-transcripts-5-todo-ui

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #10. Stacked on #36 (the todo routes); retarget to main after #36 merges.

Shows the chat's todo list in the Agents composer, behind fork-chat-todos.

  • ForkComposerSlot renders ChatTodoPill when the experiment is on and the chat exists. The slot is the fork's hook in AgentChatInput, so no upstream file changes.
  • The pill shows done/total and opens a popover with each item and its status. It renders nothing while the list loads or is empty, and a warning pill with the error when the read fails.
  • GET /api/v2/chats/fork/{chat}/todos loads the list through React Query. After it loads, a reconnecting /todos/watch websocket writes each list it receives into the same query cache, so the pill updates without refetching. A failed read opens no socket, so a chat the user cannot read does not reconnect forever.
  • The API calls live in api/forkChatTodos.ts so the upstream api.ts stays unchanged.

Validation: Vitest ForkComposerSlot.test.tsx (no request while the experiment is off, socket lists reach the todo query cache, no socket after a failed read); each test fails when its behavior is broken. Unit tests under src/pages/AgentsPage and src/api pass. pnpm lint (biome, oxlint, tsc, dpdm, React Compiler check, knip) passes. Stories: Collapsed, Empty, Expanded, LongContent, LoadError.

UAT on a dev instance with a local model, in Chromium. The first two runs are at 51a6664; the next commit that changes app code is 97080a8, the head, where the last two runs are:

  • Experiment on: the pill showed 2/3, and the popover listed the three items with their statuses. I asked the model to mark one done and add one. Without a reload, the socket delivered version 4 and the pill changed to 3/4 within a second, and the popover showed the new item as pending.
  • Experiment off: the same chat page showed no pill and sent no request to any /todos URL. The route answered 403.
  • Revisit, at 97080a8: after switching to another chat and back, the page read the list again before it opened a new watch socket.
  • Live update, at 97080a8: the model marked an item in progress. The socket delivered version 5, and the popover showed the item as in progress without a reload.

Serve the chat todo list over the API so the UI can read and watch it
while the todo_write tool works on a chat.

GET /api/v2/chats/fork/{chat}/todos returns the stored list, and
GET .../todos/watch streams it over a websocket: the current list first,
then the new list after every write. Both read as the request actor, so
dbauthz enforces read access to the owning chat, and both sit behind the
fork-chat-todos experiment inside the reserved /chats/fork mount.

The fork routes take their middleware from an inline router rather than
a {chat} subrouter, because chi mounts a subrouter on a prefix and would
then run the experiment and chat parameter middleware for fork paths
that match no route, replacing the reserved 404 with a 403 or a 400.

The items decode moves to codersdk.DecodeChatTodoItems so the tool and
the route answer the same way, including an empty list rather than null.
The pubsub callback now only wakes the handler, which reads and sends the latest list itself. Concurrent callbacks can no longer race on the encoder, a dropped-messages error forces a resync, API shutdown ends the stream, and the docs say that close writes can coalesce.
A watcher rereads the list every 30 seconds, so a write whose event was
never published, or whose reread failed, still reaches the client.
The resync const sat between the annotations and the func, which drops
the route from swagger.
…hat-todos

ForkComposerSlot renders a todo pill when the fork-chat-todos experiment
is on and the chat has a todo list. The pill shows done/total (cancelled
items do not count) and opens a popover with every item and its status.
The list loads from GET /api/v2/chats/fork/{chat}/todos and stays live
through the todo watch socket, which writes each list into the query
cache. The socket opens only after the GET succeeds, so a chat the user
cannot read does not reconnect forever. With the flag off the slot
renders nothing and makes no request, so the composer matches upstream.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum acted for Mike.

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T11:05:50.355173Z 97080a8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51a666468f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum acted for Mike.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c19ca107b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum acted for Mike.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd5529fd18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread site/src/api/queries/forkChatTodos.ts Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum acted for Mike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 97080a88c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from mike/todo-transcripts-4-todo-routes to main November 9, 2026 11:15
@ibetitsmike
ibetitsmike merged commit e12a13e into main Nov 9, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/todo-transcripts-5-todo-ui branch November 9, 2026 12:09
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence at head 19f793c242:

  • fork-ci pull_request run 42607668423 green on this head (all checks pass), MERGEABLE/CLEAN, 0 unresolved review threads.
  • Codex receipt clean on 97080a88c4. The only later change is a merge of main; the site/ patch (git diff origin/main...19f793c242 -- site) is byte-identical to the reviewed one (326391eaaf..97080a88c4), so the receipt and the UAT on 97080a88c4 stand.
  • frontend-deep-review on the final diff: 0 blocking; one should-fix dropped with a reason (the Empty story covers a reachable state, per site/AGENTS.md).
  • Merged after the previous main commit 36205eb03d deployed healthy locally (buildinfo, migrations 640 clean, no new-process errors).

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