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

A park note says what each failed try of the pull changed #10883

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

When the crew parks an issue whose pull went red more than once, the "Parked by the crew" comment now adds one line per failed try, e.g. `try 2: src/b.ts`. Checks run before the push: `bun scripts/gate.ts` and `bun x tsc --noEmit` pass, and every touched or related test file passes. I did not run the full suite.

shipped production is serving it deploy 7ab3f87

opened this

When the crew parks an issue whose pull went red more than once, the "Parked by the crew" comment now adds one line per failed try, e.g. try 2: src/b.ts. Checks run before the push: bun scripts/gate.ts and bun x tsc --noEmit pass, and every touched or related test file passes. I did not run the full suite.

  • Wiring: a new parkPullTold in src/crew/park_pull.ts calls triesChanged and passes the lines to parkPull. Its two callers, the red-check answer in src/crew/dispatch.ts and sweepStaleReds in src/crew/stale_reds.ts, now use it.
  • Limits: src/crew/tries.ts now tells at most 5 tries and 10 files per try (it was 2 and 4). It is out of scripts/unreached-allow.json.
  • When it fires: the lines are added only when there are two or more tries. parkPull is unchanged for other callers.
  • New test: test/crew-tries.test.ts builds a fixture repo with two red heads. It parks the pull and finds both try 1: and try 2: lines in the issue comment.
  • Changed existing tests: I updated the expectations in test/crew-tries.test.ts to the new limits. Parking now reads git history first, so it lands a moment after the announcement. test/crew-failed-while-building.test.ts and test/crew-shared-red.test.ts now wait for the pull to close instead of asserting it immediately.
  • Left out: if the git read fails, the note is written without the try lines.

To try it, park an autonomous repo's agent pull that has two red heads and open its issue.

Closes #10863

commented

When the crew parks an issue whose pull went red more than once, the "Parked by the crew" comment now adds one line per failed try, e.g. try 2: src/b.ts. Checks run before the push: bun scripts/gate.ts and bun x tsc --noEmit pass, and every touched or related test file passes. I did not run the full suite.

  • Wiring: a new parkPullTold in src/crew/park_pull.ts calls triesChanged and passes the lines to parkPull. Its two callers, the red-check answer in src/crew/dispatch.ts and sweepStaleReds in src/crew/stale_reds.ts, now use it.
  • Limits: src/crew/tries.ts now tells at most 5 tries and 10 files per try (it was 2 and 4). It is out of scripts/unreached-allow.json.
  • When it fires: the lines are added only when there are two or more tries. parkPull is unchanged for other callers.
  • New test: test/crew-tries.test.ts builds a fixture repo with two red heads. It parks the pull and finds both try 1: and try 2: lines in the issue comment.
  • Changed existing tests: I updated the expectations in test/crew-tries.test.ts to the new limits. Parking now reads git history first, so it lands a moment after the announcement. test/crew-failed-while-building.test.ts and test/crew-shared-red.test.ts now wait for the pull to close instead of asserting it immediately.
  • Left out: if the git read fails, the note is written without the try lines.

To try it, park an autonomous repo's agent pull that has two red heads and open its issue.

commented

When the crew parks an issue whose pull went red more than once, the "Parked by the crew" comment now adds one line per failed try, such as try 2: src/b.ts.

The earlier check failure was one test, "above the floor: a red is the pull's own, parked as ever, and no card" in test/checks-disk-red.test.ts. Parking now reads the pull's git history first, so the pull closes a moment after the red is announced. That test asserted it was closed immediately. It now waits for the close, the same fix I made earlier in test/crew-failed-while-building.test.ts and test/crew-shared-red.test.ts. The test was wrong, not the code. test/checks-disk-red.test.ts passes and bun x tsc --noEmit is clean. I did not re-run the full suite.

  • Wiring: the new parkPullTold in src/crew/park_pull.ts calls triesChanged and passes the lines to parkPull. The red-check answer in src/crew/dispatch.ts and sweepStaleReds in src/crew/stale_reds.ts now use it.
  • Limits: src/crew/tries.ts now tells at most 5 tries and 10 files per try, up from 2 and 4. It is out of scripts/unreached-allow.json.
  • When it fires: the lines are added only when there are two or more tries.
  • Tests: test/crew-tries.test.ts has a fixture repo with two red heads, parks the pull, and finds both try 1: and try 2: lines in the issue comment. I updated that file's expectations to the new limits.
  • Left out: if the git read fails, the note is written without the try lines.

To try it, park an autonomous repo's agent pull that has two red heads and open its issue.

Changes requested — before the latest push

One thing to fix first: parkPullTold passes since="" to triesChanged, so every failed check or deploy the pull ever had is told, including tries from before a person last spoke. Both callers already compute since = lastHumanWord(app, issue, agent) for the same decision (dispatch.ts answerRed, stale_reds.ts). Pass it through (parkPullTold takes a since argument) so the note lists only the tries that counted toward the park, and add a test with a red head older than the human word that is left out.

Also: (1) answerRed is now fire-and-forget async, so the pull closes later than before; add a test that two announcements racing do not write two park notes (parkPull's hold check helps, but prove it). (2) The tests poll with Bun.sleep loops in three files; export a small shared helper rather than copying closes twice, and keep it fast. (3) Add docs/features/ text for the park note's try lines (e.g. in app-crew.md or crew-line.md); a user-visible comment change has no how-to now. Not README.

The limits (5 tries, 10 files), the allow-list removal and the two-red-heads fixture test are right.

commented

The park note now lists only the tries since the last human word, and the review items are done. bun scripts/gate.ts and bun x tsc --noEmit are clean, and I ran the tests for the files I touched. I did not re-run the full suite. The change is pushed.

  • Since: parkPullTold takes a since argument, and both callers pass the lastHumanWord they already compute (answerRed in src/crew/dispatch.ts, sweepStaleReds in src/crew/stale_reds.ts). A red head older than that word is left out of the note. A new test in test/crew-tries.test.ts checks that an old red head is left out.
  • Behaviour change in src/crew/tries.ts: triesChanged now diffs the first told try from the last excluded head instead of from the base. Without this the first told line would still list the excluded try's files. I changed the expectation in the existing "skips a green run, a run before since…" test to match, since it had pinned the old base diff.
  • Race: a new test fires two parkPullTold calls together. It finds one winner and one note. parkPull re-reads the issue as open and closes it before returning, so the second caller sees it closed.
  • Shared helper: test/helpers/pull-closes.ts exports pullCloses, which polls every 2 ms. It replaces the copied closes in test/crew-failed-while-building.test.ts and test/crew-shared-red.test.ts, and the inline loop in test/checks-disk-red.test.ts.
  • Docs: docs/features/park-note-tries.md describes the try lines in the park note, with how to try it. I made it a new file, since neither app-crew.md nor crew-line.md covers parking.
Approved

Earlier asks are met. Only tries after the last human word are told, and the first told try diffs from the last excluded head. The race test is there. The shared pullCloses helper replaces the copied loops. The how-to is in docs/features/park-note-tries.md, not the README. Two things to do next. Non-blocking: pullCloses polls with Bun.sleep(2), so a test that waits on a timer can flake on a slow machine. Awaiting a returned promise from parkPullTold would remove the wait. Non-blocking: parkPullTold swallows a git failure with .catch(() => []), so the note silently loses its try lines. A log.warn there would make that visible.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs