feat(path-cli): path resume — one-shot resume into a coding agent#83
Merged
Conversation
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.
|
🔍 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.
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.
Summary
Adds
path resume <input>— the inverse ofpath share. Takes a Pathbase URL,owner/repo/slugshorthand, local file, or cache id; validates that the document is a single agent-bearingPath; lets the user pick a coding-agent harness viafzf(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); thenexecvp's the harness's resume command.path.meta.source(claude-code/gemini-cli/codex/opencode/pi) with actor-string fallback. The picker pre-selects the source when it's installed.cmd_resume::ExecStrategy(RealExecfor production,RecordingExecfor tests) so integration tests exercise the full resolve→pick→project pipeline without launching a real harness.path resume <pathbase-url>probes the local cache first and skips the network on hit;--forcere-fetches;--no-cacheskips both probe and write.Spec:
docs/superpowers/specs/2026-05-08-path-resume-command-design.mdPlan:
docs/superpowers/plans/2026-05-08-path-resume-command.mdImplementation notes
pub(crate) project_<harness>wrappers incmd_export.rscompose the existing private build + write helpers and return the projected session id. No behavior change topath export <harness>.cmd_import::pathbase_fetch_to_docextracted fromderive_pathbaseso bothpath import pathbaseandpath resume <url>share the fetch+parse path.cmd_import::pathbase_cache_id_ofletscmd_resumecompute the would-be cache id without a network round-trip.path-cliandtoolpath-clibumped to 0.9.0.Tests
cmd_resume.rs(helpers, picker, exec strategy, orchestration, cache reuse).cmd_export.rs(one perproject_<harness>wrapper).tests/resume.rsdriving end-to-end viaRecordingExec.\$HOMErace incmd_export::tests::opencode_writes_into_db_with_projectthat was quietly flaking the parallel suite, and a clippy nit intoolpath-gemini.Test plan
Need help on this PR? Tag
@codesmithwith what you need.