Repository navigation
feat(reader): insights browser (#1120) - #1177
Conversation
|
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 (5)
✨ 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 |
Adds the per-conversation insights browser to the daemon web reader plus
the backing GET /api/insights/sessions/{id} endpoint. The panel surfaces
the four per-session insight kinds (session profile, work-event timeline,
session phases, work-thread membership) as a single typed envelope, with
collapsible per-kind sections and an explicit readiness chip on each.
Ref #1120
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
6167e23 to
4908c59
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6167e23fc5
ℹ️ 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".
| "readiness_tag": _readiness_tag(materialized=bool(events), row_count=len(events)), | ||
| "materialized": bool(events), |
There was a problem hiding this comment.
Mark empty insight rows as partial, not missing
This readiness mapping treats materialized as bool(events), so a conversation with a fully materialized insight surface but zero matching rows is reported as q-missing instead of q-partial. That misclassifies the state the endpoint is meant to convey (empty result vs unavailable substrate), and the same pattern is repeated for phases and threads, so the reader cannot reliably distinguish “no data for this session” from “insight kind not materialized.”
Useful? React with 👍 / 👎.
| try: | ||
| # Work threads are not keyed per-conversation in the substrate; | ||
| # the reader filters the materialized rows by membership. | ||
| all_threads = await poly.list_work_thread_insights(WorkThreadInsightQuery(limit=None)) |
There was a problem hiding this comment.
Avoid full archive thread scan per session request
The per-conversation insights handler fetches all work-thread insights with limit=None and then filters membership in Python. On archives with many threads, every GET /api/insights/sessions/{id} call does a full-table read and deserializes every thread payload just to return one conversation’s subset, which will noticeably slow the inspector and increase memory pressure as data grows.
Useful? React with 👍 / 👎.
Summary
Adds the per-conversation insights browser to the daemon web reader plus
the backing
GET /api/insights/sessions/{id}endpoint. The panelsurfaces the four per-session insight kinds (session profile,
work-event timeline, session phases, work-thread membership) as a
single typed envelope, with collapsible per-kind sections and an
explicit readiness chip on each.
Problem
Issue #1120 specifies an insights browser in the reader that exposes
the bounded session insight products (#1018) inline on the
conversation page, with a readiness/freshness chip per panel
(#1019), and reads only through the public insight surfaces — no
direct insight-table queries from the reader.
Until this PR the daemon web shell had no surface onto the per-session
insight substrate landed under #1018 / #1133 / #1135. Selecting a
conversation in the reader exposed Info / Cost / Raw / Notes tabs
only; the materialized profile, work events, phases, and work-thread
membership were reachable through MCP and the CLI but invisible to a
reader operator.
Solution
GET /api/insights/sessions/{id}[?include=profile,timeline, phases,threads]inpolylogue/daemon/http.py. Routes through thepublic facade adapters
(
Polylogue.repository.get_session_profile,list_session_work_event_insights,list_session_phase_insights,list_work_thread_insights) — the same path the CLI and MCP use, sothe reader does not import insight storage modules directly
(AC#1120). Includes the
?include=query parameter to restrict theenvelope to a subset of kinds; unknown tokens are dropped and the
canonical kind ordering is preserved.
_readiness_tag,_parse_insight_includes,_profile_panel_payload,_work_event_panel_payload,_phase_panel_payload,_thread_panel_payloadproject the typedinsight records into a stable JSON shape. The readiness chip
vocabulary is closed (
q-ready/q-partial/q-missing) and isexercised by unit tests.
Insightstab. The renderer lazy-loadsthe endpoint into
state.insightsPanels, shows one collapsiblesection per kind, surfaces the readiness chip in each section header
with a row count, and renders a per-kind empty body
(
No <kind> recorded.) when the substrate has no rows — the panelis never blank (AC#1120).
404 not_found. Existingconversations without materialized insights return
200withexplicit
q-missingshapes per kind (AC#1120). Each per-kind listcall is wrapped in a guard against
ArchiveInsightUnavailableErrorso an unmaterialized substratesurfaces as
q-missingrather than503the whole envelope.q-readyandq-missingpalette entries reusing the--ok/--text-dimtokens; adds
.insight-section-header/.insight-toggle/.mutedfor the section affordances.polylogue/daemon/http.py1340 -> 1600,polylogue/daemon/web_shell.py1280 -> 1460, both with asplit candidatenote pointing at the future per-domain handler /per-tab decomposition.
Verification
Unit contracts pin the readiness chip vocabulary mapping
(materialized/row_count -> q-ready/q-partial/q-missing), the
?include=parser (None/empty default, subset, unknown-token drop,canonical ordering), the four panel projector empty shapes, and the
dispatch path (404 for unknown, 200 + typed envelope for known,
?include=honored). Visual DOM smoke evidence (#865) pins theInsightsinspector tab and the readiness chip vocabulary(
q-ready/q-partial/q-missingplusWork events,Phases,Work threadssection labels) in the shell HTML, and exercises thelive endpoint against the seeded reader workspace including the
subset and unknown-conversation paths.
Acceptance criteria status (#1120)
inline on the conversation page via the new
Insightsinspector tab.
q-ready/q-partial/q-missingvocabulary; missing /stale state is explicit (the empty-state body says
"No recorded.").
only the public
Polylogue.list_session_*_insightsadaptersand
Polylogue.repository.get_session_profile.insight states (each kind defaults to
q-missing; the handlercatches
ArchiveInsightUnavailableErrorper kind).partial chip vocabulary in the shell and exercises both the
known and unknown conversation paths.
Deferred to follow-ups (not in scope for this slice):
insights panel is the focus of this PR; the day/week dedicated
routes are tracked separately as part of tracking: webui advanced functionality (resurrected from #955) #993.
stale) — wiringpolylogue.insights.provenance.is_staleinto the readiness chipper-kind requires source-high-water-mark plumbing that is out of
scope here; the readiness chip currently reports
q-ready/q-partial/q-missingbased on materialization presenceand row count.
Closes #1120
Co-authored-by: Claude Opus 4.7 (1M context) [email protected]