Repository navigation
feat(web): execute context preamble read view (#1846) - #2162
Conversation
Problem: the daemon web reader exposed the context read profile as pending even though the CLI/MCP side already had a context preamble contract. That left the workbench unable to use an existing archive read surface and encouraged separate browser-only payload shapes. What changed: route /api/sessions/:id/read?view=context through a shared ContextPreamble DTO builder, expose a Polylogue.context_preamble_payload facade method, reuse the same builder from MCP context preamble composition, and render the context view in the daemon web shell. The DTO now carries typed assertion guidance so injected assertion claims remain structured across surfaces. Verification: devtools test tests/unit/cli/test_context_view.py tests/unit/mcp/test_compose_context_preamble.py tests/unit/daemon/test_web_reader.py::TestReaderViewProfiles tests/visual/test_reader_dom_smoke.py::test_reader_evidence_panel_endpoint_and_shell_smoke tests/unit/cli/test_status.py::test_archive_facade_route_catalog_covers_public_async_facade tests/unit/api/test_facade_contracts.py::test_no_undiscovered_async_methods; devtools verify --quick.
|
Warning Review limit reached
More reviews will be available in 6 minutes and 23 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ 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: fdfb510706
ℹ️ 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 session_id: | ||
| try: | ||
| claims = await polylogue.list_assertion_claim_payloads( # type: ignore[attr-defined] | ||
| target_ref=f"session:{session_id}", |
There was a problem hiding this comment.
Resolve session IDs before loading guidance
When the new context read/API path is called with a short ID or other token that get_session() resolves, the payload succeeds but this assertion query still uses the unresolved token. Assertion claims are filtered by exact target_ref = ?, so claims stored under the canonical session:<full id> are omitted from guidance, leaving injected context incomplete for prefix-based reads; use the resolved conv.id after get_session() for the assertion target.
Useful? React with 👍 / 👎.
Summary
Adds executable
contextread support to the daemon workbench by routing/api/sessions/:id/read?view=contextthrough the same typedContextPreamblecontract used by CLI/MCP/API surfaces. The web shell now enables and renders the context preamble profile instead of treating it as a pending browser-only placeholder.Problem
#1846 tracks the workbench as a browser cockpit over existing archive contracts. After #2160,
context-packwas route-backed, butcontextremained disabled in the reader even though the context preamble already existed as a real CLI/MCP-facing payload. That left the workbench fragmented: browser code could show profile metadata but not execute one of the concrete read profiles without inventing a separate shape.Solution
build_context_preamble_payload(...)inpolylogue/context/preamble.pyas the shared async builder for context preamble DTOs.Polylogue.context_preamble_payload(...)and registered it in the facade route catalog.read?view=context&format=jsonthrough the shared builder and rendered it inweb_shell.py.compose_context_preamblewhile preserving seedless SessionStart behavior.ContextPreamblewith typed assertion guidance so injectable assertion claims remain structured across API, daemon, MCP, and shell surfaces.Closes part of #1846. The issue remains open for the broader operator-flow polish, remaining read profiles (
neighbors,correlation), overlay UX, and visual end-to-end flow completion.Verification
devtools test tests/unit/cli/test_context_view.py tests/unit/mcp/test_compose_context_preamble.py tests/unit/daemon/test_web_reader.py::TestReaderViewProfiles tests/visual/test_reader_dom_smoke.py::test_reader_evidence_panel_endpoint_and_shell_smoke tests/unit/cli/test_status.py::test_archive_facade_route_catalog_covers_public_async_facade tests/unit/api/test_facade_contracts.py::test_no_undiscovered_async_methodsdevtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshot --snapshot-updatedevtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshotdevtools verify --quickdevtools verify --seed-testmon --skip-slow(11505 passed, 1 xfailed; peak pytest RSS 3449.3 MiB)devtools verify(7 affected tests passed)