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

The terminal's pull screen takes back a shipped pull with one key and a confirm, as the page does #7222

Merged opened this

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

Merged

On a merged pull in the terminal, `T` now takes it back, with a one-line confirm in between. I ran `bun x tsc --noEmit`, `bun scripts/design-lint.ts` and the new test plus `test/revert.test.ts` (12 pass). I did not run the wider suite: `scripts/fast.ts` named 954 of 1478 files for this diff, so I left the full run to the forge's check.

shipped production is serving it deploy 23f74da

opened this

On a merged pull in the terminal, T now takes it back, with a one-line confirm in between. I ran bun x tsc --noEmit, bun scripts/design-lint.ts and the new test plus test/revert.test.ts (12 pass). I did not run the wider suite: scripts/fast.ts named 954 of 1478 files for this diff, so I left the full run to the forge's check.

  • Behaviour: T shows as "take it back" only on a shipped pull in a local repository, for a person who can write.

- The confirm reads "Take back #N" and names the pull's title. Cancel changes nothing. "Take it back" calls revertPull and opens the new pull's screen. - The key is absent on an open pull, on a mirror, and to an agent. - If revertPull refuses, the toast reads "That could not be taken back: …", with the same wording as the page. A second take-back, for example, gives "it has already been taken back".

  • Shared wording: I moved takeBackWords from src/web/studio/actions.ts into src/actions/revert.ts so the page and the terminal use one copy. The page's text is unchanged.
  • Key clash: T already opens an app preview's terminal. On a shipped pull the take-back wins and the preview hint is hidden. Open pulls keep the old meaning.
  • Not done: a second take-back is refused after the confirm rather than before it. That keeps revertPull as the only place that decides.
  • Tests: test/tui-take-back.test.ts drives the screen. It covers the key absent on an open pull and to an agent, confirm then the new pull, cancel then nothing made, and the second take-back refused.

Closes #7212

commented

On a merged pull in the terminal, T now takes it back, with a one-line confirm in between. I ran bun x tsc --noEmit, bun scripts/design-lint.ts and the new test plus test/revert.test.ts (12 pass). I did not run the wider suite: scripts/fast.ts named 954 of 1478 files for this diff, so I left the full run to the forge's check.

  • Behaviour: T shows as "take it back" only on a shipped pull in a local repository, for a person who can write.

- The confirm reads "Take back #N" and names the pull's title. Cancel changes nothing. "Take it back" calls revertPull and opens the new pull's screen. - The key is absent on an open pull, on a mirror, and to an agent. - If revertPull refuses, the toast reads "That could not be taken back: …", with the same wording as the page. A second take-back, for example, gives "it has already been taken back".

  • Shared wording: I moved takeBackWords from src/web/studio/actions.ts into src/actions/revert.ts so the page and the terminal use one copy. The page's text is unchanged.
  • Key clash: T already opens an app preview's terminal. On a shipped pull the take-back wins and the preview hint is hidden. Open pulls keep the old meaning.
  • Not done: a second take-back is refused after the confirm rather than before it. That keeps revertPull as the only place that decides.
  • Tests: test/tui-take-back.test.ts drives the screen. It covers the key absent on an open pull and to an agent, confirm then the new pull, cancel then nothing made, and the second take-back refused.
Changes requested — before the latest push

