Repository navigation
feat(site/src): show the chat todo list in the composer - #43
Conversation
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.
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
@codex review |
There was a problem hiding this comment.
💡 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".
@codex review |
There was a problem hiding this comment.
💡 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".
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Merge evidence at head
|
Part of #10. Stacked on #36 (the todo routes); retarget to
mainafter #36 merges.Shows the chat's todo list in the Agents composer, behind
fork-chat-todos.ForkComposerSlotrendersChatTodoPillwhen the experiment is on and the chat exists. The slot is the fork's hook inAgentChatInput, so no upstream file changes.done/totaland 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}/todosloads the list through React Query. After it loads, a reconnecting/todos/watchwebsocket 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.api/forkChatTodos.tsso the upstreamapi.tsstays 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 undersrc/pages/AgentsPageandsrc/apipass.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:
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 to3/4within a second, and the popover showed the new item as pending./todosURL. The route answered 403.