Repository navigation
feat(coderd/x/chatd): restore the todo list after compaction - #35
Conversation
Compaction replaces the assistant and model-only rows that carry the todo list, so the model is left working from a plan it can no longer see. Before each generation step the fork now appends a model-only snapshot of the stored list when the prompt carries none, the way the project memory index is kept current.
Compaction writes a compressed model-only summary and the prompt drops the rows before it; it does not mark the replaced rows compressed.
|
@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: 870f3f5416
ℹ️ 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".
A snapshot or a todo result in the prompt only shows the version the model read, so a prefix check left a stale plan in place: a snapshot of an older list survived an edit that deleted the tool rows, and a read that raced a write answered with an earlier version. Both now compare the version the prompt last showed with the stored one, and a list that was emptied sends an empty snapshot so the model drops the plan instead of finishing it.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb5141c64a
ℹ️ 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".
Skip the prompt read for a chat that never stored a list, send the empty snapshot when compaction removed every carrier of a cleared list, render items as JSON lines so content cannot read as another item, and cap the snapshot at the smallest tool result budget.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8df23bcb7
ℹ️ 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".
Bound the snapshot by the tool result budget of the chat's model, so a large list stays whole wherever todo_write's result could hold it, and drop the todo_write instruction from the header, since plan mode turns do not offer the tool.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64b224b7a7
ℹ️ 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".
The parallel subtests shared the parent's 25 second context and could start after it expired on a busy runner.
The header and version line sit outside the budget, so the items are cut only when the todo tool result that showed them was cut too.
@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". |
Gates checked on head |
Part of #10. Follows #34 (merged).
After compaction the model loses the todo list it made: the summary replaces the
todo_writeandtodo_readrows, and a summary keeps at best a paraphrase. In UAT the model misread item statuses from a summary. This PR puts the stored list back into the prompt (behindfork-chat-todos).syncForkContextruns the project memory index sync as before, then checks the todo list. The prompt's latest carrier is a snapshot this sends or a non-errortodo_write/todo_readresult, and both name a version. When the stored version differs from the one the prompt last showed, or no carrier is left, it adds a model-only user message with the stored list. That covers compaction, an edit that deleted the tool rows, and a write that raced a read.Version: nline, and one JSON object per item, so content with line breaks cannot read as another item. A list that was cleared sends(empty), so a plan the summary still mentions is dropped. A chat that never stored a list (version 0) skips the prompt read.todo_writeresult gets, and they take no more bytes than that result's items, so they are cut only when the result was. A cut snapshot keeps its header and version, so it is not resent every step./compactdoes not start another reply.generation.gochanges one line: the call now goes tosyncForkContextin the fork filefork_context.go, the place for later fork prompt context. A lookup failure is logged and the turn goes on without the snapshot.ARCHITECTURE.md: the existingTODO(fork-chat-todos)now also names the snapshot.Validation:
TestTodoSnapshotMessagecovers the snapshot after a real compaction shape (summary row, earlier rows dropped), subagent chats, current and stale snapshots and results, error and version-less results, a cleared list with and without a carrier, line breaks in content, the largest list on a large and a small context model, no list or experiment off, and pending tool calls. The wholecoderd/x/chatdpackage passes against Postgres 17.UAT on a dev instance with a local model, last run on 64b224b (later commits change only the cap on oversized lists and test contexts): after
POST /chats/{id}/compact, one snapshot row withVersion: 3followed the summary, the model listed the right statuses, no extra reply ran before the next user message, and the next turn added no second snapshot. The PR2 build answered the same question with wrong statuses.Open question for the follow-ups on #10: after
/clearthe list comes back like after compaction, as the memory index does.