feat(planner): the planner reads the issues a pull request links to #32

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:feat/planner-issues into main 2026-11-16 00:06:18 +00:00
Owner

Why

The AI planner only read the pull request itself: its title, body, diff and comments. Most Longshot PRs say what they fix by linking an issue ("Fixes #40"), and the issue is where the bug is described: what goes wrong, where in the game, on which hardware, and how to make it happen. Without it, the planner guesses where to test.

What changed

Before it writes a plan, the planner looks up the issues the PR links to and gives the model what they say.

  • planner.issue_refs: finds the numbers named in the maintainer's instructions, the PR's title and body, and its comments, first named first. It picks up #12, MagicBeanDev/Longshot#12, and links to this repository's /issues/12 or /pulls/12. It leaves out other repositories (MagicBeanDev/Beanstalk#21), HTML entities ((), URL anchors (page#5) and the PR's own number.
  • planner.gather_issues: looks up at most 10 of those numbers and keeps at most 4 issues; a number that is a pull request, or nothing, is skipped. Each issue gives its title, state, text (at most 4 KB) and first comments, oldest first (at most 3 KB together, each at most 1.5 KB). The farm's own comments are left out. A lookup that fails is logged and skipped, so it never stops the planning.
  • The prompt: each issue's number and state are outside the data blocks, and its title, text and comments are inside them (ISSUE_TITLE, ISSUE_BODY, ISSUE_COMMENT), with the same random word as the PR's own blocks. The system text now says that the people on linked issues wrote data too.
  • forgejo.get_issue (GET /repos/{repo}/issues/{n}) and the fake Forgejo's issues.
  • Docs: docs/test-plan.md (what the model reads) and docs/architecture.md.

Testing

  • Coordinator tests: 400 passed, 1 skipped, against a local Postgres.
  • New tests: test_issue_refs (the forms it accepts and the ones it leaves out) and test_gather_reads_the_linked_issues. The second covers an issue linked from the body and one from a comment, a number that is a PR, a missing number, the caps, the farm's comments being left out, and the prompt's blocks. test_each_untrusted_item_in_its_own_nonce_block now also checks that an issue's text can't close its block.
  • Not tested: a real plan written by the model with a linked issue. That happens after the deploy, on the next @Beanstalk for a PR that links an issue.

Risks

The prompt grows by at most about 28 KB when a PR links 4 long issues. The text comes from anyone who can comment on an issue, so it is marked as data like the PR's comments. The model's answer passes the same checks as before, whatever it read.

## Why The AI planner only read the pull request itself: its title, body, diff and comments. Most Longshot PRs say what they fix by linking an issue ("Fixes #40"), and the issue is where the bug is described: what goes wrong, where in the game, on which hardware, and how to make it happen. Without it, the planner guesses where to test. ## What changed Before it writes a plan, the planner looks up the issues the PR links to and gives the model what they say. - `planner.issue_refs`: finds the numbers named in the maintainer's instructions, the PR's title and body, and its comments, first named first. It picks up `#12`, `MagicBeanDev/Longshot#12`, and links to this repository's `/issues/12` or `/pulls/12`. It leaves out other repositories (`MagicBeanDev/Beanstalk#21`), HTML entities (`(`), URL anchors (`page#5`) and the PR's own number. - `planner.gather_issues`: looks up at most 10 of those numbers and keeps at most 4 issues; a number that is a pull request, or nothing, is skipped. Each issue gives its title, state, text (at most 4 KB) and first comments, oldest first (at most 3 KB together, each at most 1.5 KB). The farm's own comments are left out. A lookup that fails is logged and skipped, so it never stops the planning. - The prompt: each issue's number and state are outside the data blocks, and its title, text and comments are inside them (`ISSUE_TITLE`, `ISSUE_BODY`, `ISSUE_COMMENT`), with the same random word as the PR's own blocks. The system text now says that the people on linked issues wrote data too. - `forgejo.get_issue` (`GET /repos/{repo}/issues/{n}`) and the fake Forgejo's `issues`. - Docs: `docs/test-plan.md` (what the model reads) and `docs/architecture.md`. ## Testing - Coordinator tests: 400 passed, 1 skipped, against a local Postgres. - New tests: `test_issue_refs` (the forms it accepts and the ones it leaves out) and `test_gather_reads_the_linked_issues`. The second covers an issue linked from the body and one from a comment, a number that is a PR, a missing number, the caps, the farm's comments being left out, and the prompt's blocks. `test_each_untrusted_item_in_its_own_nonce_block` now also checks that an issue's text can't close its block. - **Not tested:** a real plan written by the model with a linked issue. That happens after the deploy, on the next `@Beanstalk` for a PR that links an issue. ## Risks The prompt grows by at most about 28 KB when a PR links 4 long issues. The text comes from anyone who can comment on an issue, so it is marked as data like the PR's comments. The model's answer passes the same checks as before, whatever it read.
feat(planner): the planner reads the issues a pull request links to
Some checks failed
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 3s
CI / Coordinator tests (pull_request) Has been cancelled
CI / Agent build and checks (pull_request) Has been cancelled
CI / Coordinator image (pull_request) Has been cancelled
59ca454769
The planner now looks up the issues named in the PR's title, body, comments
and the maintainer's instructions (#12, Owner/Repo#12 for this repository,
or a link to /issues/12), and gives the model each one's title, state, text
and first comments, as untrusted data blocks like the PR's own comments.
At most 4 issues, from at most 10 numbers looked up; pull requests and
missing numbers are skipped.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!32
No description provided.