Repository navigation
feat(cli): first-run status actionable text + tutorial (#1263) - #1376
Conversation
First-run UX for `polylogue status` and a new `polylogue tutorial` walkthrough. Problem - On a fresh install, `polylogue status` reported tracebacks or vague states for empty/unconfigured/degraded scenarios — no archive, no sources, no daemon, stale pidfile, schema mismatch, locked DB, missing optional dep. Solution - New `polylogue/cli/commands/status_diagnostics.py` centralises the first-run probe chain in `diagnose_first_run(daemon_alive)`. Every probe is defensive and never raises — schema mismatch reuses `schema_version_mismatch_message`, stale pidfile mirrors `_verify_pidfile` (proc cmdline check), the optional-dep probe targets `sqlite_vec` (#828). - `polylogue/cli/commands/status.py` wires the diagnostic into both `_show_direct_status` (pre-flight + empty-archive branches) and `_show_direct_json` (replaces the ad-hoc next_action; surfaces a structured `diagnostic` block). - `polylogue/cli/commands/tutorial.py` adds a five-stage interactive walkthrough — detect sources, write config, start daemon, first search, open reader. Each stage probes its own preconditions so reruns pick up where the previous run stopped. `--non-interactive` skips prompts for tests and previews. Verification - `nix develop -c pytest tests/unit/cli/test_status_diagnostics.py tests/unit/cli/test_tutorial.py tests/unit/cli/test_status.py -q` → 31 passed. - `nix develop -c devtools verify --quick` → exit 0. Closes #1263. Ref #869. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis pull request adds a new interactive ChangesInteractive onboarding and first-run diagnostics
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a6795e5a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if diag.kind == "healthy": | ||
| return True, "Daemon is running and archive is healthy." |
There was a problem hiding this comment.
Mark daemon step complete when only optional dep is missing
_stage_start_daemon() treats the step as complete only when diagnose_first_run(...).kind == "healthy", but diagnose_first_run intentionally returns "missing_optional_dep" when sqlite_vec is absent even if the daemon is up. In environments without sqlite-vec installed, step 3 is therefore always shown as not done and tells users to run polylogued run again, which is a false instruction and prevents the tutorial from accurately resuming progress.
Useful? React with 👍 / 👎.
## Summary Make `polylogue ingest PATH` satisfy the three observable outcomes called for by #869 slice C (#1264): **accepted+observable**, **rejected (input)**, or **rejected (daemon)**. Eliminates the case where the daemon returns HTTP 202 and the CLI prints success without anything observable. ## Problem The previous ingest implementation staged the file into `archive_root()/inbox`, POSTed `/api/ingest`, and printed `Scheduled: ...` as long as `ImportOperation.status` was not literally `failed` or `error`. That violated the issue's anti-trap "Do not trust `polylogue ingest` just because the daemon returns 202": - an unrecognized daemon status (e.g. `mystery_status`) was silently treated as success; - a daemon HTTP 4xx/5xx (`HTTPError`) escaped as a raw traceback rather than an actionable message; - the success output did not reveal the staged inbox path or point at `polylogue status`, so the user had no observable handle on the scheduled work. ## Solution `polylogue/cli/commands/ingest.py`: - Catch `HTTPError` explicitly and report status code + staged path so operators know the file landed on disk and which contract failed. - Catch `URLError` separately so "connection refused" produces an actionable "is polylogued running?" message that names the daemon URL and the `polylogued` binary. - Treat only an explicit `accepted` / `pending` / `scheduled` / `queued` status as success; any other status fails loudly instead of fabricating a green line. - Success output now lists the staged path, operation id, daemon URL, and the `polylogue status` next-step pointer so the work is observable. `tests/unit/cli/test_ingest.py`: extended to cover the AC matrix — accept+observable, missing path, daemon-unreachable, daemon HTTP error, unrecognized status, daemon-reported failure. Inherited baseline cleanup per CLAUDE.md §19a: regenerated `docs/cli-reference.md`, `docs/test-quality-workflows.md`, `docs/verification-catalog.md`, `docs/topology-status.md` (drifted on master) and added `tutorial` to `test_all_subcommands_registered` plus the help snapshot (the #1263 / PR #1376 merge missed both regenerations and left master with two failing tests). No `polylogue run` resurrection. No new daemon endpoints — the CLI consumes the existing `/api/ingest` contract from #861/#1247. ## Verification ``` nix develop -c pytest tests/unit/cli/test_ingest.py -x → 8 passed in 9.22s nix develop -c devtools verify --quick → exit_code: 0, total_duration_s: 37.31 nix develop -c pytest tests/unit/cli/test_click_app.py::TestCliMetadata::test_all_subcommands_registered tests/unit/cli/test_help_snapshots.py::test_root_help_snapshot → 2 passed in 9.15s ``` Ref #869 Closes #1264
feat(cli): first-run status actionable text + tutorial (#1263)
First-run UX for
polylogue statusand a newpolylogue tutorialwalkthrough.
Problem
polylogue statusreported tracebacks or vaguestates for empty/unconfigured/degraded scenarios — no archive, no
sources, no daemon, stale pidfile, schema mismatch, locked DB,
missing optional dep.
Solution
polylogue/cli/commands/status_diagnostics.pycentralises thefirst-run probe chain in
diagnose_first_run(daemon_alive). Everyprobe is defensive and never raises — schema mismatch reuses
schema_version_mismatch_message, stale pidfile mirrors_verify_pidfile(proc cmdline check), the optional-dep probetargets
sqlite_vec(feat(daemon): post-ingest embedding task — voyage-4 integration, cost tracking, status surface #828).polylogue/cli/commands/status.pywires the diagnostic into both_show_direct_status(pre-flight + empty-archive branches) and_show_direct_json(replaces the ad-hoc next_action; surfaces astructured
diagnosticblock).polylogue/cli/commands/tutorial.pyadds a five-stage interactivewalkthrough — detect sources, write config, start daemon, first
search, open reader. Each stage probes its own preconditions so
reruns pick up where the previous run stopped.
--non-interactiveskips prompts for tests and previews.
Verification
nix develop -c pytest tests/unit/cli/test_status_diagnostics.py tests/unit/cli/test_tutorial.py tests/unit/cli/test_status.py -q→ 31 passed.
nix develop -c devtools verify --quick→ exit 0.Closes #1263.
Ref #869.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Summary by CodeRabbit
tutorialcommand providing step-by-step guidance through initial setupstatuscommand with improved diagnostics including detection of database schema issues, stale daemon configuration, and missing optional dependencies with actionable next steps