fix(axi): respond resolves the active run across branches, adds repo-scoped --run#286
Open
jimboswankster wants to merge 4 commits into
Conversation
axi respond keyed its active-run lookup on the current branch, while axi status happily displays runs from any branch. Since the pipeline is non-blocking by design, the user (or agent) has often switched branches — or is on a detached HEAD — by the time a gate needs an answer; respond then failed with 'no active run to respond to' for a run that status had just shown, leaving the gate unanswerable without switching back. Resolve the target run like the query commands do: explicit --run ID, else the current branch's active run, else the repo's only active run. When several runs are active and none matches the branch, fail with the candidate list and point at --run.
…ch run resolution
Owner
|
Thanks @jimboswankster - this is gated via no-mistakes and the change looks good. It just needs a rebase onto current |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Make axi respond resolve the active run across branches (explicit --run ID, branch active run, else the repo's only active run) so a non-blocking pipeline's gate stays answerable after switching branches or detaching HEAD
What Changed
resolveActiveRuntoaxi respond, which targets an explicit--runID, else the current branch's active run, else the repo's only active run — replacing the prior branch-only lookup that stranded an answerable gate after a branch switch or detached HEAD; when several runs are active and none matches the branch it errors with amultiple active runs … pass --run <id>hint.axi respond --run <id>flag (tracked via a newexplicit_run_idtelemetry field) to answer a specific run directly.--runresolution to the current repository in bothresolveActiveRunandresolveRun(status/logs), rejecting runs that belong to a different repo, and added tests covering branch match, cross-branch/detached-HEAD fallback, ambiguity, and cross-repo rejection.Testing
Ran the 7 new resolution unit tests and the full
internal/clipackage under-race(all green), then proved the user intent end-to-end at the actual CLI surface an agent uses. Becausemake e2ecan't start on this macOS host (pre-existing socket-path-length andPWD=.hook-leak issues, both unrelated to this change), I stood up the same harness components manually — daemon, gate, fake agent — and drove two real non-blocking pipelines to their review gates. From a non-matching branch and from a detached HEAD,axi respondcorrectly disambiguated (ambiguity error pointing at--run), honored explicit--runacross branches, and fell back to the repo's only active run, each time clearing the gate tooutcome: passed; explicit--runIDs from another repo were rejected onrespond,status, andlogs. This is a CLI/agent surface (TOON output), so the reviewer-visible evidence is the captured CLI transcripts rather than screenshots. Overall: the change behaves exactly as intended and is well covered.Evidence: CLI transcript: axi respond resolves the active run across branches (ambiguity guard, --run disambiguation, cross-branch fallback, detached HEAD → outcome: passed)
Evidence: CLI transcript: explicit --run stays scoped to the current repository for respond/status/logs (cross-repo run rejected; unknown id → not found)
Evidence: Headline moments (excerpt)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
⏭️ **Review** - skipped
Step was skipped.
internal/git/env.go:35- Themake e2esuite (CLAUDE.md's prescribed check for agent-integration changes) cannot run as-is on this macOS host for two pre-existing, change-unrelated reasons: (1) the daemon's Unix socket path$NM_HOME/socketderived fromt.TempDir()exceeds the macOS 104-char sun_path limit (bind: invalid argument); and (2)git.NonInteractiveEnvsetsPWD=.foraxi run'sdir="."push, which leaks into the local-push post-receive hook where macOS/bin/shtrusts the relative$PWD, making$(pwd)return.so the daemon rejectsinvalid gate path: .(Linux CI uses dash, which ignores a relative PWD, so the harness passes there). Neither touches the resolveActiveRun/resolveRun code under review. I worked around both (short TMPDIR + triggering gates via a manual push from an absolute cwd) to demonstrate the change end-to-end, so this did not block evidence.go test ./internal/cli -run 'TestResolveActiveRun|TestResolveRun' -count=1 -v— 7 new resolution tests (branch match, cross-branch + detached-HEAD fallback, ambiguity→--run, ignores/rejects other-repo runs) all passgo test -race ./internal/cli— full package passes under the race detectorManual end-to-end via real daemon + gate (short TMPDIR workaround for macOS socket limit): pushedfeature/axiandfeature/twoto leave two non-blocking pipelinesawaiting_approvalat the review gateFrom a worktree onfeature/sidequest(matches neither run):no-mistakes axi respond --action approve→ refused withmultiple active runs: … — pass --run <id>; thenno-mistakes axi respond --run <R1> --action approveresolved the feature/axi run across branches →outcome: passedWith one active run remaining:git checkout --detachthenno-mistakes axi statusandno-mistakes axi respond --action approveresolved the repo's only active run with no current branch →outcome: passedCross-repo scoping across two repos:no-mistakes axi respond/status/logs --run <repoB-run-id>from repo A →belongs to a different repository;--run <bogus>→not found✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.