Repository navigation
Conversation
Add a Lineage inspector tab to the web reader and the supporting
GET /api/conversations/{id}/topology endpoint backed by the
SessionTopology read model from #866. Closes #1121.
Problem
-------
The reader had no way to see a conversation's place in the lineage
graph — parents, sub-agent branches, sidechains, or resumed sessions
— even though #866 materialized the durable lineage graph as
SessionTopology.
Solution
--------
- New daemon route GET /api/conversations/{id}/topology returns a
bounded SessionTopology envelope (default 200 nodes, hard cap 1000)
with explicit readiness chip (ok/partial/empty), unresolved-edge
count, and truncation count. Envelope shape lives in
polylogue/daemon/topology_http.py so http.py stays within its file
budget.
- Reader inspector gains a Lineage tab rendering the rooted tree as
an indented BFS list with edge-kind chips
(continuation/sidechain/fork/subagent/unresolved_native), explicit
empty / partial / cycle states using the MK3 chip vocabulary, an
Open-parent and Compare-with-parent affordance, and unresolved
native parent IDs surfaced in their own section.
- Lineage CSS+JS extracted to polylogue/daemon/web_shell_lineage.py
matching the BULK_/WORKSPACE_ split so web_shell.py stays within
its file budget.
Verification
------------
- nix develop -c pytest tests/unit/daemon/ — 438 passed (includes the
new tests/unit/daemon/test_topology_endpoint.py, 7 tests)
- nix develop -c devtools verify --quick — exit_code 0 (format, lint,
mypy, render-all --check, manifest gates green)
- nix develop -c devtools verify-file-budgets — both touched files
inside declared per-file LOC ceilings
- Pre-existing failures unrelated to this PR (productivity-rollup,
message_embeddings KeyError, mcp tool-schema witness drift, etc.)
remain on master; tracked separately.
|
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 (7)
✨ 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: 6556911e87
ℹ️ 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
Add a Lineage inspector tab to the web reader plus a new
`GET /api/conversations/{id}/topology` endpoint backed by the
`SessionTopology` read model from #866. Closes #1121. Re-dispatch of
the prior PR #1174 against a fresh `origin/master`.
## Problem
The reader had no way to see a conversation's place in the lineage
graph — parents, sub-agent branches, sidechains, or resumed sessions —
even though #866 (PR #1097) materialized the durable lineage graph as
`SessionTopology` with cycle-safe derivation. #1121 calls for a
read-only lineage view that consumes the existing public read surface
and renders explicit empty / partial / no-lineage states.
## Solution
- **HTTP endpoint** (`polylogue/daemon/http.py`,
`polylogue/daemon/topology_http.py`):
`GET /api/conversations/{id}/topology` returns a bounded
`SessionTopology` envelope:
- `?limit=` (default 200, hard cap 1000) so the reader never streams
an unbounded subtree — #1121 AC: lineage rendering is bounded.
- Edges referencing dropped nodes are filtered so the UI never
plots a dangling endpoint; `truncated_count` signals the gap.
- Explicit `readiness` chip (`ok` / `partial` / `empty`),
`unresolved_edge_count` for provider-native parents that did not
resolve, and `cycle_detected` for cycle-quarantine flagging.
- Envelope shape lives in `daemon/topology_http.py` so `http.py`
stays close to its per-file budget; budget bumped to 1380.
- 404 with shared error envelope for unknown id; 400 `invalid_limit`
for out-of-range `?limit=`.
- **Reader UI** (`polylogue/daemon/web_shell.py`,
`polylogue/daemon/web_shell_lineage.py`): new `Lineage` inspector
tab rendering the rooted tree as an indented BFS list with edge-kind
chips (`continuation` / `sidechain` / `fork` / `subagent` /
`unresolved_native`), the focused conversation highlighted, an
`Open parent` button, and a `Compare with parent` affordance that
delegates to the existing compare workspace route from #1124.
Unresolved native parent IDs surface in a dedicated section.
Empty / partial / cycle states use the MK3 chip vocabulary
(`q-canonical` / `q-partial` / `q-unavailable` / `q-unresolved`).
Lineage CSS+JS extracted to a sibling module matching the
`BULK_`/`WORKSPACE_`/`PROVENANCE_` split.
- **Tests** (`tests/unit/daemon/test_topology_endpoint.py`): 24 tests
in three groups:
- pure helpers — `coerce_node_limit` bounds + `build_topology_envelope`
readiness vocabulary, edge filter, truncation, hard-cap clamp;
- end-to-end dispatch over a seeded archive (root → child →
grandchild, sidechain sibling, isolated leaf, missing id) asserting
BFS-from-descendant anchors at root, empty readiness for the
isolated leaf, `?limit=` payload clamping, and the hard-cap reject;
- reader-shell structural smoke pinning the new `data-tab="lineage"`
button, `loadLineage`/`renderInspectorLineage`/`openCompareWithParent`/
`lineageReadinessChip` JS hooks, the MK3 chip vocabulary, and that
no `__LINEAGE_JS__` / `__PROVENANCE_JS__` template placeholders
leaked into the shipped HTML.
Rejected alternatives:
- Returning the unbounded raw `SessionTopology.model_dump()` — would
fail the #1121 AC that lineage rendering be bounded.
- Adding a lineage rail to the conversation header — kept the
inspector-tab placement because it lets the lineage tree share space
with raw and notes without crowding the header chip row that
#956/#1078 already pinned.
- Mutating lineage in the UI — #1121 explicitly scopes this read-only.
## Verification
```
nix develop -c pytest tests/unit/daemon/test_topology_endpoint.py -q
→ 24 passed in 9.33s
nix develop -c pytest tests/unit/daemon -q
→ 503 passed in 14.92s
nix develop -c pytest tests/unit/daemon tests/unit/storage/test_session_topology.py \
tests/unit/architecture/test_topology_invariants.py -q
→ 517 passed in 12.24s
nix develop -c devtools verify --quick
→ exit_code 0 (format, lint, mypy --strict, render-all --check,
verify-topology, verify-file-budgets, verify-test-ownership,
verify-cluster-cohesion, manifest gates, verification-impact all green)
git push (pre-push hook runs verify --quick)
→ exit_code 0
```
## Acceptance criteria (#1121)
- [x] Reader displays a lineage rail for any conversation with
materialized lineage rows — `Lineage` inspector tab consumes the
topology endpoint.
- [x] Parent chain is navigable; sub-agent branches are listed —
rooted tree with edge-kind chips; clickable nodes call
`selectConversation`; sibling branches render under their shared
parent.
- [x] No-lineage and partial-lineage states are rendered explicitly
with a readiness chip — `readiness` ∈ `ok` / `partial` / `empty`
drives the MK3 chip vocabulary.
- [x] Reader does not query lineage tables directly — only the public
lineage read surface from #866 — endpoint calls
`poly.repository.get_session_topology`; UI calls the endpoint.
- [x] Tests assert lineage rendering is bounded (does not unbound
expand the whole graph in one payload) —
`test_node_limit_is_bounded_and_signals_truncation`,
`test_node_limit_hard_cap_enforced`,
`test_node_limit_hard_cap_rejects_unbounded_request`,
`test_node_limit_clamps_payload_size`.
- [ ] Visual smoke harness (#865) covers a multi-level tree, a leaf
conversation, and a no-lineage state — deferred to #865's
Playwright-based screenshot lane; the structural smoke in
`test_topology_endpoint.py::TestLineageReaderShell` covers the same
three states at the HTML/JSON contract level.
Ref #866, #859, #1118.
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
|
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. |
|
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
Add a Lineage inspector tab to the web reader plus a new
GET /api/conversations/{id}/topologyendpoint backed by theSessionTopologyread model from #866. Closes #1121.Problem
The reader had no way to see a conversation's place in the lineage
graph — parents, sub-agent branches, sidechains, or resumed sessions
— even though #866 (PR #1097) materialized the durable lineage graph
as
SessionTopologywith cycle-safe derivation. #1121 calls for aread-only lineage view in the reader that consumes the existing
public read surface and renders explicit empty / partial / no-lineage
states.
Solution
HTTP endpoint (
polylogue/daemon/http.py,polylogue/daemon/topology_http.py):GET /api/conversations/{id}/topologyreturns a bounded
SessionTopologyenvelope:?limit=parameter (default 200, hard cap 1000) so the readernever streams an unbounded subtree — feat(reader): lineage and topology view in web UI #1121 AC: lineage rendering
is bounded.
plots a dangling endpoint; the
truncated_countfield is theoperator's signal that the graph is incomplete.
readinesschip (ok/partial/empty),unresolved_edge_countfor provider-native parent IDs that didnot resolve, and
cycle_detectedfor cycle-quarantine flagging.daemon/topology_http.pysohttp.pystays within its declared per-file LOC budget.
missing — does not return an empty topology.
Reader UI (
polylogue/daemon/web_shell.py,polylogue/daemon/web_shell_lineage.py): newLineageinspectortab rendering the rooted tree as an indented BFS list with
edge-kind chips
(
continuation/sidechain/fork/subagent/unresolved_native),the focused conversation highlighted, an "Open parent" button, and
a "Compare with parent" affordance that delegates to the existing
compareworkspace route from feat(reader): saved queries and named views in web UI #1118. Unresolved native parent IDssurface in a dedicated section. Empty / partial / cycle states use
the MK3 chip vocabulary (
q-canonical/q-partial/q-unavailable/q-unresolved). Lineage CSS+JS extracted to asibling module matching the
BULK_/WORKSPACE_split soweb_shell.pystays within its file budget.Tests (
tests/unit/daemon/test_topology_endpoint.py): in-processHTTP harness exercises the new endpoint against a seeded archive
containing a multi-level resolved tree (root → child → grandchild),
a
sidechainsibling, an isolated leaf, and a missing id. Pins:envelope shape, BFS traversal from a descendant up to the root and
back down through sibling branches, explicit empty/
readinessstate, 404 envelope, the
?limit=bound and its hard cap, and theshipped HTML carries the
data-tab="lineage",loadLineage,renderInspectorLineage,openCompareWithhooks plus thereadiness vocabulary.
Rejected alternatives:
SessionTopologymodel dump — wouldfail the feat(reader): lineage and topology view in web UI #1121 AC that lineage rendering be bounded.
inspector-tab placement because it lets the lineage tree share
space with raw and notes without crowding the header chip row that
feat(webui): aesthetics, layout, informability — surface what matters #956/refactor(proof): extract _build_subjects helper to compress discovery boilerplate #1078 already pinned.
read-only view.
Verification
devtools verify --allsurfaces 15 pre-existing failures unrelatedto this PR (productivity-rollup catalog drift, message_embeddings
KeyError in
cli/check, mcp tool-schema witness drift aroundcost_outlook/cost_rollups, hypothesis time budget intest_attachment_security). All are inherited from recently-mergedcommits visible on
masterand touch unrelated subsystems; nonereference the daemon or topology surfaces.
Acceptance criteria (#1121)
materialized lineage rows —
Lineageinspector tab consumes thetopology endpoint.
rooted tree with edge-kind chips; clickable nodes call
selectConversation; sibling branches render under their sharedparent.
with a readiness chip —
readiness∈ok/partial/emptydrives the MK3 chip vocabulary.
lineage read surface from feat(topology): materialize session identity and lineage graph #866 — endpoint calls
poly.repository.get_session_topology; UI calls the endpoint.expand the whole graph in one payload) —
test_node_limit_is_bounded_and_signals_truncationandtest_node_limit_hard_cap_rejects_unbounded_request.conversation, and a no-lineage state — deferred to test(reader): add local web reader visual smoke harness #865's
Playwright-based screenshot lane; the structural smoke in
test_topology_endpoint.py::TestLineageReaderShellcovers the samethree states at the HTML/JSON contract level.
Ref #866, #859, #1118.