Skip to content

fix(agent): audit structured close reasons - #3051

Merged
loopover-orb[bot] merged 1 commit into
mainfrom
codex/audit-close-reasons
Jul 4, 2026
Merged

fix(agent): audit structured close reasons#3051
loopover-orb[bot] merged 1 commit into
mainfrom
codex/audit-close-reasons

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • persist structured close reasons on planned close actions
  • store closeReasons/closeReasonCount in close-action audit metadata
  • preserve closeReasons through pending-action approval replay

What changed

  • Added closeReasons to close plans and pending action params.
  • Kept the existing flat reason and public close comments unchanged.
  • Bounded structured audit reasons with the same 280-character limit used for audit details.
  • Added planner, executor, audit-builder, and approval-queue regressions for multi-reason closes.

Why

Close history needs to preserve every independent reason a PR was closed, not only the flattened summary reason, so later debugging and historical analysis can reconstruct the exact decision.

Validation

  • npx vitest run test/unit/agent-actions.test.ts test/unit/agent-execution.test.ts test/unit/agent-action-executor.test.ts test/unit/agent-approval-queue.test.ts
  • npm run typecheck
  • git diff --check
  • npm run test:coverage

@JSONbored JSONbored self-assigned this Jul 4, 2026
@JSONbored JSONbored linked an issue Jul 4, 2026 that may be closed by this pull request
5 tasks
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 4, 2026
@loopover-orb

loopover-orb Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-04 10:19:03 UTC

8 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The change consistently carries structured close reasons from planning through pending-action params and into close-action audit metadata while keeping the existing flat reason/detail path intact. The audit writer correctly scopes the new metadata to close actions and bounds each stored reason using the existing audit detail limit. I do not see a reachable correctness defect in the visible diff, and the added tests cover planner, executor, audit-builder, and approval replay paths.

Nits — 4 non-blocking
  • nit: src/services/agent-action-executor.ts:48 appends the truncation marker after slicing to 280 characters, so the stored value is 281 characters despite the constant name describing a max length; this matches existing behavior but the helper name now makes the off-by-marker convention easier to misread.
  • nit: src/services/agent-action-executor.ts:52 falls back to `[action.reason]` for legacy close actions, which is correct for audit continuity, but it means `closeReasonCount` can imply structured provenance where none existed unless consumers treat single fallback reasons as legacy-compatible metadata.
  • src/services/agent-action-executor.ts:48: either rename the helper/comment to make the 280-plus-marker convention explicit, or change the bound to reserve space for the marker if downstream consumers expect a hard 280-character cap.
  • src/settings/agent-execution.ts:58: add a short metadata contract comment for `closeReasons`/`closeReasonCount` so future readers know these fields are audit-only and intentionally absent for non-close actions and empty close reason arrays.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 60 registered-repo PR(s), 51 merged, 421 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 60 PR(s), 421 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 60 PR(s), 421 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.10%. Comparing base (1c91483) to head (4ba0925).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3051   +/-   ##
=======================================
  Coverage   96.10%   96.10%           
=======================================
  Files         261      261           
  Lines       28872    28879    +7     
  Branches    10510    10514    +4     
=======================================
+ Hits        27746    27753    +7     
  Misses        492      492           
  Partials      634      634           
Files with missing lines Coverage Δ
src/services/agent-action-executor.ts 96.55% <100.00%> (+0.07%) ⬆️
src/settings/agent-actions.ts 95.65% <ø> (ø)
src/settings/agent-execution.ts 93.93% <100.00%> (+0.39%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 54f6e76 into main Jul 4, 2026
11 checks passed
@loopover-orb
loopover-orb Bot deleted the codex/audit-close-reasons branch July 4, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(review): reconcile AI verdicts against hard structured state before rendering

1 participant