Skip to content

feat(ci): show the gate result on the issue #4702

Open

Description

@dan-petty

Problem or Motivation

In the iteration lane, a workstation pull request opens after a passing gate (OD6 a), and the implement Job opens its pull request at the end (OD3 a). Then no early draft shows the work in progress, and the issue loses this signal. The owner requires that the issues and releases keep the project status visible (2026-11-11).

Proposed Solution & Architectural Design

Generalize the marker upsert of publish_pr_evidence (src/devops_cli/github/pr_evidence.py). At each gate end, one note on the issue of the branch <type>/<issue>-<slug> gives one of these:

  • the state of the gate;
  • the failed rows, with at most 20 test IDs;
  • the fallback reason.

The note is edited in place. The implement Job uses the same helper for its run table, its branch and a compare link.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/github/).

Existing Tool Considered

The marker upsert of publish_pr_evidence and the paced GitHub session cover the need. Cost (estimate): about 120,000 tokens and 2 hours to build, about 3,000 tokens a month to keep, about 15,000 tokens to fix.

Acceptance Criteria

  • Each issue has one note, edited in place.
  • The note gives at most 20 test IDs.
  • A test proves that the text holds no host name and no private address.

Dependencies

#4698.

Source: #4667

Alternatives check of 2026-12-01: rejected.
Rejected by ADR 0006. A newer fact can change an ADR.
Tool: PyGithub (https://pypi.org/project/PyGithub), GNU Library or Lesser General Public License (LGPL), last activity 2026-08-20, maintained.
Reason: Searches found PyGithub, a GitHub client that can list, create and edit an issue comment. It covers the in-place note only, not the gate state, test ID cap or redaction. ADR 0006 rejects it as the session transport.

Covers:

  • List, create and edit one issue comment
  • Reach the GitHub API from Python code
  • Find a comment by its body text

Lacks:

  • Gate state, failed rows and fallback reason
  • At most 20 test IDs with an overflow count
  • Redaction of host names and private addresses
  • Issue number from the branch form

Proposed design

Problem statement

A workstation pull request opens only after a passing gate, and the implement Job opens its pull request at the end, so no early draft shows the work in progress and the issue loses that signal. The owner requires that the issues keep the project status visible. This change writes one gate note on the issue at each gate end, edited in place, that shows the gate state, the failed rows and the fallback reason.

Acceptance criteria

Requirement: One gate note per issue

The gate note writer SHALL keep exactly one gate note on the issue of the branch and update it in place.

Scenario: A later gate updates the first note

  • WHEN The issue already holds a gate note and a later gate writes its result.
  • THEN The writer updates the existing comment and creates no second comment.

Requirement: Test ID cap

The gate note SHALL list at most 20 failed test IDs.

Scenario: More than 20 failed test IDs

  • WHEN A gate result holds 25 failed test IDs.
  • THEN The note lists the first 20 test IDs in order and one line that states that 5 more exist.

Requirement: No internal host name and no private address

The gate note text MUST hold no internal host name and no private address.

Scenario: A fallback reason with an internal host name and a private address

  • WHEN The fallback reason holds runner-1.internal and 10.0.0.5.
  • THEN The note holds neither runner-1.internal nor 10.0.0.5.

Requirement: Gate state and failed rows

The gate note SHALL state the gate result, the failed rows and the fallback reason.

Scenario: A failing gate

  • WHEN A gate fails with failed rows and a fallback reason.
  • THEN The note holds the gate state, the failed rows and the fallback reason.

Requirement: One marker upsert

The pull request evidence, the gate note and the roadmap step comment writer SHALL use one marker upsert helper.

Scenario: Each caller uses the shared helper

  • WHEN A test replaces upsert_marked_comment with a fake and runs publish_pr_evidence, publish_gate_note and comment.post.
  • THEN The fake records one call from each caller.

Requirement: Issue from branch

The gate note writer SHALL resolve the issue number from the branch <type>/<issue>-<slug>.

Scenario: A feature branch

  • WHEN The branch is feat/4702-gate-note.
  • THEN The writer resolves issue 4702.

Requirement: Implement run note

The implement Job SHALL write its run table, its branch and a GitHub compare link in the gate note.

Scenario: The implement Job writes its note

  • WHEN The implement Job ends its run on branch feat/4702-gate-note for owner/repo with default branch main.
  • THEN The note holds the run table, the branch and https://github.com/owner/repo/compare/main...feat/4702-gate-note.

Existing Tool Considered

PyGithub (https://pypi.org/project/PyGithub) is the tool that the alternatives block of the issue body names. The block records the verdict rejected, by ADR 0006, and its Lacks: list is the answer for what the tool lacks here. The project keeps the gidgethub session and builds the helper itself: about 120,000 tokens and 2 hours to build, about 3,000 tokens a month to keep, and about 15,000 tokens to fix.

Key questions

  • How does publish_pr_evidence keep one comment per pull request?: It lists the issue comments. It keeps the one whose body opens with CONST_PR_EVIDENCE_MARKER and whose author is the session login. It updates that comment or creates it. A comment of another author never matches. [sources: src/devops_cli/github/pr_evidence.py:92, src/devops_cli/github/pr_evidence.py:123, src/devops_cli/github/pr_evidence.py:131, src/devops_cli/config/constants.py:5075]
  • Where does the shared marker upsert live?: Extract the one marker upsert to upsert_marked_comment in src/devops_cli/github/marked_comment.py, and make the existing shared writer post in src/devops_cli/roadmap/steps/comment.py call it, so the pull request evidence, the gate note and the roadmap step share one tested path. Put build_gate_note and publish_gate_note in src/devops_cli/github/gate_note.py; publish_pr_evidence and publish_gate_note call the upsert with their marker, and post keeps its no-write-when-identical rule. (best practice) [sources: src/devops_cli/roadmap/steps/comment.py:153, src/devops_cli/roadmap/steps/comment.py:180, src/devops_cli/github/pr_evidence.py:123, src/devops_cli/config/constants.py:5075]
    • Chosen: Move the one upsert into src/devops_cli/github/marked_comment.py and have post call it. post already implements the own-author and marker match (refactor(roadmap): one marked-comment writer for every job #5025), so a new helper beside it would be a second copy; one module gives all three callers one tested path.
    • Rejected: Extract only the pr_evidence.py logic into a new helper and leave post as it is. Two copies of the author and marker checks drift, and a fix to one misses the other.
    • Rejected: Copy the marker logic into the gate note. A third copy drifts from both writers, and the gate note would miss a later fix.
  • How does the writer find the issue number?: Call issue_of_branch from src/devops_cli/git/branch_form.py. It reads the form <type>/<issue>-<slug> and returns the number whole, so feat/4702-gate-note gives 4702 and feat/23370-x gives 23370; another branch gives None. No API call is needed. (best practice) [sources: src/devops_cli/git/branch_form.py:58, src/devops_cli/git/branch_form.py:67, CONTEXT.md:122]
    • Chosen: Reuse issue_of_branch. The project already parses the branch form in one place, and parse_branch reads the number whole and refuses a branch that breaks the form.
    • Rejected: Write a local parse of the digits after the first /. A second pattern drifts from parse_branch, which is the project's rule for the branch form.
    • Rejected: Read the linked issue from the pull request. The early gate has no pull request yet, and the call costs one more API request.
  • Which marker separates the gate note from the pull request evidence comment?: Add CONST_GATE_NOTE_MARKER to src/devops_cli/config/constants.py. Match it with the same own-author rule as publish_pr_evidence. (best practice) [sources: src/devops_cli/config/constants.py:5075, src/devops_cli/github/pr_evidence.py:92, src/devops_cli/roadmap/steps/comment.py:174]
    • Chosen: Add a new CONST_GATE_NOTE_MARKER. A distinct marker keeps the match rule unambiguous, and the own-author rule keeps each note single.
    • Rejected: Reuse CONST_PR_EVIDENCE_MARKER. A reused marker makes the two note types one, and a body that matches the wrong note overwrites it.
    • Rejected: Match by the heading text. A person can copy the heading, and a heading match has no stable key.
  • How does the note show more than 20 failed test IDs?: List the first 20 failed test IDs in order. Add one line that states the count of the rest, such as 5 more failed tests. The note stays at the cap. The project uses this form: repo_map gives the first files and a last line for the rest, and the implement trace counts the events that it dropped. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:171, docs/roadmap/implement.md:85, src/devops_cli/roadmap/stage/stage_tools.py:337]
    • Chosen: First 20 IDs and a count of the rest. The note keeps the cap and still tells the reader how many rows the cap hides; the project caps a list and names what it left out.
    • Rejected: First 20 IDs with no count. A reader cannot tell a complete list from a cut one, and the trace records the count of its dropped events.
    • Rejected: All failed IDs. The body caps the note at 20 test IDs.
  • How does the note keep host names and private addresses out?: Run each free-text field through mask_secrets and mask_private_hosts from src/devops_cli/security/sanitizer.py before the note is written. mask_private_hosts masks private host names and private or loopback addresses with <masked-host>. A test feeds 10.0.0.5 and runner-1.internal and asserts that neither string is in the note. (best practice) [sources: src/devops_cli/security/sanitizer.py:432, src/devops_cli/security/sanitizer.py:446, src/devops_cli/security/sanitizer.py:468, docs/HOMELAB_REPO_SWITCH.md:13]
    • Chosen: Redact free text in the writer. The fallback reason is free text, and one writer keeps the rule for both notes.
    • Rejected: Include no free text. The body requires the fallback reason, so the note must show it.
    • Rejected: Leave redaction to the caller. Each caller would repeat the rule, and one miss posts a host name.
  • Which step writes the gate note?: The gate command that feat(ci): devops ci --remote runs the gate in the cluster #4698 delivers writes the note when its gate run ends. feat(ci): track the iteration lane and push cuts #4667 (fetched 2026-11-26) makes the cluster gate the engine (OD1 a) and requires every push to follow a passing gate (OD6 a), and it lists feat(ci): devops ci --remote runs the gate in the cluster #4698 as devops ci --remote runs the gate in the cluster. The implement Job calls the same writer for its run table, its branch and the compare link. (best practice) [sources: https://github.com/feat(ci): track the iteration lane and push cuts #4667, docs/roadmap/implement.md:68]
    • Chosen: The gate command from feat(ci): devops ci --remote runs the gate in the cluster #4698. The gate is the cluster CI gate, and the command that ends the gate holds the result.
    • Rejected: The roadmap stage step. The stage job writes the plan comment, not the result of the cluster CI gate.
    • Rejected: Every check run writes a note. Each run would edit the note, and the last edit wins with no gate result.
    • Rejected: A scheduled sweep writes the note. The sweep adds a delay and needs a second read of the gate state.
  • What form does the compare link take?: Use the GitHub compare URL https://github.com/<owner>/<repo>/compare/<base>...<branch>. The base is the default branch. (best practice) [sources: CHANGELOG.md:5, tests/fixtures/github/hello_world_repositories.json:60]
    • Chosen: GitHub compare URL from the default branch to the branch. The branch has no pull request yet, so the compare view shows the work.
    • Rejected: A link to the pull request. The early gate has no pull request.
    • Rejected: The branch name as plain text. A reader must copy the name to see the diff.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4698

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/ci
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/ci. The (ci) scope of the title gives the scope.
    • Priority: P2-Medium. The owner requires visible status on issues, but the feature does not block delivery or fix a defect.
    • Value: Medium. It keeps project status visible on the issue as the owner requires, but it is a visibility aid, not a blocker.
    • Effort: Medium. The body estimates about 120,000 tokens and 2 hours to build, which is moderate work.
    • Related: feat(roadmap): post quality gate evidence on delivery PR #4129, which asks for a different change. Both post quality gate results from the implement job in src/devops_cli/github/, but #4129 writes the evidence comment on the delivery PR while the candidate writes a gate-state note on the issue.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: The web searches returned no relevant library (only container images and unrelated documentation pages), so I read the facts of the closest candidates: peter-evans/create-or-update-comment implements the marker-based single-comment upsert on issues, which is the "one note, edited in place" part of the acceptance criteria, but it is a JavaScript workflow action that the Python helper in src/devops_cli/github/ and the implement Job cannot call, and it produces none of the gate content. The project's own session transport (gidgethub) only offers raw create/edit comment calls, so the marker upsert, the test-ID cap and the redaction test stay project work: partly covered.

    Tool: peter-evans/create-or-update-comment (https://github.com/peter-evans/create-or-update-comment)

    • License: MIT
    • Last activity: 2026-11-01
    • Maintained: yes

    Covers:

    • Finds an existing comment by a marker in its body and edits that comment in place instead of adding a new one on each run
    • Works on issues as well as pull requests, so one note per issue can be created and then updated
    • Is an open, maintained tool with a released version

    Lacks:

    • It is a JavaScript GitHub Action for workflow steps, so the Python module src/devops_cli/github/pr_evidence.py and the implement Job cannot call it
    • It does not compose the gate state, the failed rows, the fallback reason or the run table with branch and compare link
    • It does not cap the failed test IDs at 20
    • It does not redact host names or private addresses, and nothing in it proves that the text holds none
    • It does not use the project's paced GitHub session or its branch-to-issue resolution

    Tools considered:

    Searches run:

    • Python library create or update GitHub issue comment marker upsert, results: 5
    • GitHub Action create or update sticky comment on issue marker, results: 5
    • peter-evans create-or-update-comment github action, results: 5
    • gidgethub GitHub API library post issue comment, results: 5
    • "create-or-update-comment" action issue comment, results: 5
    • github comment upsert sticky bot library python, results: 5
    • peter-evans/create-or-update-comment, results: 5
    • github action sticky comment pull request marocchino, results: 5
    • PyGithub create issue comment edit existing comment, results: 5
    • pytest report quality gate results as GitHub issue comment tool, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 0820a64 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  7. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: partly, tool https://github.com/peter-evans/create-or-update-comment. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • gh cli issue comment --edit-last edit existing comment, results: 5
    • python library upsert github issue comment marker edit in place, results: 5
    • PyGithub create_comment edit issue comment example, results: 5
    • peter-evans/create-or-update-comment GitHub Action upsert comment, results: 5
    • gidgethub post edit comment on issue python, results: 5

    Sources:

  8. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  9. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: rejected, tool https://pypi.org/project/PyGithub. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • GitHub action create or update comment in place sticky comment, results: 5
    • Python library update existing GitHub issue comment in place marker upsert, results: 5
    • peter-evans create-or-update-comment action, results: 5
    • gidgethub python GitHub API comment edit create, results: 5
    • idempotent sticky comment bot update existing comment github library, results: 5

    Sources:

  10. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: partly, tool https://pypi.org/project/PyGithub. A person decides what the new result means for the item.

    Searches (6)

    Tools considered:

    Searches run:

    • tool that comments test failure results on GitHub issue automatically, results: 5
    • post CI gate result as comment on GitHub issue edit in place marker, results: 5
    • peter-evans create-or-update-comment GitHub action issue comment, results: 5
    • Danger CI posts test results comment on pull request, results: 5
    • open source bot update single GitHub issue comment with CI test results, results: 5
    • gidgethub python GitHub API client create comment, results: 5

    Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/cisource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions