fix(copilot): exact resume via pinned session id, synthetic focus events, left-arrow conflict - #56
Merged
Merged
Conversation
…s, free the left-arrow key - dispatch now passes --session-id <uam-id> (uam ids are UUIDv4) so --resume=<uam-id> matches by Copilot's primary session id instead of depending on name matching; --name still seeds the same value for display and as the fallback match for sessions dispatched by older uam versions - the session host now synthesizes ?1004 focus events: focus-in when a controller attaches (or when the provider enables the mode with a controller already attached, which is how every resume starts) and focus-out when the last controller detaches; without a terminal attached, providers that dim or lock their input box while unfocused never heard either event - provider terminal policy gains a BackDetach field; copilot disables the bare-left-arrow quick detach because it binds left arrow to its own pane navigation at an empty composer; profiles and session overrides still take precedence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three copilot-under-uam defects reported together: Ctrl+X r starting a fresh conversation instead of resuming, the composer rendering unfocused (dead to input) after resume, and the attach client's quick-detach stealing copilot's left-arrow pane navigation.
Resume starts a new conversation
uam restartwas verified to pass--resume=<uam-id>correctly; the failure is on the matching side. Verified against Copilot CLI 1.0.77 with an isolated$HOME: when--resume's value matches nothing, interactive copilot shows only a small toast ("No session or name matched") and silently starts a new session — exactly the reported symptom. The old adapter depended entirely on--resumefalling back to name matching against the--nameseeded at dispatch.uam session ids are already UUIDv4, and
--session-id <uuid>sets the primary id of a new copilot session. Dispatch now passes--session-id <uam-id> --name <uam-id>, so--resume=<uam-id>matches by primary session id — the most stable lookup the CLI offers.--namekeeps seeding the same value for display and as the fallback match for sessions dispatched by older uam versions (unchanged resume flag value works for both generations).Verified against the real CLI (1.0.77, isolated
$HOME):--session-idcreates the session with that exact UUID,--resume=<uuid>resolves it (resume-auto-cd: resolved persisted cwdin debug logs), a miss reproduces the silent-new-session behavior. Verified end-to-end with a logging shim onPATH: dispatch →--yolo --session-id <id> --name <id>, restart →--yolo --resume=<id>, uam record intact.Composer unfocused after resume
Copilot enables focus reporting (
?1004h, PTY-verified along with?1049h ?1003h ?1006h ?2004h). Under a detached host no terminal ever sends it a focus-in, so it starts believing it is blurred; terminals that don't emit a focus event when the mode is enabled by replay (common over SSH/mobile clients) never correct that. The host now synthesizes\x1b[Iwhen a controller attaches (or when the provider enables?1004with a controller already attached — how every resume starts, since the client attaches while the replacement process boots) and\x1b[Owhen the last controller detaches. AproviderFocusedflag dedupes the two racing observation paths; forwarded real terminal focus events are untouched.Left arrow detaches instead of navigating
The bare-left-arrow quick detach assumes left arrow is a no-op at an empty prompt (Claude Code semantics). Copilot binds it to pane navigation.
ProviderTerminalPolicygains aBackDetachfield; copilot setsBackDetachDisabledas its default. Profiles, session overrides, and the env override still win.Tests
TestHostSynthesizesFocusEventsAtAttachBoundaries/...WhenModeArmsAfterAttach(in-process host, real attach machinery)TestFocusReportingTracksMode1004(vterm)--session-idBackDetachtodo8byte-exact fixture now expects the deterministic leading focus-in;todo11fake provider exit marker tolerates the merged focus prefix-racesuite green locally exceptTestWizardWorkdirShowsNoGitWarning, which fails identically on cleanmainin this environment (pre-existing, unrelated)Unverified: the resume fix against an authenticated copilot install (none on this machine) — the CLI-side semantics above were verified unauthenticated, where session creation/resolution works offline.