Skip to content

Proposal: a bare launch should move another computer's chat here by itself only when it belongs to the launch folder #2783

Open

Description

@AbirAbbas

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

  • continueAfterQuit and continuationReady in internal/tui3/homeband_resume.go: the walk, with no folder test.
  • autoContinue in internal/tui3/app.go is set from Options.Landing (codeaf and codeaf chat with no --session and not resume, set in cmd/codeaf/chatv3.go and chatv3_local.go).
  • chatlist.Row.Folder in internal/chatlist/rows.go is the name of the folder the chat works in on the computer that holds it ("" when unknown). It is a name, not a path.
  • SafeToContinue in cmd/codeaf/synctake.go is 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 chat in internal/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.

  1. The automatic move at launch happens only when the released chat's Folder is 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 press alt+c instead of arriving without a key.
  2. 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.
  3. Folder is a name, so two projects both called app match. 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.
  4. Nothing changes for a chat still held elsewhere, for the other launch doors the manual lists, or for Enter on 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 in internal/e2e/displaced_continuation_e2e_test.go has two paired homes): a chat released by computer A in folder api. On computer B, launch bare in an empty folder named scratch. Assert Home is on screen with Continue <A>'s latest chat here? and the chat has not moved (no Moved from). Press alt+c and assert Moved from <A>.
  • e2e: the control: on computer B launch bare in a folder named api. Assert the chat moves by itself with Moved from <A>, as today.
  • Unit: continueAfterQuit with a row whose Folder differs from the launch folder returns no command and leaves the resume card standing. The existing TestC31... 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 invalidates names bare codeaf moves the most recently released chat in any folder.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions