Repository navigation
Description
What happened
dev@a597fdcc3, hand test on two paired computers (Linux and macOS) over the sync service.
On each computer, codeaf was started in a brand-new, empty folder that had no chat of its own. The most recently released chat from the other computer, which worked in a different project, moved in at once: the Moved from <device> in <T>. Everything as you left it. line, with that project's conversation open in a folder this computer had never seen. Home did not open, and no new chat for the folder the person was standing in was offered.
This is the designed behaviour, so it is a proposal and not a regression. The manual describes it in these words (internal/manual/chat/continuing-a-chat-on-another-computer.md, I quit on my laptop and opened my desktop): Opening bare codeaf on your other paired computer within 24 hours continues the released chat automatically, and bare startup still chooses the most recently released eligible chat and checks local safety first. The only exclusions it lists are a running chat on the other computer, a named chat, --host, --at, --session, a chat with unsaved local edits, and another local window that already has a chat open. The launch folder is not one of them.
The code does the same. continueAfterQuit in internal/tui3/homeband_resume.go takes the released chat with the smallest ReleasedAgo among rows that are Idle, Released, not Mine, from another device and within resumeRecent (24 hours). It never reads the folder the launch started in.
Replication
Deterministic (no model).
go test ./internal/tui3 -run '^TestC31QuitContinuesWithoutAKey$' -v. The fixture's released row (leftOffRow) names no folder and the app has no launch folder to compare, and the test still expects continueAfterQuit to return the safety-check command and continuationReady to take the chat. Give the row any Folder that is not the launch folder and the result does not change. That is the behaviour to change.
To see it on a screen, pair two homes against a local relay (CODEAF_SYNC_URL, the keyless stub model from test/remote/stub for a turn), quit a chat cleanly on the first computer, then run codeaf bare in an empty temporary folder on the second.
Field (real models). Not needed.
Where
continueAfterQuitandcontinuationReadyininternal/tui3/homeband_resume.go: the walk, with no folder test.autoContinueininternal/tui3/app.gois set fromOptions.Landing(codeafandcodeaf chatwith no--sessionand notresume, set incmd/codeaf/chatv3.goandchatv3_local.go).chatlist.Row.Folderininternal/chatlist/rows.gois the name of the folder the chat works in on the computer that holds it ("" when unknown). It is a name, not a path.SafeToContinueincmd/codeaf/synctake.gois the check that runs first. It looks at local work, not at the folder.- Manual: the two sections named above, and
## I quit on my laptop and opened my desktop — straight back into the chatininternal/manual/chat/home.md.
The fix
Choice to make: the automatic move is for a person returning to their work, and a launch in a folder with no connection to that work is not returning to it. Make the rule narrow, and keep the way back wide.
- The automatic move at launch happens only when the released chat's
Folderis the name of the folder codeaf was launched in. In any other folder, bare launch opens Home as it does with nothing to continue. The cost is one key for a person who launches from a folder that is not the chat's: they pressalt+cinstead of arriving without a key. - The chat is not hidden. It is offered on Home as the existing one-key card,
Continue <device>'s latest chat here?(alt+c continue here,alt+x not now), which already shows for a chat whose holder let go. The person decides, with the same safety check. Folderis a name, so two projects both calledappmatch. Accept that for now: a wrong match opens a chat the person recognizes, which is no worse than today. A stricter test needs a project identity on the row (for example the git remote). That is a larger change, and it is not part of this one.- Nothing changes for a chat still held elsewhere, for the other launch doors the manual lists, or for
Enteron a Home row.
If the choice is that the current rule is right (a bare launch means "take me back", wherever it is run), the change is the manual and one sentence on the launch line: say that the move happens in any folder, and say how to cancel it (typing before the safety check answers cancels it; esc goes Home).
Acceptance
- e2e: the tmux suite (
go test -tags e2e ./internal/e2e/, the displaced-continuation rig ininternal/e2e/displaced_continuation_e2e_test.gohas two paired homes): a chat released by computer A in folderapi. On computer B, launch bare in an empty folder namedscratch. Assert Home is on screen withContinue <A>'s latest chat here?and the chat has not moved (noMoved from). Pressalt+cand assertMoved from <A>. - e2e: the control: on computer B launch bare in a folder named
api. Assert the chat moves by itself withMoved from <A>, as today. - Unit:
continueAfterQuitwith a row whoseFolderdiffers from the launch folder returns no command and leaves the resume card standing. The existingTestC31...tests set the launch folder to match, so they keep their meaning. - The two manual sections quote the new rule, and the change entry's
invalidatesnames barecodeafmoves the most recently released chat in any folder.
Activity