Skip to content

feat(path-cli): path resume — one-shot resume into a coding agent#83

Merged
akesling merged 21 commits into
mainfrom
akesling/resume
May 11, 2026
Merged

feat(path-cli): path resume — one-shot resume into a coding agent#83
akesling merged 21 commits into
mainfrom
akesling/resume

Conversation

@akesling
Copy link
Copy Markdown
Contributor

@akesling akesling commented May 10, 2026

Summary

Adds path resume <input> — the inverse of path share. Takes a Pathbase URL, owner/repo/slug shorthand, local file, or cache id; validates that the document is a single agent-bearing Path; lets the user pick a coding-agent harness via fzf (or skip with --harness X); projects the session into the harness's on-disk layout under the chosen working directory (-C, --cwd P; default cwd); then execvp's the harness's resume command.

  • Source-harness inference reads path.meta.source (claude-code/gemini-cli/codex/opencode/pi) with actor-string fallback. The picker pre-selects the source when it's installed.
  • Exec is mockable via cmd_resume::ExecStrategy (RealExec for production, RecordingExec for tests) so integration tests exercise the full resolve→pick→project pipeline without launching a real harness.
  • Cache-aware: path resume <pathbase-url> probes the local cache first and skips the network on hit; --force re-fetches; --no-cache skips both probe and write.
  • Error paths are clear: empty graph, multi-path graph, agent-less path, harness-not-on-PATH, no-installed-harnesses, picker cancel (exit 130) all surface actionable messages.

Spec: docs/superpowers/specs/2026-05-08-path-resume-command-design.md
Plan: docs/superpowers/plans/2026-05-08-path-resume-command.md

Implementation notes

  • Five pub(crate) project_<harness> wrappers in cmd_export.rs compose the existing private build + write helpers and return the projected session id. No behavior change to path export <harness>.
  • cmd_import::pathbase_fetch_to_doc extracted from derive_pathbase so both path import pathbase and path resume <url> share the fetch+parse path.
  • New cmd_import::pathbase_cache_id_of lets cmd_resume compute the would-be cache id without a network round-trip.
  • path-cli and toolpath-cli bumped to 0.9.0.

Tests

  • 22 new unit tests in cmd_resume.rs (helpers, picker, exec strategy, orchestration, cache reuse).
  • 5 new unit tests in cmd_export.rs (one per project_<harness> wrapper).
  • 9 new integration tests in tests/resume.rs driving end-to-end via RecordingExec.
  • Also fixed a pre-existing \$HOME race in cmd_export::tests::opencode_writes_into_db_with_project that was quietly flaking the parallel suite, and a clippy nit in toolpath-gemini.

Test plan

  • `cargo test --workspace` — 1500+ tests pass
  • `cargo clippy --workspace --all-targets -- -D warnings` — clean
  • `path resume --help` lists all flags
  • `path resume --harness claude` rejects with "no agent session"
  • `path resume ` rejects with "couldn't resolve"
  • `path resume alex/pathstash/ --harness claude` routes to the Pathbase server (404)
  • `path resume --harness claude` invoked twice → both load from cache, no error

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

akesling added 20 commits May 9, 2026 13:18
A one-shot resume that fetches a Toolpath doc (URL, Pathbase
shorthand, file path, or cache id), picks a coding-agent harness
(interactive picker by default, `--harness` to skip), projects the
session into the harness's on-disk layout, and execs the harness's
resume command. Mirror image of `path share`.
Bite-sized TDD tasks covering the ResumeRecipe refactor of
cmd_export.rs, the new cmd_resume.rs module (resolve_input,
ensure_path_with_agent, pick_harness, exec_harness with injectable
strategy), pathbase fetch helper extraction, integration tests,
docs, and version bump.
Replace the five-site cmd_export refactor + new pub ResumeRecipe type
with five thin pub(crate) project_<harness>(path, cwd) wrappers in
cmd_export.rs that return the projected session id. cmd_resume gets
an argv_for(harness, session_id) helper plus an ExecStrategy taking
(binary, args, cwd).

Plan drops from 17 tasks to 13. Spec validation now operates on
Graph (no Document enum exists in the codebase).
Pull the network-fetch-and-parse logic out of derive_pathbase into a
pub(crate) pathbase_fetch_to_doc so that the upcoming path resume <url>
command can reuse it without duplicating the HTTP/credential dance.
Also promote MockServer and its start/base methods to pub(crate) so the
new test in cmd_import can reach the test helper from a sibling module.
opencode_writes_into_db_with_project removed HOME on cleanup
without restoring the prior value. Two cmd_resume tests that go
through resolve_input → cmd_pathbase::credentials_path didn't
acquire TEST_ENV_LOCK, racing with the unrestored HOME and
intermittently failing with "$HOME is not set".

Save+restore HOME and XDG_DATA_HOME symmetrically in the opencode
test, and lock TEST_ENV_LOCK in the two cmd_resume tests that
read global config.
Drive `path resume` end-to-end through `run_with_strategy` with a
`RecordingExec` so the would-be `execvp` becomes a captured
`(binary, args, cwd)` tuple. Coverage:

- Per-harness positive cases (claude / gemini / codex / opencode / pi),
  each asserting the expected binary, the resume flag, and the
  expected on-disk projection (JSONL written, SQLite row inserted).
- Cache-id input → seeds a cache entry under a scoped HOME, runs
  resume, asserts the recorded recipe.
- Multi-path graph, agent-less path, and harness-not-on-PATH
  rejections all return the spec'd error messages.

Expose `cmd_resume` as `pub mod` and re-export `HarnessArg` from it
so integration tests don't need to reach into `cmd_share`. Shared
test support (env-isolating RAII guards, the `make_convo_path`
fixture) lives in `tests/support/`.
`path-cli` integration test count is 63 after rebasing onto main
(which adds one share-related integration test). Replace
`get(K).is_none()` with `!contains_key(K)` in two
`toolpath-gemini` test assertions to silence
clippy::unnecessary_get_then_check.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 10, 2026

🔍 Preview deployed: https://69a33f9e.toolpath.pages.dev

Re-running `path resume <pathbase-url>` was erroring on the second
invocation with "cache entry already exists; pass --force to overwrite".
The user shouldn't have to care about the cache: a hit means we already
have the bytes, so we should silently use them and skip the network
round-trip.

cmd_resume now probes the cache before fetching:
- Cache hit (and not --force) → load locally, skip network entirely.
- Cache miss → fetch, then write (force-overwrite, since we either had
  no entry or the user explicitly passed --force).
- --no-cache → skip both probe and write (ephemeral environments).

New `cmd_import::pathbase_cache_id_of` exposes just the cache-id
computation (`make_id` over the parsed `owner/repo/slug`) so the probe
doesn't need a network round-trip. `--force` and `--no-cache` doc
comments updated to describe the new semantics.

Regression test seeds a known cache entry, points the input at a
500-erroring mock server, and asserts resolve_input still returns
the cached graph — proving we never hit the network.
@akesling akesling merged commit 5ac423a into main May 11, 2026
2 checks passed
@akesling akesling deleted the akesling/resume branch May 11, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant