Repository navigation
feat(insights): materialize logical session identity - #1540
Conversation
Problem: physical conversations currently overcount continuation, fork, sidechain, and subagent chains in session insights. #866 already has topology edges, but rollups and read-pull consumers still lacked a persisted logical-session root. What changed: add schema v13 with session_profiles.logical_conversation_id, compute it in rebuild and refresh paths, and carry logical_session_count plus logical_conversation_ids_json through day and tag aggregates. Add a compact LogicalSession API/MCP envelope while keeping get_session_topology as the full graph surface. Verification: ruff format --check polylogue tests && ruff check polylogue tests; python -m mypy polylogue tests/unit/api/test_topology_api.py tests/unit/mcp/test_logical_session_tool.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_insight_shape_tools.py tests/unit/insights/test_productivity.py tests/unit/insights/test_rigor_audit.py tests/unit/storage/test_session_insight_refresh.py; pytest tests/unit/api/test_topology_api.py tests/unit/mcp/test_logical_session_tool.py tests/unit/mcp/test_tool_contracts.py::TestInsightTools::test_session_profile_tool_uses_archive_insight_contract tests/unit/mcp/test_tool_contracts.py::TestInsightTools::test_insight_list_tools_use_archive_queries tests/unit/mcp/test_tool_contracts.py::TestMutationTools::test_session_tree_returns_envelope tests/unit/mcp/test_envelope_contracts.py tests/unit/storage/test_session_insight_refresh.py tests/unit/storage/test_dead_schema_sweep.py tests/unit/insights/test_productivity.py tests/unit/insights/test_rigor_audit.py tests/unit/mcp/test_insight_shape_tools.py -q; devtools render-all --check; devtools verify --quick. Ref #866
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 36 minutes and 38 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, 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 trial, open-source, and free plans. In all cases, review capacity refills continuously over time. 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 (36)
✨ 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: 3855ea23c0
ℹ️ 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
Materializes logical session identity for continuation/fork/subagent lineages and exposes a compact read-pull API/MCP envelope for agents.
Problem
#866 already has durable topology edges and graph reads, but session profiles and rollups still counted physical conversations only. Continuations, forks, sidechains, and subagents could inflate daily/tag/workspace views even though they belong to one logical work session. Read-pull consumers also had to use the full topology graph when they only needed the root/thread/sibling navigation envelope.
Solution
session_profiles.logical_conversation_id.conversation_count, then addlogical_session_countandlogical_conversation_ids_jsonto day summaries and tag rollups.LogicalSession, Python APIget_logical_session(), and MCPget_logical_sessionwith a compact typed payload.docs/architecture.mdanddocs/internals.md.Verification
ruff format --check polylogue tests && ruff check polylogue tests-> cleanpython -m mypy polylogue tests/unit/mcp/test_logical_session_tool.py tests/unit/mcp/test_tool_contracts.py tests/unit/api/test_topology_api.py tests/unit/storage/test_session_insight_refresh.py-> clean across 857 filespytest tests/unit/api/test_topology_api.py tests/unit/mcp/test_logical_session_tool.py tests/unit/mcp/test_tool_contracts.py::TestInsightTools::test_session_profile_tool_uses_archive_insight_contract tests/unit/mcp/test_tool_contracts.py::TestInsightTools::test_insight_list_tools_use_archive_queries tests/unit/mcp/test_tool_contracts.py::TestMutationTools::test_session_tree_returns_envelope tests/unit/mcp/test_envelope_contracts.py tests/unit/storage/test_session_insight_refresh.py tests/unit/storage/test_dead_schema_sweep.py tests/unit/insights/test_productivity.py tests/unit/insights/test_rigor_audit.py tests/unit/mcp/test_insight_shape_tools.py -q-> 113 passeddevtools render-all --check-> OKdevtools verify --quick-> PASS in 33.51s locally and PASS in 32.64s from pre-pushRef #866