Autopilot: a conflicted branch parks instead of looping, and the deploy step can actually run #193

Merged
viberfox-agent merged 1 commit from fix/autopilot-conflict-handling into main 2026-08-29 20:49:13 +00:00
Collaborator

Found while verifying why the autopilot stopped landing work (issues #176, #186, #187). Two fixes in tools/autopilot.ts:

  1. A branch that really conflicts with main no longer retries and comments every five minutes for ever — mergePr polls the pull request's mergeable flag, merges when it flips true, and after five minutes of false parks the ticket (drops ship, explains once).
  2. The post-merge deploy has never run: it looked for deploy-main under /home/agent/cartopolis, which does not exist in the autopilot container. It is now resolved beside the script itself, which is right both in the repo and under the /opt/autopilot mount; a failure to spawn it is reported as "merged, but not deployed" instead of crashing into a comment claiming nothing was merged.
Found while verifying why the autopilot stopped landing work (issues #176, #186, #187). Two fixes in tools/autopilot.ts: 1. A branch that really conflicts with `main` no longer retries and comments every five minutes for ever — `mergePr` polls the pull request's `mergeable` flag, merges when it flips true, and after five minutes of `false` parks the ticket (drops `ship`, explains once). 2. The post-merge deploy has never run: it looked for `deploy-main` under `/home/agent/cartopolis`, which does not exist in the autopilot container. It is now resolved beside the script itself, which is right both in the repo and under the `/opt/autopilot` mount; a failure to spawn it is reported as "merged, but not deployed" instead of crashing into a comment claiming nothing was merged.
fix(autopilot): park conflicted branches and find deploy-main beside the script
All checks were successful
CI / test cartopolis (pull_request) Successful in 13m16s
CI / wasm & android targets (pull_request) Has been skipped
00c384c89e
Two faults, found while verifying why the lane stopped landing work.

A branch that genuinely conflicts with main looped for ever: Forgejo's
merge endpoint answers 405 both while it is still computing mergeability
and for a real conflict, and mergePr read every 405 as 'try again'. The
ship tick runs every five minutes, so issues #176 and #186 collected a
'Could not ship this' comment each quarter hour with no way out — every
autopilot ticket edits docs/direction.md, so any two in flight conflict
with whichever lands first. mergePr now polls the pull request's own
mergeable flag and only fires the merge when it says yes; five minutes
of 'no' is a MergeConflict, which parks the ticket the way a fenced one
is parked (drop the ship label, explain once) instead of retrying.

The deploy step has never run: it invoked deploy-main via AGENT_REPO_ROOT,
which defaults to /home/agent/cartopolis — a path that does not exist in
the autopilot container (nothing mounts a checkout there, and deploy-main
deliberately needs none). It also crashed rather than reporting, because
Bun's .nothrow() covers a non-zero exit and not a failed spawn, so issue
#187 was told 'nothing was merged' two lines under the comment announcing
its own merge. deploy-main is now resolved beside this script — true in
the repo (both in tools/) and in the container (both mounted at
/opt/autopilot) — a spawn failure is reported as 'merged, but not
deployed', and a merged flag keeps the generic failure comment honest.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jeroen/cartopolis!193
No description provided.