Repository navigation
feat(reader): persist reader workspaces - #1056
Conversation
Problem: MK3 workspaces had durable design scope but no runtime substrate, so stack/compare/tab state could not survive reloads or flow through CLI/MCP/daemon surfaces.\n\nWhat changed: add schema v14 reader_workspaces with an explicit v13 upgrade path; wire storage, repository, API, daemon /api/user/workspaces, CLI user-state workspaces, and MCP mutation tools. Workspace targets are normalized through the existing target-resolution path so missing or unsupported targets are preserved as degraded evidence instead of being silently dropped.\n\nVerification:\n- pytest -q -n0 tests/unit/storage/test_schema_upgrades.py tests/unit/storage/test_user_state_contracts.py tests/unit/cli/test_user_state_command.py tests/unit/daemon/test_web_reader.py::TestReaderUserState tests/unit/mcp/test_user_state_tools.py tests/unit/mcp/test_envelope_contracts.py -> 62 passed\n- ruff format --check <touched files> -> 18 files already formatted\n- ruff check <touched files> -> All checks passed\n- python -m mypy <touched polylogue files> -> Success: no issues found in 12 source files\n- devtools render-all --check -> OK
Problem: durable reader workspaces needed route-level stack and compare data, but the daemon only exposed single-conversation reader envelopes.\n\nWhat changed: serve /w/{stack,compare} shell routes and add /api/stack plus /api/compare envelopes that preserve resolved and missing conversation targets. Compare responses include paired/unpaired message rows and align validation for prompt/time/fork_point/search.\n\nVerification:\n- pytest -q -n0 tests/unit/daemon/test_web_reader.py::TestReaderWorkspaceRoutes tests/unit/daemon/test_web_reader.py::TestReaderUserState -> 12 passed\n- ruff format --check polylogue/daemon/http.py tests/unit/daemon/test_web_reader.py && ruff check polylogue/daemon/http.py tests/unit/daemon/test_web_reader.py -> All checks passed\n- python -m mypy polylogue/daemon/http.py -> Success: no issues found in 1 source file\n- devtools render-all --check -> OK
Problem: adding stack/compare route handling pushed the daemon HTTP module over the file-size budget, making future reader route work harder to review.\n\nWhat changed: move stack/compare payload builders and dispatch glue into polylogue.daemon.workspace_routes, keep http.py as transport dispatch, refresh topology status, and update the schema bootstrap budget exception from v13 to v14 to match the new reviewed migration branch.\n\nVerification:\n- pytest -q -n0 tests/unit/daemon/test_web_reader.py::TestReaderWorkspaceRoutes tests/unit/daemon/test_web_reader.py::TestReaderUserState -> 12 passed\n- ruff format --check polylogue/daemon/http.py polylogue/daemon/workspace_routes.py tests/unit/daemon/test_web_reader.py && ruff check polylogue/daemon/http.py polylogue/daemon/workspace_routes.py tests/unit/daemon/test_web_reader.py -> All checks passed\n- python -m mypy polylogue/daemon/http.py polylogue/daemon/workspace_routes.py -> Success: no issues found in 2 source files\n- devtools verify-file-budgets -> clean\n- devtools render-all --check -> OK
Problem: topology verification treats new source files as orphans until the topology projection records ownership.\n\nWhat changed: regenerate docs/plans/topology-target.yaml so polylogue/daemon/workspace_routes.py is declared as a stable daemon surface module.\n\nVerification:\n- devtools build-topology-projection -> wrote 728 rows\n- devtools render-topology-status -> completed
Problem: adding workspace MCP tools intentionally changed the admin tool catalog, so the committed wire-schema witness drifted.\n\nWhat changed: regenerate tests/data/witnesses/mcp-tool-schemas.json and carry the generated topology-status refresh from the new daemon workspace route module.\n\nVerification:\n- pytest -q -n0 tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_user_state_tools.py tests/unit/mcp/test_envelope_contracts.py -> 42 passed
|
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 (26)
📝 WalkthroughWalkthroughThis PR introduces durable reader workspaces—a feature enabling users to save, retrieve, and manage multi-conversation reader layouts with explicit handling of resolved/degraded conversation targets across tabs, stack, compare, and timeline modes. The changes span schema v13→v14, SQLite persistence, HTTP/CLI/MCP APIs, and comprehensive tests. ChangesDurable Reader Workspaces Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Poem
✨ 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 |
Problem: the compare route accepted time/fork_point/search align values while still using positional prompt pairing, which made unsupported modes look successful.\n\nWhat changed: restrict accepted compare alignment to prompt for this route slice and add a regression asserting unimplemented align modes are rejected until real semantics exist.\n\nVerification:\n- pytest -q -n0 tests/unit/daemon/test_web_reader.py::TestReaderWorkspaceRoutes -> 6 passed\n- ruff format --check polylogue/daemon/workspace_routes.py tests/unit/daemon/test_web_reader.py && ruff check polylogue/daemon/workspace_routes.py tests/unit/daemon/test_web_reader.py -> All checks passed\n- python -m mypy polylogue/daemon/workspace_routes.py -> Success: no issues found in 1 source file
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 249e8e59f7
ℹ️ 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".
|
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 durable reader workspaces and the first stack/compare reader route surface. Workspaces now persist resolved/degraded target evidence through SQLite, repository, API, daemon HTTP, CLI, and MCP surfaces; the local reader daemon also exposes stack/compare data envelopes for multi-conversation workflows.
Ref #867
Ref #993
Problem
MK3 workspace scope was represented in plans and design docs, but the runtime had no durable workspace table or public surface for saving tabs/stack/compare/timeline state. The reader also only had single-conversation data routes, so a workspace could not restore multi-conversation state after reload or expose degraded/missing target evidence.
Solution
reader_workspacesplus explicit v13->v14 upgrade coverage.Polylogue, daemon/api/user/workspaces,polylogue user-state workspaces, and MCP mutation tools./w/stackand/w/compareshell routes plus/api/stackand/api/compareenvelopes.align=prompt;time,fork_point, andsearchare rejected until implemented with real semantics.polylogue.daemon.workspace_routesto keep the daemon HTTP module under file-size budget.Verification
pytest -q -n0 tests/unit/storage/test_schema_upgrades.py tests/unit/storage/test_user_state_contracts.py tests/unit/cli/test_user_state_command.py tests/unit/daemon/test_web_reader.py::TestReaderUserState tests/unit/mcp/test_user_state_tools.py tests/unit/mcp/test_envelope_contracts.py-> 62 passedpytest -q -n0 tests/unit/daemon/test_web_reader.py::TestReaderWorkspaceRoutes-> 6 passedpytest -q -n0 tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_user_state_tools.py tests/unit/mcp/test_envelope_contracts.py-> 42 passeddevtools verify --quick-> pass, 27.24s onb4aac17bdevtools verify-> pass before final align-mode correction, 6422 pytest cases counted, 133.36s on249e8e59; final correction was then covered by focused daemon tests and quick gate.Summary by CodeRabbit
New Features
user-state workspacesCLI commands to list, save, and delete reader workspace configurations./w/stack,/w/compare,/api/stack,/api/compare) for multi-conversation reader workflows.Database