Repository navigation
feat(coderd/x/chatd): add the chat_history tool behind fork-token-budget - #313
Conversation
@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: decfb2175a
ℹ️ 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".
…te the transcript skip
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7718cd388a
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06f5935855
ℹ️ 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. Nice work! 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". |
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
# Conflicts: # coderd/x/chatd/ARCHITECTURE.md
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
Merged as 9c4c333 (squash) at 07:39Z. Before the merge, the server was confirmed on the previous deploy, 3a79dd3. Gates on head a832964:
Not exercised: the tool against a live model on a deployed server. |
Part of #283. This is PR 2 of 4 in the token-budget stack. PR 1 (#285, notes) is merged.
What this adds
A read-only
chat_historytool behind thefork-token-budgetexperiment. It lets an agent look back at messages that are no longer in its context window. It has four actions:list_windows: lists the context windows of the chat. A compaction starts the next window (chat_summarized). A clear starts over atw:1.list_items: lists the messages in one window, with an ID, a role and a short preview.search: finds messages in the chat that contain a text.read_item: reads one message with long parts cut, or one part in full, a slice at a time.Limits:
Plan, explore and read-only custom agent types do not get the tool, as with the notes tool.
History is read-only, so its calls do not need to run in order.
Files
coderd/x/chatd/fork_chat_history.goholds the tool, with tests infork_chat_history_internal_test.go.coderd/database/forkdb/queries/chat_history.sqlholds the queries. The generated code and the dbauthz, dbmetrics and mock wrappers are updated to match. There is no schema change.fork_tools.goregisters the tool.fork_chat_transcript.gonow skipschat_historycalls, as it already skips its own, so paging does not loop.coderd/x/chatd/ARCHITECTURE.mdanddocs/fork/pstack-adapter.md.Tests run
Every command ran under
flock ~/.fork-go.lock../coderd/database/forkdb/generate.shmade no diff.go build ./coderd/...succeeded.go test -count=1 -v -run '(TestChatHistoryTool|TestChatNotesTool|TestChatTranscript|TestForkMessageAgentReplay)' ./coderd/x/chatd/passed.go test -count=1 -run TestForkQuerier ./coderd/database/dbauthz/passed.go test -count=1 ./coderd/database/forkdb/ ./coderd/database/dbmetrics/passed.go test -count=1 -run TestExperimentDisplayNames ./codersdk/passed.golangci-lint run --config=.golangci.new-code.yaml --new-from-merge-base=origin/main ./coderd/x/chatd/ ./coderd/database/...found 0 issues.make lint/emdash lint/markdownpassed.Not verified
Note
I rebuilt this branch from
mainwith a cherry-pick after #285 was squash-merged. The branch had not been published, so it is one commit on top ofmain.The dropped #285 P2 (a notes append replayed after a crash) is not fixed here. Fixing it needs a new chatdmig node and new queries, and this PR has no schema change. I can do it in a separate small PR.