feat(agent-runtime): draft rationale from the audit pass + on-demand drafting - #866
Open
kmonsoe wants to merge 1 commit into
Open
feat(agent-runtime): draft rationale from the audit pass + on-demand drafting#866kmonsoe wants to merge 1 commit into
kmonsoe wants to merge 1 commit into
Conversation
…drafting The audit JSON contract gains a reviewer-facing rationale field; the handler parks it and the turn's tool names on draft_reply metadata via setDraftReply (REST + in-process clients extended). New draft-request handler mode answers conversation.draft_requested: forces draft delivery on auto conversations and tolerates the requester's claim, completing the Ask-for-a-draft round trip. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CPwvC1MqF1uhpNqC8BmvQN
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #865 (base is
feat/conv-review-queue-read-model— retarget tomainbefore merging if #865 lands first, per the usual stack discipline).Implements handover item 4 ("reasoning is nearly free") plus the runtime half of "Ask for a draft":
rationalein the audit contract (agent-runtime/src/audit.ts): the audit pass now returns{"rationale": "...", "actions": [...]}— one or two sentences for the human reviewer stating what the reply asserts and what grounds it. Parsed defensively (trimmed, capped at 1000 chars, null when absent); all fail-open paths returnrationale: null.rationale+ the turn'stoolNamesthroughsetDraftReply; backend stores them on thedraft_replymetadata (retrievedDocumentIdsalready lived there). The review pane's "why" block reads straight off the draft and hides when no rationale is present — noauditEnabledplumbing needed (it has none in production today).draft-requesthandler mode: the runner subscribes toconversation.draft_requested(emitted byPOST /v1/conversations/:id/request-draftfrom feat(conv): review-queue read model, internal notes, draft reject stamps #865) and runs the handler with draft delivery forced — even onagentMode: autoconversations — tolerating the requester's own claim and an existing assignee. Voice/closed/no-end-user/off guards stay.realtime-event-bus(in-process bus) and the agent-runtime realtime client, wired inagent-host/src/runner.service.tsnext to greet.Tests
setDraftReplyopts,requestDraftparks a draft on a claimed auto conversation without posting).🤖 Generated with Claude Code
https://claude.ai/code/session_01CPwvC1MqF1uhpNqC8BmvQN