Skip to content

Run pipeline: reuse CoderHelm's own PR, stop auto-merge on conflicts, plugin poll, installation owner, close reasons - #347

Merged
nambok merged 5 commits into
mainfrom
fix/run-pipeline-audit-2
Oct 28, 2026
Merged

nambok merged 5 commits into
mainfrom
fix/run-pipeline-audit-2

Conversation

@nambok

@nambok nambok commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Five more fixes from the run-pipeline audit: re-runs that opened a second and third PR for the same ticket, auto-merge polling a conflicted PR, a plugin source poll that failed on every run, one GitHub installation routed among several teams, and PRs closed without a reason that taught nothing. Builds on #346 (merged): its per-PR records and round kinds.

Changes

  • Re-runs continue on CoderHelm's own open PR. A re-run now looks up CoderHelm's own open PR for the ticket from the ticket's earlier runs (every PR each run recorded, in its own repository) and continues on its branch, instead of relying on branch templates and PR titles naming the ticket. When the plan moved the change to other repositories, the PRs an earlier run left in repositories it no longer changes are closed, each with a note naming the new PR. Branch work is untouched (another change owns plan task detection).
  • Auto-merge stops on a merge conflict.
    • A conflict (mergeable_state dirty) puts the gate in a new conflict state. No CI event wakes it, and it posts one status update instead of polling every 90 seconds and editing the comment each time.
    • On CoderHelm's own PR, the first conflict starts a conflict round on its run, once per PR. The round merges the base into the branch (never a reset) and resolves the conflicts in one commit. The review of that commit re-arms the gate.
    • A conflict the round can't resolve is handed to a person with one comment.
  • Plugin source poll. Kv::query on DynamoDB sent begins_with(sk, ""), which DynamoDB refuses ("empty string value. Key: sk"), so listing a whole index partition failed and no source was polled. An empty prefix now queries the partition without that condition.
  • One owner per GitHub installation.
    • Owner choice: an installation several teams carry (older sign-ins made a team per person) was routed by first link time, or for older records by member count. That cost a query per team on every event, and the owner could move as people joined. The owner is now recorded once (settings INSTALLATION#<id> / OWNER), and every later event reads it.
    • Stale links: the other teams' links are stale. The platform admin's Teams overview lists them (shared_installations), and the stale team's installation status says so.
    • Release: a team admin can release their own team's stale link (POST /api/github/release-stale-link). The platform admin can release all stale links for an installation (POST /api/admin/installations/:id/release-stale); this endpoint is a dry run by default.
    • Linking already refuses an installation another team owns, so no new stale links are made.
    • Releasing never touches the owner's link. No production data is changed by this PR.
  • PRs closed without a reason.
    • When a person closes CoderHelm's PR and nobody says why (no comment on the PR or its issue, no reason in the close dialog), the run records close_signal = closed_no_reason and the team's prs_closed_no_reason counter.
    • CoderHelm then asks once, with one short PR comment.
    • A reply on the closed PR goes to the lessons, never the fix loop. It is kept on the run (close_reason_answer, which the next run's history shows the planner), the signal becomes closed_with_reason, and the lesson judge reads it.
    • PRs CoderHelm closed itself are not asked about.

Verification

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace (common 1250, gateway 605, worker 901, after rebasing on main) pass on this branch.
  • New tests:
    • a_rerun_finds_its_own_open_pull_request
    • a_conflict_stops_the_gate_until_a_new_commit, a_conflict_says_who_resolves_it
    • an_empty_prefix_queries_the_whole_partition_with_no_empty_value, every_source_is_listed_for_the_poll
    • installation owner: recorded owner stands, stale teams, shared installations
    • a_close_without_a_reason_is_asked_about, only_an_open_question_takes_the_answer, coderhelm_closing_its_own_pr_is_not_asked_about
    • the admin handler count check is updated for the new admin endpoint.
  • python3 -m unittest discover -s lambda/tests passes. The stuck-run sweep knows the conflict round.

@nambok
nambok changed the base branch from fix/run-pipeline-audit to main October 28, 2026 01:30
…branch once

A conflicted PR was treated like any other declined merge: the gate polled
it every 90 seconds, every completed check suite woke it again, and the
status comment was edited each time. A conflict (mergeable_state dirty) now
stops the gate in a state no CI event wakes, with one status update. On
CoderHelm's own PR the first conflict starts a conflict round on its run
(once per PR): the base is merged into the branch and the conflicts resolved
in one commit, and the review of that commit re-arms the gate. A conflict it
can't resolve is handed to a person with one comment.
… opening another

A re-run picked its branch from the team's branch template and PR titles
that name the ticket; when neither matched (a retitled ticket, a template
without the key) it opened a second and third PR. The run now looks up
CoderHelm's own open PR for the ticket from the ticket's earlier runs (every
PR each run recorded, in its own repository) and continues on its branch.
When the plan moved the change to other repositories, the PRs an earlier run
left in repositories it no longer changes are closed with a note naming the
new PR.
…nd releasable

An installation several teams carry (older sign-ins made a team per person)
was routed by the first link time, or by member count for older records:
a query per team on every event, and an owner that could move as people
joined. The owner is now recorded once (settings: INSTALLATION#<id>/OWNER)
and every later event reads it. The other links are stale: the platform
admin's Teams overview lists them, the stale team's installation status says
so, and a team admin (its own link) or the platform admin (dry run by
default) can release them. Releasing never touches the owner's link, and
only removes a link while the team still carries that installation.
…er, count the signal

When a person closed CoderHelm's PR and nobody said why (no comment on the
PR or its issue, no reason in the close dialog), the lesson judge had
nothing to read and the close taught nothing. The run now records
close_signal closed_no_reason (and the team's prs_closed_no_reason counter),
and CoderHelm asks once with one short PR comment. A person's reply on the
closed PR goes to the lessons (never the fix loop): it is kept on the run,
the signal becomes closed_with_reason, and the judge reads it. A PR
CoderHelm closed itself is not asked about.
@nambok
nambok force-pushed the fix/run-pipeline-audit-2 branch from 42cf0d2 to 8206949 Compare October 28, 2026 02:46
@nambok
nambok merged commit d38a9bf into main Oct 28, 2026
8 of 16 checks passed
@nambok
nambok deleted the fix/run-pipeline-audit-2 branch October 28, 2026 02:57
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