Skip to content

refactor(agents): port unattended review bounds and reporting to Go #770

Open

Description

@tbhb-agent

Problem

packages/agents/source/lib/agent.sh (173 lines) holds the unattended review round bound, lint command selection, the configuration digest and the report transport for the agent workflows. A rejected digest or a mail failure handled wrongly can reset the bound or hide a write status.

Part of #588.

Acceptance criteria

  1. AC1: A rejected digest is retained across preflight, and the finding counter survives it.
  2. AC2: A mail failure prints the unsent report and keeps the status of the write that already happened.
  3. AC3: The bound and report cases in the agent workflow suites pass against the Go path.
  4. AC4: Generated skill output is regenerated in the same PR.

Scope and non-goals

Port the bounded unattended state to Go: the persistent finding counter, lint selection, the configuration digest and report delivery. Keep the counter format so state written by an older binary still reads. Probe for the subcommand first. An older binary uses the frozen shell path, and a supported command that fails refuses without falling back.

Non-goal: changing any behaviour a consumer on an older pinned binary relies on, or removing the shell fallback, which a separate XS issue owns.

Approach

Port the logic to tested Go behind an agentrepo subcommand. The shell caller probes for it without writes. An older binary that lacks it keeps the frozen shell path. A supported command that fails or returns partial output refuses and never falls back. Regenerate skill output from the canonical sources in the same pull request.

Dependencies

one bounded-state contract. Blocked by the context discovery port (#755) and the stamp port (#769), which supply the context and the review-state format. Touches a gate path.

Size

S. One pull request, as the dependencies above describe.

Verify plan

  • AC1: write its failing case first, then show it pass. Write the retained-digest and mail-failure cases first, then port the Bats cases.
  • AC2: write its failing case first, then show it pass, using the same fixtures as AC1.
  • AC3: write its failing case first, then show it pass, using the same fixtures as AC1.
  • AC4: write its failing case first, then show it pass, using the same fixtures as AC1.

Risks

A fallback that ran after a supported command failed would mask an enforcement error, and a looser port would weaken a gate. The failing-first cases pin both. Undo: revert the change, which restores the shell path.

Operator authority

None.

Activity

  1. tbhb-agent commented on Oct 31, 2026

    @tbhb-agent
    ContributorAuthor

    Refinement: NOT READY — behavioral coverage and verification need concrete contracts

    Checked

    Gaps

    1. Blocker — acceptance criteria do not cover the scoped behavior. AC3 describes tests passing rather than an observable outcome. Lint selection and configuration-digest behavior have no corresponding criteria, despite being in scope (packages/agents/source/lib/agent.sh:137, packages/agents/source/lib/agent.sh:149). State the behavior to preserve, including configuration failures. Make the compatibility and refusal promises testable: older state remains readable, an absent command uses the frozen path, and a supported command’s failure or partial output refuses without fallback. These are relevant compatibility and enforcement criteria, not additional features.

    2. Blocker — the Verify plan cites IDs without specifying proof. “Write its failing case first” and “same fixtures as AC1” do not establish the assertions, workflow coverage, or generation check. Specify:

      • AC1: record rejection, run preflight, then assert retained history and the continuing bound; use the existing redesign coverage at tests/skills/redesign.bash:14.
      • AC2: fail the transport after a stubbed successful write; assert the unsent body, preserved status, and exactly one write. Existing examples are tests/skills/agent-pr/publish.bats:36 and tests/skills/agent-merge-pr/lifecycle.bats:28.
      • AC3: name the suites and checks proving the replacement behavioral criteria through the Go path.
      • AC4: cite generation, token measurement, deployment, and mise run check-generated-skills; digest and mail fixtures cannot prove generated output is current.

      Add ID-linked checks for the missing criteria from gap 1.

    3. Blocker — dependencies remain prose-only. Record refactor(agents): port skill capability and worktree context discovery to Go #755 and refactor(agents): port review snapshots and stamps to Go #769 as native blocked-by links. Their open states agree with the body; the missing links are the discrepancy.

    4. Blocker — gate-review authority is unstated. “Operator authority: None” can describe the absence of a requested privileged edit, but it omits the existing owner-review requirement for the named gate library. State the applicable exact-head owner review requirement without implying that this issue grants authority. No enumerated owner-tier file edit is currently proposed.

    Split

    No split needed. The existing bounds, lint selection, digest, and reporting form a plausible S-sized migration in one PR after the prerequisites. Refinement should clarify that boundary.

    Definition of done

    These boxes assess planning coverage, not completed work. An unchecked item is not automatically another readiness blocker.

    • D1: Every AC is verified on the merged head, and the PR's Verification section cites each AC ID with its evidence: the command and its result, or a link. — IDs appear, but concrete proof and merged-head evidence are unspecified.
    • D2: An independent review approved the exact merged head, and every finding is resolved or filed as a follow-up. — No coverage in the ACs or Verify plan.
    • D3: Every required check is green on that head, with no gate loosened without the owner's exact-head approval. — Only unspecified workflow cases are planned.
    • D4: The leak scans are clean: gitleaks, devtools' check-leaks.sh with the private-strings lists, and the leak review of every post. — No coverage in the ACs or Verify plan.
    • D5: Every commit is signed, including the squash. — No coverage in the ACs or Verify plan.
    • D6: Docs match the change: README, docs/, CHANGELOG or help text are updated, or the PR's Verification says "No doc impact" and why. — No documentation assessment is planned.
    • D7: Provenance is recorded: Assisted-by trailers on the commits and the squash, and provenance:agent-assisted on the PR. — No coverage in the ACs or Verify plan.
    • D8: The PR is within the PR size limits, or the owner approved the exact head over the hard limit. — Size S is stated, but no size verification is planned.
    • D9: Follow-ups and deferred findings are filed as issues with at least a Problem and numbered AC, and listed under the PR's Related. No TODO lands without an issue. — Fallback retirement is assigned to an unnamed follow-up.
    • D10: The merge closes the issue through a closing reference, the board shows Done, and a final Status: comment names the merge commit. — No coverage in the ACs or Verify plan.

    Round: 1 of 3

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

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions