fix: fix: triage agent must clean up throwaway debug branch on exit/crash (#341) #346
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#346
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-341"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #341
Changes
Add an EXIT trap in entrypoint-reproduce.sh that: - Switches back to the primary branch - Deletes the triage-debug-${ISSUE_NUMBER} branch This ensures the throwaway branch used for debug instrumentation (console.log, verbose logging) is cleaned up if the agent crashes or times out, preventing repository pollution. The trap is combined with existing cleanup (heartbeat kill, stack lock release) into a single EXIT handler.AI Review
Summary
This PR fixes issue #341 by extending the EXIT trap in the reproduce-agent entrypoint to clean up the branch that the triage agent creates as a throwaway workspace.
Analysis
Trap consolidation — the original code set two statements: a first one (after ) that only released the lock, and a second one (after ) that killed the heartbeat and released the lock, immediately overriding the first. Removing the intermediate trap is correct — it was dead code.
Git cleanup logic — the new trap appends:
Both steps are properly guarded with
2>/dev/null || true, so they are safe whether or not the debug branch exists (e.g., when the reproduce path short-circuits before triage). The checkout before delete is necessary — you cannot delete the currently checked-out branch.Variable availability —
$PROJECT_REPO_ROOTis set at line 76,$DEBUG_BRANCHis set at line 160, and$PRIMARY_BRANCHis injected by the dispatcher as an environment variable. All are in scope when the trap fires.Ordering — heartbeat kill → lock release → git cleanup is correct. The heartbeat is killed first to stop any lock refresh racing against the release.
set -euo pipefail — the
|| trueguards on every trap command are required and correctly applied.No issues found.
Verdict
APPROVE — Correct fix: removes redundant intermediate trap and adds safe git cleanup for throwaway debug branches
Reviewed at
c29d49c| AGENTS.mdAI Review: APPROVE — Correct fix: removes redundant intermediate trap and adds safe git cleanup for throwaway debug branches