Repository navigation
feat(channels): claim-bound write abilities for external chat runtimes - #586
Merged
Merged
Conversation
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.
Closes #585.
Lets a runtime outside the process holding a chat run claim write that run and its transcript, using the same stores the in-process loop uses.
New REST-visible abilities, all gated by
agents_chat_run_write_claim_permission(the run'sclaim_tokenis the only credential; client principals and caps are never consulted):agents/append-chat-run-messagesagents/update-chat-run-message: edit in place, for streamed textagents/append-chat-run-eventsagents/set-chat-run-status: running → completed/failed/cancelled or suspended; the response carries cancellation visibilityagents/claim-chat-run-input: queued user answers, e.g. toinput_requiredAccepted-pending: a
wp_agent_chat_handlermay returnstatus: pending(newWP_Agent_Run_Outcome::STATUS_PENDING→ run-controlrunning).agents_chat_run_claimed()then leaves the run open instead of terminalizing it.Review focus: the claim token acts as a bearer credential over REST. That's intentional (the runtime is a separate process with no WP user), but check its lifetime and comparison in
verify_run_claim().Verification
php tests/chat-run-write-smoke.php: 59 assertions. Covers foreign-claim rejection, append/update, events + status transitions, the input_required round trip, and cancellation (owner cancel → runtime heartbeat sees it; committed cancel beats a success claim).composer smoke: full suite, exit 0.Finalized outside Homeboy: the cook produced this patch, but its gate (
homeboy review test <component> --changed-since origin/main) could not run on the lab runner (merge base unreachable / no test extension for this component), and continuation is closed. I re-applied the cook's patch to a fresh worktree off origin/main and ran the verification below by hand.AI disclosure: written by a Pi coding agent via Homeboy cook, verified and opened by Extra Chill Bot, authorized by @chubes4.