The behaviour is sound and the tests cover the key, the confirm, cancel and the refusal. Three things to fix in one round:

  1. README/docs: the pull says the terminal now takes a pull back, but nothing user-facing says so. Add the T key (shipped pull, local repo, a person who can write) to the README terminal section or the terminal key docs.
  2. Tests: add the cases the gate claims but no test pins. A guest or read-only user must not see the key and must not trigger it by pressing T. A mirrored repo (origin set) must not show it. Each would fail if the mayTakeBack conditions were dropped.
  3. Direction: the repository says pipeline first (#6534, #6611, #5276, #3316 and so on) before any feature. This is a terminal feature with no link to the pipeline. Keep it small and name in the pull why it goes ahead of that queue. If it cannot be justified, park it.

Non-blocking: mayTakeBack calls getPull on every render of the hint list. Compute it once per render. Reusing the T key that already opens an app preview terminal is acceptable because a shipped pull has no live preview, but say so in the README line.

The web side is only a removal of the moved takeBackWords, so there is no design-system concern.

commented

All three points are addressed and pushed to the same branch. bun x tsc --noEmit is clean and test/tui-take-back.test.ts passes (7 tests). One run of it reported an unexplained "1 error" alongside 7 passes; two reruns were clean, so I haven't found its cause.

  1. Docs: the README now says what T does. It sits beside the other terminal key notes, and it says the key is for a person who can write a local repository, never an agent, reader, guest or mirror.
  2. Tests: two tests are added, one for a guest and a read-only user (bob), one for a mirrored repository.

- Each checks the key is not in the hints, that pressing T opens no confirm, and that no revert pull is made. - To confirm they bite, I removed the gate's mirror, agent and write conditions in a scratch copy. The agent, guest/read-only and mirror tests all failed. I restored the file before committing.

  1. Direction: I can't justify this going ahead of the pipeline queue (#6534, #6611, #5276, #3316), so I'm not making that case. The change is small and was assigned as issue #7212 with low risk, and it touches neither the pipeline nor the checks. If you want the queue honoured strictly, park this pull. I'm leaving that call to you.

I also made the non-blocking fix: the hints compute mayTakeBack() once per render instead of twice. The README line notes that T also opens an app preview's terminal on an open pull, and that a shipped pull has no live preview.

commented

The check failure came from my own test file, and I've pushed a fix. I haven't seen the forge's re-run yet.

Cause. test/tui-take-back.test.ts left its terminals running when each test ended. A dashboard reload then touched the database after app.close() and threw "Cannot use a closed database". Bun reported that as "1 error", which turned the shard red even though no test failed. I had seen that "1 error" earlier and wrongly treated it as flaky. It was real, and it showed up on about half of my local runs.

Fix. The test now stops its terminals in afterEach, before the database closes. It passed 6 times in a row locally with no error, and bun x tsc --noEmit is clean.

Unconfirmed. The log named four killed shards (web-origins, milestone-pace, body-limits, apps-new). Those files have nothing to do with this change. The "26 remaining shards skipped" line is fail-fast, so I treated the later kills as fallout from the first red exit. I did not run those tests here, so the re-run will confirm it.

Approved — before the latest push

Earlier asks: README line for T (met, in the terminal-keys paragraph, names who sees it); tests for guest/read-only and mirror (met, test/tui-take-back.test.ts); hints computing mayTakeBack once per render (met, pull.ts keys getter). Direction: the pull is small, touches neither pipeline nor checks, and was assigned; I will not hold it behind the queue. Since my last head the only change is afterEach stopping the headless terminals before app.close(), which fixes the closed-database error that turned the shard red; that is the right fix. The take-back gate matches revertPull (local repo, writer, not an agent), and the shared takeBackWords keeps the page and terminal wording identical. The preview answers 200. Two things I would do next: (1) Non-blocking: have the confirm refuse before asking when revertOf already exists, so the user is not asked to confirm a take-back that will be refused. (2) Non-blocking: show the T hint for an open app pull and a shipped pull from one place, so the key meaning is documented in the screen help, not only in the README.

commented

I merged main into the branch and pushed it. The terminal's pull screen still takes a shipped pull back with T and a confirm, as the page does.

  • The conflict: src/web/studio/actions.ts imported takeBackWords from actions/revert.ts on this branch. main had moved it to actions/revert_words.ts, so I kept main's import.
  • What I removed: I dropped this branch's duplicate takeBackWords from actions/revert.ts. Its only other user, src/tui/screens/pull.ts, now imports from revert_words.ts too, so the page, the terminal and the MCP take_back tool share one set of take-back refusal words.
  • Checks: bun x tsc --noEmit passes. I ran 27 tests across 5 files covering the pull screen, take-back and revert, and all passed. scripts/fast.ts said the diff was too broad to name tests (forge.json changed), so I picked those files myself. I did not run the full suite; the forge's check does that on this push.
Approved

Earlier asks are met. The README now documents T and who gets it. Guest, read-only and mirror tests were added, and I read each as one that fails without the gate. The hint gate is computed once per render. The test stops its terminals before the database closes. The merge from main leaves one copy of takeBackWords, in revert_words.ts, shared by page, MCP and terminal. revertPull still decides the write, so the key gate only hides the hint. The preview answers 200. I could not diff against 9cef037f95bc because the clone lacks that commit, so I read the final change as a whole.

Non-blocking: direction puts the pipeline queue first, so next take #6534 or #6611 rather than more terminal parity. Non-blocking: a second take-back is refused only after the confirm. Hiding the key when revertOf exists would save a tap.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs