Skip to content

A comment written on a ticket while a run works is kept, acknowledged and acted on - #664

Merged
nambok merged 4 commits into
mainfrom
fix/ticket-comments-during-run
Nov 14, 2026
Merged

nambok merged 4 commits into
mainfrom
fix/ticket-comments-during-run

Conversation

@nambok

@nambok nambok commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A run asked three questions on its ticket ("Questions only a person can answer"), proposed defaults and kept building. A person answered on the ticket twenty minutes later. The gateway logged Ignoring Jira comment — run already in progress and returned: nothing acknowledged the comment, the run never saw it, and its notes kept saying it went on without the answers. Comments written before any run existed were dropped as No runs found for Jira comment — ignoring, and nothing read them when the run started.

Root cause: handle_jira_comment in services/gateway/src/routes/jira_webhook.rs returned early for a run in running, queued or awaiting_ci and kept nothing, and no step of the run ever read the ticket again. The same drop existed for GitHub issues (a comment on an issue with a run in flight that did not mention CoderHelm, and Skipping slash command — run already in flight).

A person who writes on a ticket CoderHelm is working on now gets an acknowledgement, and what they wrote is acted on, through one path for every ticket source.

Changes

One shared path: common::ticket_comments (new)

  • A comment is kept on the settings table, one item per comment id (TICKETCOMMENT#<ticket>#<source>-<id>, conditional put), so a webhook delivered twice is one comment. Items expire through the table's ttl: 14 days for a comment written while a run worked, 7 days for one written before a run. Nothing reads a comment after it is acted on; the record only guards against the same comment being delivered again, and keeps one nobody read (a worker that stopped, a round that could not be sent) for what comes next. A run and its wait for CI end within 26 hours and the rounds on its pull request follow within days, so two weeks covers them.
  • stores_before_run: a comment written while no run works is stored only for a ticket CoderHelm has something to do with (the team's trigger label, or assigned to CoderHelm, when the comment is written). Comments on every other ticket are never stored.
  • is_person: CoderHelm's own comments and other bots are never taken (account type Bot/app, a [bot] login, CoderHelm's name in Jira, or text that is CoderHelm's own acknowledgement).
  • ack_for: one acknowledgement per comment, only for a person, only the first time it is seen, only while a run works. A reaction on GitHub, one short reply in Jira.
  • Class (answer, instruction, stop, not for CoderHelm), Stage (planning, building, reviewing, between steps, finished, cancelled) and decide: what happens with each class at each stage.
  • settle_open: each comment is claimed in one conditional write before anything is done with it, so two readers never act on it twice. A burst is read together in one model call.

Gateway

  • routes/ticket_comments.rs (new): receive keeps the comment, acknowledges it, adds a note to the run page, and sends the worker a message so it is read at once. keep keeps a comment written before a run, for a ticket that is CoderHelm's to work. on_github_issue_comment takes a comment on an issue whose run is working (only from a person with standing, as for any comment that starts work).
  • jira_webhook.rs: a comment for a run in progress goes to receive instead of being dropped; a comment on a ticket without a run is kept only when the ticket carries the trigger label or is assigned to CoderHelm (ticket_triggers, the same rule that starts a run), and is otherwise not stored; the comments the Jira app sends with the event that starts a run are kept then, which is how a run reads a ticket whose comments were never stored. The ticket's record notes whether that event carried comments at all.
  • github_webhook.rs (two small insertions): an issue comment that does not mention CoderHelm, and a mention or slash command while a run is in flight, go to the run instead of being dropped.

Worker

  • passes/ticket_comments.rs (new): at_boundary (the run's own step), after_step (a step ended), after_round (a round on the pull request ended), on_comment (a comment just arrived).
  • passes/mod.rs: the run reads its ticket's open comments when it starts and at the plan, implement, test and pull request boundaries, and orchestrate_ticket reads them once more when the step ends. report_questions keeps the run's questions on the run record so an answer is matched to its question; the note that said the run "goes on without the answers" now says it applies an answer when one arrives.
    • While planning: answers and instructions go to the planner word for word (as settled answers).
    • Once the plan is final: kept for the pull request. When the step ends with the pull request open they become one feedback round: where the answer differs from the default that was built, the code changes in the place the plan put that choice, the pull request says what changed, and the ticket is told.
    • A comment that says to stop ends the run at once, the way a cancel from the dashboard does (read as soon as it arrives, not at the next step).
    • Run finished with its pull request open: a feedback round. Ended waiting on a person or failed: the ticket starts again with the comments as the person's direction. Stopped by a person: kept on the ticket's record for the next run. Handed off to a fresh step: the next step reads them.
  • main.rs: a feedback or resume round reads the ticket's open comments when it ends.
  • jira_comment.rs: the comment reader handles open comments first; record_notes is shared.
  • A GitHub issue's existing comments are kept when a run starts on it, and read before it plans. A comment written before the run started is context: it never stops the run.

Jira app (coderhelm-jira)

  • A ticket event carries the ticket's newest 20 comments (src/comments.js, at most 200,000 characters of bodies in all, oldest left out whole), and a comment event carries the author's account type. Merging this publishes the app through the existing release workflow.
  • No new scope or permission: manifest.yml is unchanged, and the ticket's comment field is read with read:jira-work, which the app already has, so no site admin has to approve the update.
  • A gateway older than this change ignores the new fields: it reads the event as untyped JSON by key and never looks at comments or accountType.
  • A site on an older app version sends no comments with the event. CoderHelm has no other way to read a Jira ticket's comments (the app's web triggers return none), so the run says on its page that comments written before it started were not read (note_unread_earlier).
  • A run started by a plain Jira webhook (no app) gets its own note: the event that started it did not include the ticket's comments. That path holds only a webhook address and a signing secret, nothing that reads the Jira site, so there is nothing to fetch them with. The ticket's record keeps which of the two it was (event_comments_marker).

Run page

  • The run's activity shows the person's comment when it arrives and what CoderHelm did with it (progress notes, which the page already renders). No dashboard change.

Shared files touched: gateway/src/routes/github_webhook.rs (+17 −1), worker/src/main.rs (+8 −2), gateway/src/routes/mod.rs (+1), common/src/lib.rs (+2), worker/src/passes/incidents/mod.rs (+1), docs/incidents.md (+1 row, case aq).

Verification

  • cargo fmt --check --all, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace: all pass locally. node --test in coderhelm-jira: passes.
  • Tests added:
    • recording and idempotence: a_comment_is_kept_once_whatever_the_webhook_delivers, the_key_is_the_comment_id_and_a_missing_id_is_still_one_key, a_comment_during_a_run_is_kept_and_acknowledged_once
    • acknowledgement rule and loop guard: one_acknowledgement_per_comment_and_none_for_bots, only_a_persons_comment_counts, coderhelms_own_comments_and_bots_are_never_taken, github_gets_a_reaction_and_every_working_status_counts
    • each classification and each run state: each_class_at_each_stage, the_stage_comes_from_the_run_record, while_planning_answers_and_instructions_go_into_the_plan, while_building_or_reviewing_they_wait_for_the_pull_request, between_steps_they_stay_for_the_next_step, a_finished_run_gets_a_round_and_a_waiting_one_starts_again, a_cancelled_run_keeps_them_on_the_ticket_for_the_next_run
    • the stop comment: a_stop_is_honoured_at_once_while_the_run_works, a_stop_settles_only_itself_and_the_rest_stay_for_the_next_run, a_stop_ends_the_run_and_is_said_on_the_ticket
    • a burst and one action per comment: a_burst_is_read_together_and_each_comment_is_acted_on_once
    • existing comments at start: the_tickets_existing_comments_are_read_from_the_event, an_issues_existing_comments_are_context_for_the_run_that_starts, a_ticket_whose_comments_were_never_stored_gets_them_from_the_event_that_starts_the_run, an_event_from_an_older_jira_app_is_told_apart_from_a_ticket_without_comments, a_run_started_by_an_older_jira_app_says_earlier_comments_were_not_read, a_run_started_by_a_plain_jira_webhook_says_so_without_blaming_an_app, nothing_is_said_when_the_comments_came_or_nothing_is_known, an_older_jira_app_and_a_plain_webhook_get_their_own_note, comments.test.js
    • what is stored before a run: a_comment_on_a_ticket_coderhelm_has_nothing_to_do_with_is_never_stored, a_ticket_is_coderhelms_by_its_label_or_its_assignee, a_comment_before_a_run_is_stored_only_for_a_ticket_coderhelm_works, records_are_kept_two_weeks_and_a_week_before_a_run
    • the pipeline calls it: the_pipeline_reads_comments_at_its_boundaries_and_when_a_step_ends, the_webhooks_no_longer_drop_a_comment_for_a_run_in_progress
    • incident case aq_comment_during_run (four tests), listed in docs/incidents.md.
  • Not verified live: nothing was posted to a real ticket and nothing was deployed. The Jira reply, the GitHub reaction, the DynamoDB conditional writes and the model's reading of a comment run only against fakes and an in-memory store here.

Known limits:

  • A run whose worker dies without ending its step (ended later by the stuck-run sweep) keeps its open comments until the next event on the ticket: the next comment, round or run reads them.
  • A comment that reaches a run in the moment it ends waiting or failed is kept on the ticket's record for the next run; only the run's own step starts the ticket again.
  • A Jira site on an older app version sends no comments with the ticket event: the run's notes say earlier comments were not read. Comments written while the run works are read either way.

… and acted on

A run asked three questions on its ticket, proposed defaults and kept
building. A person answered on the ticket twenty minutes later. The
gateway logged that a run was in progress and dropped the comment:
nothing acknowledged it, the run never saw it, and its notes kept saying
it went on without the answers. Comments written before any run existed
were dropped too, and nothing read them when the run started.

Every ticket source now goes through one path (common::ticket_comments):

- The gateway keeps the comment once per comment id (a webhook delivered
  twice is one comment), acknowledges it on the ticket the first time it
  is seen while a run works (a reaction on GitHub, one short reply in
  Jira; never for CoderHelm's own comments or other bots), notes it on
  the run page and tells the worker at once.
- The run reads its open comments together when it starts and at its
  plan, implement, test and pull request boundaries. Answers and
  instructions go into the plan while it is being made. Once the plan is
  final they become one feedback round on the pull request when the step
  ends: the code changes where the plan put the choice, the pull request
  says what changed, and the ticket is told. A comment that says to stop
  ends the run at once.
- Each comment is claimed in one conditional write before anything is
  done with it, so it is acted on once. One nobody read stays open for
  what comes next: the next step, a round on the finished run's pull
  request, the ticket started again (a run that ended waiting or
  failed), or the next run on the ticket (a run a person stopped).
- Comments written before the run started are read at its first
  boundary: a Jira ticket's come with its event from the Jira app, a
  GitHub issue's are read by the run. They are context and never stop
  the run.

Incident case aq_comment_during_run.
A comment written while no run works was stored for every ticket in a
connected Jira project, for 30 days. It is now stored only when the
ticket carries the team's trigger label or is assigned to CoderHelm when
the comment is written (the rule that starts a run). Comments on every
other ticket are never stored: when a run starts there, the event that
starts it brings the ticket's comments, and a GitHub run reads the
issue's.

Records expire after 14 days for a comment written while a run worked
and 7 days for one written before a run. Nothing reads a comment after
it is acted on; the record only guards against a repeated delivery and
keeps a comment nobody read for what comes next.

A Jira app older than the version that sends comments with the ticket
leaves CoderHelm no way to read them: the gateway notes on the ticket's
record whether the event carried comments, and the run says on its page
when comments written before it started were not read.

The Jira app sends at most 200,000 characters of comment bodies with an
event, leaving out the oldest whole. Its manifest is unchanged: no new
scope or permission.
…ok too

A run started by a plain Jira webhook (no app) was told that the site's
Jira app is a version that does not send comments. No app is involved on
that path. The ticket's record now keeps how the event arrived, and the
run's note says what is true for each: an older Jira app does not send
the ticket's comments and updating it does; a Jira webhook sends none
with a ticket. CoderHelm cannot read them another way on either path:
the webhook path holds an address and a signing secret, nothing that
reads the Jira site.
@nambok
nambok merged commit 2694170 into main Nov 14, 2026
10 checks passed
@nambok
nambok deleted the fix/ticket-comments-during-run branch November 14, 2026 01:18
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