Repository navigation
feat(reader): add workspace shell modes - #1057
Conversation
Problem: the daemon exposed stack and compare workspace routes, but the web shell still rendered only the generic single-conversation reader. The recall-pack mutation surface also kept a pre-release conversation_ids compatibility input after typed target items existed. What changed: add stack/compare workspace shell assets, route parsing, workspace save/restore, and recall-pack creation controls. Remove the recall-pack conversation_ids write path from daemon, CLI, MCP, and facade APIs, regenerate the MCP schema witness, and remove the daemon HTTP _is_localhost test alias in favor of the shared loopback helper. Verification: devtools verify --quick; devtools render-all --check; pytest -q --tb=short --ignore=tests/integration -n 4; focused daemon, visual, CLI, MCP, and storage reader/user-state tests.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (20)
✨ Finishing Touches🧪 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: 782eadd8d1
ℹ️ 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".
## Summary Wire the existing `/api/user/saved-views` substrate (shipped via #1050-#1057 under the #867 user-state umbrella) into the web reader so an operator can save the current filter chain under a name, recall it, and delete it without leaving the reader. Adds a toolbar entry-point, a Delete affordance, a naming-conflict guard, and an actionable empty state. ## Problem #1118 calls out the reader UI gap for saved views: the storage table and the HTTP envelope existed, and the Notes inspector tab could already save/open a view, but there was no way to delete an existing view from the UI, no naming-conflict UX (the SQLite `UNIQUE(name)` constraint would surface as an opaque error), and no toolbar-level entry-point — saved views were reachable only by opening the Notes inspector tab on a selected conversation. The acceptance criteria require list/recall/delete affordances, an empty state distinct from a populated one, and naming-conflict handling. ## Solution - `polylogue/daemon/web_shell_workspace.py`: adds a `Saved views` `<select>` and a `Save view` button to the workspace toolbar (mirroring the existing `Restore workspace` select pattern). Populates the select in `renderWorkspaceToolbar` with `state.savedViews`, disables it when empty, and falls back through `applySavedView` → `loadConversations` + `loadFacets`. Moves `saveCurrentView` and adds `deleteSavedView` here. `saveCurrentView` now trims whitespace, rejects empty names, and detects a naming clash against `state.savedViews` locally — prompting `window.confirm` to overwrite (DELETE the existing view_id, then POST) or abort. `deleteSavedView` confirms by name before issuing the DELETE. - `polylogue/daemon/web_shell.py`: the Notes inspector list now renders a per-row Delete button next to Open; the empty state is reworded to name the next action (`Click "Save current view" to name the current filter chain.`). - `tests/unit/daemon/test_web_reader.py`: adds `TestReaderSavedViewsUI` with five tests — toolbar entry-point presence, naming-conflict UX strings, delete-button wiring, actionable empty-state copy, and an HTTP roundtrip (save → list → delete) that catches regressions in the new toolbar surface. The MCP coverage criterion (#1118 AC: "At least one MCP read tool exposes saved views by id") was already satisfied by `list_saved_views` / `save_saved_view` / `delete_saved_view` in `polylogue/mcp/server_mutation_tools.py` — no change there. The naming-conflict handling is client-side rather than at the HTTP envelope. The shared `user_state_http.py` is owned by another lane per the dispatch plan and the existing `save_view` SQL is an `INSERT OR REPLACE BY view_id`; the UNIQUE constraint is on `name`, which means a different `view_id` for the same name would 500. Detecting the conflict client-side keeps the UX coherent without changing the contract. `polylogue/daemon/web_shell.py` net change is −13 LOC (functions moved into the workspace asset module), keeping the file under the 1100-line budget enforced by `verify-file-budgets`. ## Verification ``` nix develop -c pytest tests/unit/daemon/test_web_reader.py -q # 62 passed in 14.74s (5 new under TestReaderSavedViewsUI) nix develop -c pytest tests/unit/daemon -q # 389 passed in 13.45s nix develop -c devtools verify --quick # exit_code: 0 (format + lint + mypy + render-all + manifest/lifecycle/topology lints) ``` `devtools verify` (full pytest path) requires `devtools verify --seed-testmon` on this fresh worktree; the affected unit suite was exercised directly above. `render-pages` was re-emitted to clear a pre-existing `.cache/site` drift unrelated to this PR. Closes #1118 Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…ts (#1203) (#1343) ## Summary Bridges the lineage topology view (#1121) into the workspace stack route and adds per-message "continue this thread in another agent" deep-link shortcuts. Implements the #1203 work that was outstanding from MK3 Slice 6 (`docs/design/mk3/docs/10-implementation-slices.md:104`). ## Problem MK3 Slice 6 called for the bridge between topology and the stack workspace — "select this branch chip, open its parent chain as a stack workspace". #1121 / PR #1176 landed the lineage and topology view; #1057 added the workspace shell modes (tabs / stack / compare / timeline). The stack lane previously accepted manually-entered conversation ids only — there was no UI affordance for "render the root → sub-agent → continuation chain as a stack", and the conversation header carried no branch chip telling the operator that a conversation belonged to a multi-branch cluster. Separately, the reader had no path back to the originating agent: an operator who wanted to keep working a thread in Claude Code or Codex had to copy the message text by hand. That is exactly the friction the MK3 design called out as the "thread-resumption hub" idea (also tracked in the #1203 ambitious section). ## Solution **Substrate / daemon** - `polylogue/daemon/topology_http.py` grows `build_parent_chain_envelope()` which projects a `SessionTopology` into a stack-ready chain (root → target → descendants) with `branch_kind`, `parent_id`, `siblings`, and `focus_id` surfaced. Uses the existing `SessionTopology.ancestors() / descendants() / siblings()` helpers so the lineage walk stays in `insights/`. - `GET /api/conversations/{id}/topology/parent-chain` returns the envelope. `?descendants=0` narrows to the ancestor chain only. - `polylogue/daemon/thread_continue.py` owns the per-agent URL-template registry (built-ins: `claude-code`, `codex`, `copy-prompt` clipboard fallback) and the URL constructor. Overrides flow through `POLYLOGUE_READER_AGENT_TEMPLATES`; invalid JSON falls back to the built-ins so the reader never crashes on a malformed env var. Templates are substituted client-side so the daemon never observes the message text the operator is "continuing" elsewhere. - `GET /api/thread-continue-templates` returns the active registry envelope. **Reader surface** - Conversation header (`web_shell.py`) renders a topology branch chip (continuation / sidechain / fork / subagent / root) using the MK3 q-* chip vocabulary, plus an "open chain" button next to it. The chip click routes to the Lineage inspector tab as the popover surface. - Lineage inspector tab (`web_shell_lineage.py`) gains a third action, "Open chain as stack", so the same affordance is reachable from either the header or the inspector. - Workspace JS (`web_shell_workspace.py`) gains `openParentChainAsStack(id)` which fetches the parent-chain envelope and routes to `/w/stack?ids=…&focus=…`. - Per-message action rail (`web_shell_reader.py`) gains a `continue` button that opens a small popover menu of agent templates. The `copy-prompt` entry writes to `navigator.clipboard`; every other entry hands off to the OS URL handler. The template registry is fetched once per session and cached. **Alternatives rejected** - Computing the parent chain client-side from the existing `/topology` envelope. Rejected: that envelope is BFS-ordered and bounded by node count; the stack needs the explicit ancestor walk + focus anchor. A dedicated endpoint also keeps the topology→stack contract single-sourced for tests. - Persisting agent URL templates in `polylogue.toml` like the embedding keys. Rejected for this PR scope: an env-var override is sufficient for the operator workflow and avoids a config-schema migration. Can be promoted to TOML later without breaking the endpoint shape. ## Verification ``` $ devtools verify --quick "exit_code": 0 $ devtools verify --seed-testmon --skip-slow "passed": 8219, "xfailed": 2, "exit_code": 0 $ pytest tests/unit/daemon/ -q 622 passed $ pytest tests/unit/daemon/test_topology_stack.py tests/unit/daemon/test_thread_continue.py -q 53 passed ``` File-size budgets updated to reflect the +14 lines on `web_shell.py` (branch chip helpers, `openLineageInspector`) and +52 lines on `http.py` (two new handlers + dispatch). Topology projection re-rendered to include the new `daemon/thread_continue.py` module. Closes #1203
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds real reader workspace shell modes for
/w/stackand/w/compare, with workspace save/restore and recall-pack creation controls. It also removes the pre-release recall-packconversation_idswrite shim so daemon, CLI, MCP, and facade writes use typed target items as the single contract.Problem
The daemon already exposed stack/compare workspace routes and durable workspace storage, but the shell still hydrated only the generic single-conversation reader. The user-state surface also kept a compatibility input for recall packs after the typed target-item contract existed, which is the wrong shape for a pre-release project that prefers clean breaks over aliases.
Solution
/and/c/{id}as canonical routes after auditing route/tests/docs; they are not compatibility aliases./w/stackand/w/compareviapolylogue/daemon/web_shell_workspace.py.conversation_idsmutation inputs from daemon HTTP, CLI, MCP, andPolylogue.create_recall_pack; typedpayload.itemsis now required._is_localhosttest alias and pin the sharedis_loopback_hosthelper directly.Refs #865
Refs #867
Refs #993
Verification
devtools verify --quick-> passed at782eadd8devtools render-all --check-> passedpytest -q --tb=short --ignore=tests/integration -n 4->6422 passed, 2 xfailed, 2 xpassedpytest -q -n0 tests/unit/daemon/test_web_reader.py->51 passedpytest -q tests/visual/test_reader_dom_smoke.py->6 passedpytest -q tests/unit/cli/test_user_state_command.py tests/unit/mcp/test_user_state_tools.py tests/unit/storage/test_user_state_contracts.py->27 passedpytest -q tests/unit/daemon/test_daemon_http_security.py->115 passedOne plain
devtools verifyattempt reached pytest and was killed by earlyoom while a concurrent NixOS rebuild was also running. The full non-integration pytest set was rerun with-n 4to avoid the-n automemory spike and passed.