Repository navigation
feat(coderd/x/chatd): add the read_chat_transcript tool behind fork-chat-todos - #48
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: 905758a16c
ℹ️ 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: 99666619e8
ℹ️ 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".
…-6-read-transcript # Conflicts: # coderd/x/chatd/ARCHITECTURE.md # coderd/x/chatd/fork_chat_todos_internal_test.go
@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: 03081692bc
ℹ️ 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 |
…-6-read-transcript
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03081692bc
ℹ️ 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: bac39dbc51
ℹ️ 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: Didn't find any major issues. You're on a roll. 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2481f93b1
ℹ️ 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: 79832c26bf
ℹ️ 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. Breezy! 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. Follows #36 (merged); independent of #43.
Adds
read_chat_transcript, a chat tool that reads the stored messages of a chat in pages, so a chat can recover what compaction took out of its context. Behindfork-chat-todos, like the todo tools;appendForkToolsadds it.chat_id(empty reads the calling chat),after_idcursor,roles,part_types,limit(1 to 100, default 20) andmax_bytes(4096 to 65536, default 32768). A page returnsnext_after_idandhas_more; messages that the filters skip still move the cursor.httpmw.UserRBACSubjectanddbauthz.As, likeasOwnerinchattool/listtemplates.go), never as chatd, which can read every chat. A chat that does not exist and a chat the owner cannot read return the same error.parent_chat_idwalk; a walk would only allow chats the owner can already read.bothvisibility are returned: model-only context (system prompts, the todo snapshot) and user-only projections (theacp_wait_agentuser result with the subagent's private reasoning) are skipped. So arehook-noticeandsourceparts, which never reach the model, and rows with a call or result ofread_chat_transcriptitself, so paging through the calling chat does not return earlier pages again. Messages go throughdb2sdk.ChatMessage, which appliesStripInternaland drops model-only parts, so provider metadata and credentials stay out.chatloop.TruncateToolResultTextto the smaller of 16 KiB andmax_bytes; cut args or results become a JSON string because a cut JSON value is not valid. Inline file bytes and parsed commands (a copy of the args) are dropped. The page stops before the message that would passmax_bytes. The first message always goes on the page, so every page moves the cursor, but with only the parts that fit (at least one);omitted_partscounts the rest. One call scans at most 1000 rows.ARCHITECTURE.md: the existing fork tools TODO now names the new tool.Validation:
TestReadChatTranscriptpasses against Postgres 17 with the store wrapped indbauthz: paging with cursor and filters, page bounds and truncation, reads as the owner (a root reads its grandchild, another user's chat is refused until it is shared with the owner), and argument errors. Negative controls: reading as chatd, dropping the role filter, dropping truncation, and dropping the byte budget each fail one subtest../coderd/x/chatd/...passes;go vetis clean.UAT on a dev instance with a local model (79832c2, the head,
fork-chat-todosandfork-nested-subagentson), from chats owned by a plain member:/compactthat compressed the first messages, the tool returned the first user message verbatim, and the model quoted it in a code block.PATCH /chats/{chat}/acl), the same call returned its title and first message.spawn_agent, the root read the grandchild's first message.Not in this PR, recorded on #10 as product calls: plan-mode and Explore turns do not get the tool (the same upstream allowlist gap as the todo tools), and the tool can read history from before a
/clear. Also not in this PR: the model-only projection of anacp_wait_agentresult is not returned, because readingmodelrows needs a new fork query.