Skip to content

Runs that stop to ask: keep the questions, answer from CoderHelm, never ask twice - #330

Merged
nambok merged 2 commits into
mainfrom
feat/run-questions
Oct 27, 2026
Merged

nambok merged 2 commits into
mainfrom
feat/run-questions

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

When a run stops as "Needs your answer", the run page now shows exactly what is missing and takes the answer there. A run that stops to ask keeps its questions on the run (each in plain words, why it blocks the change, and candidate answers when the planner found any) with a link to the comment it posted. A new endpoint takes answers, posts them on the ticket as " answered in CoderHelm:", and continues the work with the answers in triage and planning context.

It also fixes a related loop: a person replied "go ahead and open your own" to the "A pull request is already open" notice, and a later run posted the same notice again and asked whether the other pull request should be closed. Replies to that notice are now read (by the model), recorded on the ticket and honoured on every later run. Settled questions are never asked again, and the same notice is never posted twice.

Changes

  • common::run_questions: questions, answers, validation, parsing the planner's CLARIFICATION_NEEDED: blocks, the ticket reply text, and the "resolved decisions" section triage and the planner read.
  • common::ticket_state: decisions (a person's choice on a notice, such as open_pr:owner/name#N own or existing) and notices (what CoderHelm posted, so it isn't posted twice).
  • Worker:
    • The plan clarification, unknown-fix and empty-change stops store structured questions plus the comment's URL (the Jira comment link is built from the app's comment id). The planner prompt asks for the structured format.
    • Answers (from this run's message, earlier runs on the ticket and recorded decisions) reach triage, the planner and the plan check word for word, and are part of the plan cache key.
    • resolved: the model judges each question a plan wants to ask against what is settled (covered, or CoderHelm's own call, such as closing someone else's PR). The plan is sent back once, and anything still covered is dropped from both the clarification and the decision's questions. If the model call fails, it falls back to comparing words.
    • open_pr_choice: before branching, an open PR someone else made for the ticket is checked against the recorded decision. If there is none, replies to the notice are read newest first: run-page answers, Jira notes and GitHub issue comments after the notice. The model classifies each as own, existing or unclear, and the first clear one is recorded. own opens CoderHelm's own PR and leaves the other open. existing works on that PR's branch when it is in the same repo. Only an undecided PR stops the run.
    • Notices: a notice is linked instead of posted again when it was already posted with the same text, or when it is about the same PR and has no answer yet. The open-PR notice is now a run-page question with the two choices.
  • Gateway:
    • POST /api/runs/{run_id}/answer (members and up, the runs capability, public API). It takes answers, claims the run with a conditional write from needs_input to retried (so a second answer or a racing Retry gets 409), queues the ticket with the answers under a pre-minted run id, then posts the reply (Jira app or GitHub). A choice made with a notice's button is recorded on the ticket at once.
    • GET /api/runs/{run_id} returns questions (with decision), questions_url, answers, answers_url and continued_run_id. docs/api/openapi.json is regenerated.
    • Retry's ticket message builder is shared with the answer endpoint, with no change to Retry's behavior.

Verification

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace all pass (common 1143, gateway 556, worker 711).
  • New tests:
    • Questions are parsed and stored, and get_run returns them.
    • The answer handler, run against a stand-in for DynamoDB, SQS and the Jira app: members only (a viewer is refused before anything is read), blank or unknown answers are refused, a run that moved on is refused with no second run and nothing posted, the reply is posted with the person's name, and the run continues with the answer verbatim.
    • A button choice records the decision.
    • An answered question isn't asked again: words, and model verdicts including the field case.
    • The open-PR notice question, replies newest first and only after the notice, the classifier schema, and the notice dedupe rules.

A run that stops as needs_input now stores what it asked on its record:
each question in plain words, why it blocks the change, and candidate
answers when the planner found any, plus a link to the comment it posted
on the ticket or issue. The planner is asked for that shape.

POST /api/runs/{run_id}/answer takes answers for those questions (members
and up), claims the run in one conditional write, starts the ticket again
with the answers on the message, and posts them on the ticket as
'<name> answered in CoderHelm:'. Triage and the planner read the answers
word for word; a plan that asks an answered question again is sent back
once, and answered questions are never stored or posted again.

The run API returns questions, questions_url, answers, answers_url and
continued_run_id; docs/api/openapi.json is regenerated.
The guard that stops when someone else's pull request for the ticket is
open now reads the answers to its notice (replies on the Jira ticket or
GitHub issue, newest first, and answers on the run page), has the model
classify each as own / existing / unclear, and records the first clear
one on the ticket's record. Every later run honours it: own opens
CoderHelm's own pull request and leaves the other open; existing works on
the other pull request's branch.

Recorded decisions and earlier answers reach triage and the planner as
resolved decisions. Before a plan's questions reach a person, the model
judges each against them (covered, or CoderHelm's own call such as
closing someone else's pull request); those are sent back once and then
dropped.

A notice already posted with the same text, or about the same pull
request and not answered, is linked instead of posted again. The open
pull request notice is a run-page question with its two choices; choosing
one records the decision on the ticket.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant