specs/025-resume-selected-executable/plan.md
Implementation Plan: Resume Retains Selected Executable Path
Branch: t3/resume-selected-executable | Date: 2026-10-08 | Spec: spec.md
Summary
Implement a pure helper resolve_resume_argv(original_argv: &[String], resume_argv: &[String]) -> Vec<String> in signaltty-agent. Wire it into signaltty-server::router at the two session identity writers (h_hook_event, h_pane_report_session) and at resume execution (h_pane_resume).
Design & Architecture
1. Pure Helper in signaltty-agent
crates/signaltty-agent/src/resume.rs:
rust
| 1 | pub fn resolve_resume_argv(original_argv: &[String], resume_argv: &[String]) -> Vec<String> |
Rules:
- If
resume_argvis empty, return empty vector. - If
resume_argv[0]contains/(path-qualified, e.g. explicit manifest path), returnresume_argvas-is. - If
original_argvis empty, its first path is not absolute, or the resume program is empty, returnresume_argvas-is. Legacy relative paths have no reliable launch directory. - Extract
original_basenamefromoriginal_argv[0]. Iforiginal_basename == Some(resume_argv[0]): Replaceargv[0]withoriginal_argv[0], keepingresume_argv[1..]. - Otherwise (e.g. promoted shell, wrapper with different basename), return
resume_argvas-is.
2. Integration Seams in signaltty-server
h_hook_event: Whenadapter.session_identityupdatesp.agent.resume_argv, resolve viaresolve_resume_argv(&p.argv, &resume_argv).h_pane_report_session: When writingpane.agent.resume_argv, resolve viaresolve_resume_argv(&pane.argv, &r.argv).h_pane_resume: When extractingraw_argvfrompane.agent.resume_argv, resolve viaresolve_resume_argv(&pane.argv, &raw_argv), spawn withresolved, and updatepane.agent.resume_argv = Some(resolved.clone())only after successful spawn.
TDD Plan
- Red Test Phase:
- Write pure unit tests in
crates/signaltty-agent/src/resume.rscovering:- 5 built-in adapters (
codex,claude,opencode,cursor,pi) - Relative paths (
./bin/codex,sub/bin/claude) - Empty inputs (
[],[""]) - Bare commands (
["codex"]) - Promoted shells (
["/bin/bash"]) - Explicit manifest paths (
["/manifest/bin/codex", ...]) - Suffix flags on original command (
["/opt/codex", "-m", "gpt-4"]) - Differing wrapper basenames (
["/usr/local/bin/my-wrapper"])
- 5 built-in adapters (
- Write real IPC integration regression tests in
crates/signaltty-server/tests/integration.rs:- Sibling test
report_session_builds_resume_retains_selected_executable_without_manifest - Hook-event writer test
- Stale bare snapshot repair test
- Sibling test
- Run tests and record RED failure output.
- Write pure unit tests in
- Implementation Phase:
- Implement
resolve_resume_argvand export fromsignaltty-agent. - Update
h_hook_event,h_pane_report_session, andh_pane_resumeincrates/signaltty-server/src/router.rs.
- Implement
- Green Test Phase:
- Run the new unit and integration tests and verify GREEN.
- Run clippy and fmt on
signaltty-agentandsignaltty-server.
- Documentation:
- Update
docs/07-agents.mdanddocs/08-ipc.md.
- Update
Review follow-up: normalize relative path-qualified argv0 before spawn/split, using launch cwd under the existing Store lock, without canonicalizing symlinks or changing bare PATH commands. Await and reap the owned server via the existing wait_for_exit testkit helper before editing old snapshot fixtures.