Skip to content

pstack W4: todo list and transcripts #10

Closed

Description

@ibetitsmike

Xum created this issue on behalf of @ibetitsmike.

Part of #4.

Workspace brief from the pstack parity plan (local plan page "Running pstack on the Coder Agents Fork"; the PRD is local to Mike's Mac and not reproduced here). Claim numbers such as 1.3 or shared.2 refer to the plan page.

W4 · Todo list and transcripts · mike/todo-transcripts

Task. PRD 6.6 first, then 6.5, then the R12.3 check.

Background. The memory index already shows the pattern for a model-only message that returns after compaction (generation.go:458-470, called at :639; memory.go:87). GetChatMessagesByChatID has an after_id cursor and keeps only user and both visibility (chats.sql:414-425).

Scope.

  1. chatd.chat_todos (plan 4.1); todo_write and todo_read through appendForkTools; a pubsub event per write; R6.4 a parent reads a child's list through list_agents.
  2. Re-inject the list as a model-only message after a compaction boundary, next to syncMemoryIndex.
  3. UI panel above the composer through the W0 slot, live.
  4. read_chat_transcript (R5.1, R5.2, R5.4): cursor pages, role and part filters, byte budget, existing tool-output truncation. Reads run as the chat owner (asOwner, chattool/listtemplates.go:437), never as chatd, which can read every chat. Descendants are allowed through the parent_chat_id walk. Parts pass through StripInternal (codersdk/chats.go:708-720) so provider metadata and credentials stay out. search_chats (R5.3) reuses docs/coder-agents/chat-search-syntax.md. R5.5 wait_agent last N tool calls (subagent.go:710).
  5. R12.3: confirm inline MP4 playback; fix only if it is missing.

Acceptance (PRD 6.5, 6.6).

  • A todo list made before a manual /compact is visible to the model and the user after it.
  • After compaction, a chat reads its own first user message verbatim.
  • Inside a real chatd turn, a chat cannot read another user's unshared chat, and can read a chat shared with its owner.
  • A transcript page with a reasoning part carries no provider metadata or credential fields.
  • A root reads a grandchild's transcript (needs W2 merged; otherwise defer this one test).

Constraints. Experiment fork-chat-todos (one flag for todos and transcripts unless review asks to split).


Rules for every workspace

Topic Rule
Runner One Xum workspace per brief (W0 runs as W0a and W0b), started from fork main at its wave start. Every implementation runs implement-flow with the workstream issue as its input and the brief as the plan.
Branches mike/<topic> for the workspace; stacked PR branches mike/<topic>-<n>-<slug>. Local name equals remote name. Never push to main.
PR size 500 changed lines at most per PR, generated code excepted (reviewer-friendly-pr). Stack with gh stack; the extension is not installed on the Mac today (gh extension install github/gh-stack), else use explicit-base PRs.
Schema Fork tables are chatd graph nodes: go run ./coderd/database/migrations/chatdmig/cmd/chatdmig new <name> -requires <node or upstream:name>. Never edit a node that ran. No edits to dump.sql, queries.sql.go, querier.go, dbmock or numbered migrations.
Queries coderd/database/forkdb only (created by W0). Every method goes through the forkdb authz wrapper. A forkdb write that belongs with an upstream write runs in the same transaction, through the W0 accessor (database.Store exposes only InTx, coderd/database/db.go:22-31).
Authorization Chat-owned rows authorize through the owning chat (dbauthz.go:6513-6522 pattern). Agent and plugin rows reuse the skill RBAC objects. No new RBAC resources, no new API key scopes. Tools run as the chatd subject, which can read and update every chat (dbauthz.go:807-817): a tool that touches a chat other than its own runs as the owner (asOwner, chattool/listtemplates.go:437-443).
Upstream files One hook line per hot file (plan shared.2). Logic lives in new fork files. Hot files: turn_environment.go, chatd.go, subagent*.go, codersdk/chats.go, deployment.go, dbauthz.go, chat_routes.go, AgentChatInput, AgentChatPageView.
Open upstream PRs If a workspace needs an open coder/coder PR, W0 or W7 merges its branch into the fork with a merge commit. Its migrations go through chatdmig route into the chatd schema. Sync conflicts are solved later (Mike, 2026-11-08).
Flags Each feature is behind its fork-* experiment in codersdk/fork_experiments.go. With the flag off, tool lists, routes and UI match upstream.
API Swagger annotations on new public endpoints. Audited types update enterprise/audit/table.go.
chatd docs coderd/x/chatd/ARCHITECTURE.md gets TODO lines only. Mike writes the text.
Validation Go suites run in Colima: a postgres:17 container, plus golang:<go.mod version>-bookworm --network container:<pg> with volumes coder-gen-gomod and coder-gen-gocache and postgresql-client-17 from PGDG. chatdmig tests use CHATDMIG_TEST_DATABASE_URL='postgres://[email protected]:5432/postgres?sslmode=disable'. Never create a postgres role on the live Postgres. Frontend: site/AGENTS.md commands plus frontend-deep-review for any site/ diff.
Review implement-flow ends with codex-review-loop; Codex is installed (2026-11-08). If @codex review gets no reply within 30 minutes, tell the lead and run code-quality-review with Opus until Codex answers. Mike (2026-11-09): fix real defects in the PR's own change; drop scope creep and defensive bikeshedding with a one-line reply and a resolved thread, no follow-up issue. Upstream is only a sync source: never report or file anything upstream.
UAT coder-agents-uat through Coder MCP on the local deployment (http://127.0.0.1:3000, templates devcontainer or docker, RUNBOOK "Running a branch in a dev container workspace"). The remote agent runs scripts/develop.sh for the branch inside its workspace (plan decision uat). Never coder-local use a branch build: that replaces Mike's daily server.
Ready When a PR meets the merge bar, send the lead (task_send_message to 8ac7791132) READY #<pr> <head sha> with the CI, Codex, UAT and open-thread evidence, then wait. Never merge yourself.
Merge The lead merges (Mike, 2026-11-08). Merge bar: green fork-ci on the exact head, a clean Codex verdict, or Codex findings that were all fixed or dropped under the scope rule (the lead confirms each drop), no unresolved threads, UAT PASS on the head or on a SHA whose later commits only answer review, and a lead review of the diff against the brief. Squash, except sync and upstream stack PRs, which take a merge commit. A merge to fork main deploys Mike's daily server through autodeploy within about 5 minutes plus a drain of up to 30 minutes, so the lead merges one PR at a time and waits until Fork ops reports the deploy healthy. Experiments stay off on that server until Mike enables them.
Follow-ups A defect in merged code or on the daily server becomes an issue in ibetitsmike/coder with label followup. Fork ops triages it; an accepted one gets its own workspace running implement-flow.

Activity

  1. added
    pstack-parity
    on Nov 8, 2026
  2. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum posted this on behalf of @ibetitsmike.

    Opened #32 (chat_todos node and fork queries), PR 1 of the W4 stack.

  3. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    W4 status: PR #32 (chatd.chat_todos node + forkdb queries) is READY at ebb62e6: fork-ci green, Codex findings fixed or dropped (owner TODO in chatd ARCHITECTURE.md left for Mike), UAT PASS on an upgrade from main. Next up: PR2 todo tools (stacked, opens after #32 merges), PR3 todo re-injection after compaction in progress.

  4. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    W4 status: #32 merged. #34 (todo_write/todo_read, pubsub, list_agents todos) is READY at 27ecac7 with green fork-ci, a clean Codex verdict and UAT PASS.

    Follow-ups recorded here:

    • Plan-mode turns and Explore children do not get the todo tools: upstream allowlists builtinPlanToolAllowed and exploreToolAllowed in turn_environment.go filter them, and the fork has one hook line in that file already. Letting them through needs a second hook or fork-side filtering; Mike's call.
    • Owner TODOs in coderd/x/chatd/ARCHITECTURE.md (TODO(fork-chat-todos)) wait for Mike's prose.
  5. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    Follow-up for the todo snapshot (#35), a product call for @ibetitsmike: after /clear, the stored todo list goes back into the prompt like it does after compaction, the same as the project memory index. The UI keeps showing the list, so hiding it from the model would make the two disagree. If /clear should drop the plan, the options are to clear the stored list with the context, or to skip the snapshot until the model calls todo_read or todo_write again. Raised by Codex on #35.

  6. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    W4 follow-ups from Codex on #48 (read_chat_transcript), both product calls for @ibetitsmike:

    • /clear: the tool can read history from before a /clear, since /clear keeps the transcript and the tool reads it. If /clear should hide that history from the model, the tool needs to start at the latest clear boundary, which needs a new fork query (the chat row does not record the boundary). Xum's own session_history stops at a manual reset, for comparison.
    • Plan mode and Explore: read_chat_transcript has the same allowlist gap as the todo tools (recorded above).
  7. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    W4 status: #48 (read_chat_transcript) is READY at 79832c2. fork-ci is green, the Codex verdict is clean with 0 open threads, and UAT passed every transcript acceptance check, including a root reading its grandchild. Next up: PR6 (search_chats and the last N tool calls in wait_agent).

  8. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    W4 status:

  9. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

    Xum acted for Mike.

    W4 closeout

    All W4 work is merged into fork main (now 68fbdea615), behind fork-chat-todos except where noted. With the experiment off, tool lists, routes and UI match upstream.

    Scope

    # Scope item PR Coverage
    1 chatd.chat_todos node and forkdb queries #32 TestUpsertChatTodos, TestForkQuerier
    1 todo_write and todo_read through appendForkTools, a pubsub event per write #34 TestChatTodoTools (it also subscribes to the pubsub event for each write)
    1 Todo routes (get and watch) #36 TestForkChatTodos, TestForkChatTodosPermission, TestForkChatTodosWatch, TestForkChatTodosWatchResync, TestForkChatTodosExperimentOff
    1 R6.4: a parent reads each child's list through list_agents #34 TestForkListAgents
    2 Re-inject the list as a model-only message after compaction #35 TestTodoSnapshotMessage (RestoredAfterCompaction, ClearedListAfterCompaction, NothingWhileToolCallsArePending and others)
    3 Live todo panel above the composer through the W0 slot #43 Vitest and stories in the PR. UAT in Chromium with a local model
    4 read_chat_transcript (R5.1, R5.2, R5.4): cursor pages, role and part filters, byte budget, truncation, reads as the owner, descendants, StripInternal #48 TestReadChatTranscript (PagesTheUserVisibleMessages, BoundsThePageSize, ReadsAsTheChatOwner, RejectsInvalidArguments)
    4 search_chats (R5.3) #52 TestSearchChats (FindsTheOwnersTopLevelChats, FindsChatsSharedWithTheOwner and others)
    4 R5.5: wait_agent returns the last N tool calls #53 TestWaitAgentIncludeToolCalls
    5 R12.3: inline MP4 playback. It was missing for agent-attached MP4s, so this adds it #60 ForkAttachmentPreview.test.tsx, stories AttachedVideo, ExperimentOff, ExpiredVideo. TestGetChatFileByteRange covers the byte-range serving, which has no experiment gate

    Other: #55 regenerates the apidoc for the todo routes (closes #54) and adds a fork-ci drift check.

    Acceptance (PRD 6.5, 6.6)

    Leaving this open for the lead to close.

  10. ibetitsmike commented on Nov 9, 2026

    @ibetitsmike
    OwnerAuthor

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

    W4 is complete. Every scope item is merged into fork main and deployed (68fbdea615), as mapped in the closeout comment.

    On 2026-11-09 the daily server, running 68fbdea615 with the fork experiments on, passed a five-item smoke test:

    1. buildinfo and /api/v2/experiments match the deploy.
    2. todo_write, todo_read, read_chat_transcript and search_chats run from a real chat.
    3. The todo pill and popover from feat(site/src): show the chat todo list in the composer #43 show the stored list.
    4. Chat file Range requests return 206 and 416, and a plain GET returns 200 with a matching sha256.
    5. An MP4 attached with attach_file plays inline.

    Item 5 has one gap. With the turn's steps collapsed, the MP4 appears only as a download card in the turn's Attachments menu. That is tracked in #64.

    Product calls left for @ibetitsmike:

    • /clear restores the todo list.
    • read_chat_transcript can read history from before a /clear.
    • Plan-mode turns and explore children don't get the todo tools (allowlist gap).
    • Seeing the todo list after a user-side /compact is covered by design, not by UAT. The panel reads the stored list through the feat(coderd): add the chat todo list routes #36 routes, and coderd has no path that deletes chat_todos.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pstack-parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions