feat(task-board): put a code agent's PR on the board for review - #6344
Open
guitavano wants to merge 1 commit into
Open
feat(task-board): put a code agent's PR on the board for review#6344guitavano wants to merge 1 commit into
guitavano wants to merge 1 commit into
Conversation
A GitHub-imported (or template-clone) coding agent had no way to record work for review after opening a PR. Do the board bookkeeping in code, triggered off the existing PR-open signal, so it's deterministic — with a single focused LLM call for the one judgement that isn't mechanical (is this work already tracked?). - New reaction reactToPrOpenedForBoard wired into the PR-open MCP hook (cluster-mcp-tool-hooks onPrOpened). No-ops for a run that already has a linked card (Super Agent), so it can't double up. For an ad-hoc chat with no card it: loads open cards → one generateObject "fast"-tier call decides create vs update(taskId) → acts in code (create/update the card in review, link the PR + thread, post an optional reviewer note). Best-effort; never throws into the run. applyBoardDecision is split out (no LLM) and covered by a real-Postgres integration test. - TASK_BOARD_ITEM_CREATE/UPDATE accept an optional prUrl to link a PR in one call — used by the reaction and available for an explicit user request. - Coding agents still get scoped board tools at runtime (codeAgentBoardConnection) for explicit asks; the always-on system-prompt instruction is dropped in favour of the deterministic hook. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
guitavano
force-pushed
the
guitavano/code-agent-board-tools
branch
from
August 20, 2026 17:38
95a11e3 to
9d4a869
Compare
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.
Summary
A GitHub-imported (or template-clone) coding agent had no way to record work for review after opening a PR. This does the board bookkeeping in code, triggered off the existing PR-open signal, so it's deterministic — with a single focused LLM call for the one judgement that isn't mechanical: is this work already tracked by a card?
Design chosen after discussion: not an always-on system-prompt instruction (the main loop skips it, and it taxes every turn of every coding agent), and not a blind auto-create (loses the dedup judgement). A code hook fires reliably and still delegates the create-vs-update decision to the model.
What changed
reactToPrOpenedForBoardis wired into the PR-open MCP hook (cluster-mcp-tool-hooks.tsonPrOpened). It no-ops for a run that already has a linked card (the Super Agent path — handled byadvanceTaskBoardForRun/capturePrForRun), so it can't double up. For an ad-hoc chat with no card it: loads the org's open cards → onegenerateObjectcall on the cheapfasttier decidescreatevsupdate(taskId)→ acts in code: create/update the card in review, link the PR and the thread, and post an optional reviewer note. Best-effort — it never throws into the run that opened the PR.applyBoardDecision(no LLM) performs the storage writes and is covered by a real-Postgres integration test (create; update from an earlier lane; unknown-taskId → fallback create; never regress adonecard). The LLM decision (decideBoardActionForPr) is best-effort and degrades to no-op without a model provider.prUrlon CREATE/UPDATE.TASK_BOARD_ITEM_CREATE/UPDATEaccept an optionalprUrlto link a PR in one call (parsed before any write, so a bad/non-PR URL fails without orphaning a card). Used by the reaction and available for an explicit user request.codeAgentBoardConnectiongrafts an in-memory SELF connection scoped toTASK_BOARD_ITEM_LIST/CREATE/UPDATE+COMMENT_CREATEonto agents with a checkout — for explicit user asks ("open a PR and put it in review"). NeverREVIEW_DECISION/PROMOTE: an agent must not sign off on its own work. Nothing is persisted on the agent, so it covers existing and new agents with no backfill.Why code, not prompt
onPrOpenedsignal (a real PR was opened), notonThreadFinished(most threads finish without a PR).Testing
pr-open-board-reaction.integration.test.ts— create / update / fallback / no-regress.codeAgentBoardConnectioninject/skip decision.prUrllinking on create/update, and rejection of a non-PR URL.bun run check(api/web/e2e),fmt,lint,knipclean.Follow-up (not in this PR)
onPrOpenedfires mid-run, so injecting a chat line ("Task created: …") is a separate, delicate change (best done at thread-finish). For now the new/updated card broadcasts live to the board and carries the agent's note as a comment.closesOwnReviewguard doesn't apply, so an imported agent could move its own cardin_review → done; left as-is since a human drives the chat.🤖 Generated with Claude Code