Skip to content

fleet gh: closure records + reason-required closes (audit trail by construction) #9221

Done

Description

@dezren39

Problem

Issue/PR closures in the fleet currently leave no durable, attributable record: a closure's actor and reason live only in GitHub's timeline, and nothing stops an automation from closing live work with no deliverable and no reason. Evidence, not theory:

Ask

  1. Automatic closure recording. Every issue/PR close performed through fleet gh (and, where detectable, observed by the fleet's sync machinery) is recorded into the backed-up fleet transaction record: item, actor/run ID, timestamp, close reason (taxonomy + free text), and the session/task binding when one exists. This builds directly on the attribution proposal in fleet queue: resume-by-session, claim-any-task, and manual-only items #9178 §(e) (fleet-init run IDs stamped into GitHub operations) and the decision-record convention in fleet decision records: document queue and attribution decisions durably #9180 — closures are decisions and should be recorded like them. The record must be queryable ("who closed X, why, from which run") and backed up with the rest of the fleet transaction log (Atlas-injectable per fleet queue: resume-by-session, claim-any-task, and manual-only items #9178 §(e)).

  2. Reason-required closes. fleet gh issue close and fleet gh pr close without --reason fail with an error: Please give a reason. This is required by policy. The reason uses the review's taxonomy — implemented / superseded (requires a successor reference) / cancelled / started-incorrectly — plus optional free text. The flag is written into the close comment and the transaction record from (1). Reopens should likewise record a reason (the 90-day review's reopens cite the review + evidence; that should be the tool's shape, not a convention).

Acceptance

  • Closing an issue or PR via fleet gh without --reason exits non-zero with the policy error above; no close is performed.
  • Closing with --reason <taxonomy> (+ optional successor ref for superseded, + free text) performs the close, posts the reason in the close comment, and appends the full closure record (item, actor/run ID, timestamp, reason, binding) to the transaction record.
  • The transaction record is included in the fleet backup set and is queryable by item number.
  • Tests cover: missing reason refusal, each taxonomy value, superseded-without-successor refusal, and record contents.

Cross-links: #9178 (attribution proposal §e; FDR-0005), #9180 (decision records), #9155 (the incident), the 90-day closed-item review (this issue is its Part 4).

Activity

  1. added
    kind/feature
    app/fleet
    epic/fleet-tool
    on Nov 13, 2026
  2. developing-today commented on Nov 13, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Agent note — triaged, task 18923 for issue #9221 (lane any-e)

    • State: triaged (inline, 2026-11-17). Work kind: small-fix. Priority: priority/normal. Effort: effort/m. Kind: kind/feature (already on the issue).
    • Fresh verification: issue fleet gh: closure records + reason-required closes (audit trail by construction) #9221 is OPEN, no hard-stop labels. On laptop main, pkgs/fleet/crates/fleet/src/gh.rs (1,669 lines) is a passthrough/cache layer with no close-command handling and no reason logic — the feature is unimplemented, exactly as the issue describes.
    • Dependency handling: the closure record's run-ID field builds on fleet queue: resume-by-session, claim-any-task, and manual-only items #9178 §(e) (fleet-init run IDs), but the issue's acceptance only requires the session/task binding "when one exists" — so the fix packet records today's available binding and keeps run_id nullable until the stamp lands. This is NOT dep-blocked on fleet queue: resume-by-session, claim-any-task, and manual-only items #9178.
    • First concrete step: intercept issue close / pr close in the fleet gh domain and refuse without --reason (policy error verbatim from the issue) before any passthrough happens; then the record append.
    • Acceptance check: the issue's own checklist — missing-reason refusal with no close performed; each taxonomy value; superseded-without-successor refusal; reason in the close comment; full closure record appended, in the backup set, queryable by item number; tests for all of it.
    • Routing: follow-on fix packet enqueued as task 20372 (dedupe-verified new: repo-health:v1:fix:developing-today/code:issue:9221, status queued). Labels: status/triaged + priority/normal + effort/m + task/small-fix + queue/queued added.
  4. added
    status/triaged
    priority/normal
    effort/m
    task/small-fix
    queue/queued
    on Nov 17, 2026
  5. added
    work/assigned
    and removed
    queue/queued
    on Nov 17, 2026
  6. 13 remaining items

  7. added
    user/review
    meta/protocol-gap
    on Nov 27, 2026
  8. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    🤖 Agent progress note · lane oc-code-07 (queue task 25233, triage)

    Verdict: code fully landed on main; one external confirmation left, then close as implemented.

    Re-verified firsthand against origin/main (2026-11-28):

    No repo files modified. Parking the triage task with resume condition: recheck after #9093 closes; at that point confirm the backup-set inclusion and close this issue.

  9. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    🤖 Agent progress note · lane code-f (queue task 25233, triage)

    Verdict: code fully landed on origin/main; one external confirmation left, then close as implemented.

    Re-verified firsthand against origin/main (83e6b04):

    • pkgs/fleet/crates/fleet/src/gh_closure.rs present; close without --reason refused with the policy text (POLICY_ERROR); taxonomy implemented / superseded / cancelled / started-incorrectly enforced; superseded-without-successor refused; reason posted into the close comment; fleet-closure/v1 records written to closure-records.jsonl in the fleet state dir and queryable via fleet gh closures.
    • All six named tests present and passing (12/12 in the gh_closure suite: close_without_reason_is_refused_with_policy_text, each_taxonomy_value_is_accepted, unknown_reason_is_refused, superseded_without_successor_is_refused, reason_becomes_the_close_comment, record_carries_item_reason_time_and_binding).
    • impl(atlas/fleet): backup mesh — all-Turso 14d restic-zstd to R2, R2/laptop/Drive mesh, D1+laptop DBs into Turso #9093 (backup mesh) is still OPEN, so the one in-repo-unconfirmable item — fleet state dir actually inside the laptop backup set — still cannot be confirmed from this repo.

    No repo files modified. Triage task parked with resume condition: recheck after #9093 movement; at that point confirm backup-set inclusion and close this issue.

  10. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    🤖 Agent progress note · lane oc-code-07 (queue task 25233, triage)

    Verdict: code fully landed on origin/main; one external confirmation left, then close as implemented.

    Re-verified firsthand against origin/main (709a713, 2026-11-28):

    • pkgs/fleet/crates/fleet/src/gh_closure.rs present; close without --reason refused with the policy text (POLICY_ERROR = "Please give a reason. This is required by policy."); taxonomy implemented / superseded / cancelled / started-incorrectly enforced; superseded-without-successor refused; reason posted into the close comment; fleet-closure/v1 records written to closure-records.jsonl in the fleet state dir and queryable via fleet gh closures.
    • All six named tests present and passing (12/12 in the gh_closure suite, run 2026-11-28: close_without_reason_is_refused_with_policy_text, each_taxonomy_value_is_accepted, unknown_reason_is_refused, superseded_without_successor_is_refused, reason_becomes_the_close_comment, record_carries_item_reason_time_and_binding).
    • impl(atlas/fleet): backup mesh — all-Turso 14d restic-zstd to R2, R2/laptop/Drive mesh, D1+laptop DBs into Turso #9093 (backup mesh) is still OPEN, so the one in-repo-unconfirmable item — fleet state dir actually inside the laptop backup set (path list lives outside this repo) — still cannot be confirmed from here.

    No repo files modified. Triage task parked with resume condition: recheck after #9093 movement; at that point confirm backup-set inclusion and close this issue.

  11. removed
    queue/claimed
    status/in-progress
    on Nov 28, 2026
  12. dezren39 commented on Nov 29, 2026

    @dezren39
    MemberAuthor

    🤖 Census note · lane CEN-C07, 2026-11-29 full issue census (firsthand recheck)

    Verdict: blocked on one external confirmation — the implementation is fully landed and test-verified on main; what remains is not code.

    Verified state (three independent firsthand checks against origin/main, 2026-11-28, re-verified here):

    • pkgs/fleet/crates/fleet/src/gh_closure.rs present on main; every referencing PR merged (fleet gh: reason-required issue/pr close and closure records (#9221) #11440).
    • Acceptance boxes 1, 2 and 4 are met: close without --reason refused with the exact policy text ("Please give a reason. This is required by policy."); taxonomy implemented/superseded/cancelled/started-incorrectly enforced; superseded-without-successor refused; reason posted into the close comment; fleet-closure/v1 records appended to closure-records.jsonl and queryable via fleet gh closures; all six named tests present, 12/12 in the gh_closure suite passing.
    • The incident that motivated this (epic Fleet CA, credentials & secrets — v0.3 design mill (Summit build-out) #9155 closed by an unidentified automation 8 minutes into a live Summit session) is exactly what the landed record now prevents from being invisible.

    The one open item: acceptance box 3's backup half — that the fleet state dir is actually inside the laptop backup set. The backup path list lives outside this repo, so it cannot be confirmed from here; it is tied to #9093 (backup mesh — itself blocked on its own owner-provisioning gates, see its census note). Triage task 25233 is parked with the right resume condition: recheck after #9093 moves; then confirm backup-set inclusion and close this issue as implemented.

    Census actions: removed status:in-progress (no work is in progress; the item is parked awaiting an external confirmation). Kept priority/normal, user/review, status/triaged, meta/protocol-gap.

  13. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Census 2026-11-29 (Felix): full recheck of this issue — body, all 10 comments, labels, and native blocked_by edges read firsthand; blocker states verified live today.

    STRENGTHS

    • substantive body (3179 chars) with scope and deliverable; 10 comments of working history, latest 2026-11-28; Code is fully landed on origin/main per two independent lane verdicts (2026-11-28): pkgs/fleet/crates/fleet/src/gh_closure.rs refuses a close without --reason with the policy text, and the closure taxonomy is implemented..

    GAPS

    • no explicit acceptance criteria in the body (tracker/starter pattern — see REMAINS).

    FIXES I APPLIED

    • None needed from me: a sibling census lane's fixes today were verified in place, and my recheck found the labels/edges consistent.

    REMAINS

    • The one remaining step is the external confirmation the triage notes name, then this closes as implemented. Not closed by this census: the confirmation is not yet recorded on the issue, so the evidence is not airtight.
  14. dezren39 commented on Nov 30, 2026

    @dezren39
    MemberAuthor

    Claim — xaltha lane 0212-O (2026-11-30).

    Taking the one open remainder of #9221: every prior done-check (latest: census CEN-C07, 2026-11-29) confirms boxes 1, 2 and 4 on main (pkgs/fleet/crates/fleet/src/gh_closure.rs), leaving box 3 — "the transaction record is included in the fleet backup set" — unconfirmed: the closure log lives at ~/.local/state/fleet/closure-records.jsonl (fleet-config Config::state_dir()), and no repo-defined backup set captures that path (pkgs/fleet/book/operations/backup-inventory.md has no entry for it; infra/laptop-db-backup covers only SQLite DBs).

    Slice: add the closure log to the pkgs/agent-backup/backup.sh candidate set (its stated scope is the small, irreplaceable per-seat set), extend its test, and record the path in the backup inventory so the book's "(backed up with it)" claim is true in the tree. PR will carry Closes #9221 if the full done-check passes.

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

    app/fleeteffort/mepic/fleet-toolkind/featuremeta/protocol-gappriority/normalstatus/triagedtask/small-fixuser/reviewwork/assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions