Skip to content

feat(cli): --continue, session picker, /resume, --version, doctor - #37

Merged
Amanbig merged 1 commit into
mainfrom
feat/continue-resume-version-doctor
Oct 31, 2026
Merged

Amanbig merged 1 commit into
mainfrom
feat/continue-resume-version-doctor

Conversation

@Amanbig

@Amanbig Amanbig commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Summary

Session handling and diagnostics, modelled on what people expect from similar tools.

Continuing and resuming

  • Sessions now record their directory (new cwd column, migrated automatically; paths are normalized so symlinks and Windows case differences match)
  • devorch --continue / -c: reopen the most recent non-empty conversation started in the current directory. If there is none it says so and starts a new session
  • devorch --resume with no ID opens an arrow-key picker: this directory's sessions first (labelled by what you first asked, not Session 2026-10-31 15:53), with "Show sessions from all directories…"; falls back to all directories when this one has none. --resume <id> works as before and wins over --continue
  • /resume [id] switches session inside the REPL: loads the history and summary, resets checkpoints and tasks (they belong to the conversation you left), keeps your current provider/model and notes if the session used another, and shows the last exchange so you see where you left off
  • sessions list --here / /sessions list [n] [here], plus a Directory column
  • Two things this needed fixing: DevOrch creates a session at startup even if nothing is typed (about a dozen empty ones today), so --continue and the picker skip empty sessions; and resumed messages were loaded ORDER BY created_at (one-second precision), so messages saved in the same second could come back out of order. They now load in saved order, and recency ties are broken by message id

--version / -V, and devorch doctor (/doctor)

A read-only report meant to be pasted into bug reports: runtime, config folder, API keys (only "set/missing", never values), default provider, OS keychain, permissions, project instructions and trust, MCP, sessions, git, clipboard tool, Pillow, terminal and encoding. It warns when edit/filesystem/shell are pre-approved (the situation behind the earlier accidental edits), a check that crashes becomes a failed row instead of killing the report, long paths fold instead of being cut off, and the exit code is 1 if anything failed.

One thing worth knowing

Typer cannot express an option with an optional value: a bare --resume errors, and --resume -c swallows -c as the ID (verified with a probe). So the entry point rewrites a value-less --resume/-r into an internal marker (normalize_resume_argv, 12 cases tested). Running the app through anything other than main() (e.g. CliRunner) does not apply the rewrite.

Also in this PR

tests/conftest.py now gives every test an empty ~/.devorch inside the throwaway home from #35. With one shared home, sessions saved by one test were visible to the next (this surfaced while writing these tests).

Tests (+68)

  • Sessions: migration of an old database, directory recording/normalization (+ symlink), filtering, empty-session handling, newest-wins incl. same-second ties, continuation sessions, message order, titles
  • Picker/startup/resume: every branch (explicit id vs continue vs bare resume, cancel, nothing saved, fall back to all, widen), history/summary/checkpoint reset, provider note, failed resume changes nothing, preview
  • Entry point: argv rewrite cases, --version, options registered on the REPL entry points, version in pyproject.toml must equal cli.constants.VERSION (a release guard for the two-places problem)
  • Doctor: no key value in any output (rows or CLI), failing/passing default provider, local provider, the pre-approved-permissions warning, trust states, crashing check, git missing, non-UTF-8 terminal, unwritable config, exit codes, markup-like text rendered verbatim
  • Full suite 578 passing, ruff clean; run with the real ~/.devorch untouched (checked by file mtime)

Not exercised

The interactive paths (the questionary picker, /resume in a live REPL, --continue starting a real session) were not run in a real terminal: I tested the logic with scripted choosers and a fake agent.

Sessions now record the directory they were started in, so devorch --continue
(-c) reopens the latest non-empty conversation from the current directory. A
bare --resume (rewritten at the entry point, since Typer cannot take an
optional value) opens a picker, and /resume switches session inside the
REPL. Add --version and a read-only doctor command that never prints key
values and warns about pre-approved edit permissions.

Also fix resumed messages loading out of order when saved within the same
second, and make every test start with an empty throwaway home.
@Amanbig
Amanbig merged commit f00a4b8 into main Oct 31, 2026
13 checks passed
@Amanbig
Amanbig deleted the feat/continue-resume-version-doctor branch October 31, 2026 11:43
@Amanbig Amanbig mentioned this pull request Nov 1, 2026
2 tasks done
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