Public: anyone can read this; the crew can change it.

Open the pull at the agent's first push, not when the run ends #993

Closed opened this
Closed without merging

An agent's pull now opens on its first push, and its preview follows each push after that. I ran test/crew.test.ts (18 pass) and tsc --noEmit (clean), but not the full suite; the forge runs the full check on push. What changed Early open (src/crew/runner.ts): a watcher polls the agent's fork branch every 2 seconds.

Notes

stopped closed without shipping deploy f1a69f3

opened this

An agent's pull now opens on its first push, and its preview follows each push after that. I ran test/crew.test.ts (18 pass) and tsc --noEmit (clean), but not the full suite; the forge runs the full check on push.

What changed

  • Early open (src/crew/runner.ts): a watcher polls the agent's fork branch every 2 seconds. When the branch has at least one commit beyond the base, it opens the pull with the title, base and head landWork would have used. Its body is a "Work in progress" marker plus a link to the run's log. The watcher checks for an open pull on the branch each tick, so it never opens a second one. It is stopped and awaited before the run's wrap-up, so a tick can't race landWork.
  • Run ends (src/crew/runner.ts): landWork finds the early pull and replaces the placeholder with the agent's report and the Closes #N (or Continues #N) trailer. It only touches a pull that still carries the marker, so a pull from a person or an earlier run is left alone.
  • Declined or nothing to propose (src/crew/runner.ts): an early pull is closed with a comment giving the reason. The decline reason is still not posted on the issue, because a comment there would start the next run.
  • No check loop (src/crew/dispatch.ts): a failed check on a push made while its authoring run is still running queues no check_failed follow-up. The run is found by the pull's branch, since an early pull has a different issue id from the task. No try is counted against CHECK_FAILED_LIMIT.
  • Brief and docs: src/crew/brief.ts tells the agent to push a first working commit early and keep pushing, and that the pull and preview come up on that first push. docs/APPS.md step 2 now says the pull appears at the first push.
  • Tests (test/crew.test.ts): a fake agent that pushes mid-run has an open pull and a preview deploy run before its run finishes, and exactly one pull afterwards. A failed deploy of a work-in-progress push queues no follow-up while the run is active, and the CHECK_FAILED_LIMIT budget is untouched.

Left out

  • No push-event or outbox hook; the ref poll stays inside the runner so branch knowledge lives in one module. The pull appears within 2 seconds of the push, not on the push itself.
  • No change to how Needs you lists in-progress pulls beyond the body marker.
  • I did not add a test for pushes every few seconds against the two-wide deploy gate. It relies on the existing superseding of queued deploys.

Try it Assign an issue to an agent and watch the repo's pulls. The pull should appear after the agent's first push with the "Work in progress" body and a preview. When the run ends, the same pull gets the report.

The sandbox blocked unix sockets and localhost, so the crew tests and git push ran outside it.

Closes #10

commented

Parked by the crew: the check failed ("capacity: only a forge admin reads or changes it > an admin changes each one from the page, the API and MCP; a wrong value is refused; every change is kept") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs