Repository navigation
feat(insights): productivity rollups with explicit caveats (#1134) - #1167
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 (18)
✨ 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 |
Add ProductivityRollupInsight envelope computed live over already- materialized session_profile and session_work_event substrates. Granularity is day / week / project; aggregates are objective counts and distributions (hour-of-day histogram, project focus share, context switch count, work-event outcome breakdown). Every envelope ships a baseline disclaimer naming the structural limits of any rollup over archived AI conversations, and every entry carries typed caveats plus opaque evidence_inputs that link back to the source rows. Wired through the registry so CLI (`polylogue insights productivity`), MCP (`productivity_rollups`), and the async/sync Python APIs surface the same envelope, consistent with the day/week summary precedent. No new command island. Closes #1134 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
e1a7685 to
36a2a9e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1a76852ac
ℹ️ 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
Add
ProductivityRollupInsightenvelope computed live over already-materializedsession_profileandsession_work_eventsubstrates. Productivity-style aggregates — hour-of-day histogram, project focus share, context-switch count, and work-event outcome breakdown — at day / week / project granularity. Every envelope ships a baseline disclaimer naming the structural limits of any rollup over archived AI conversations; every entry carries typed caveats plus opaqueevidence_inputslinking back to the source rows.Problem
#1134(parent#994, W16 of#827) asks for productivity rollups derived from the existing session insights, but with explicit caveats so the read surface never claims more than the evidence supports. The substrate (session_profiles,session_work_events) already carries the necessary signal; the missing pieces are a typed envelope that (a) refuses subjective composite scores, (b) makes caveats a first-class field readers cannot accidentally drop, and (c) gives readersevidence_inputsthey can drill into.Solution
New module
polylogue/insights/productivity.py:ProductivityRollupInsightenvelope withentries,baseline_caveats, total counters, andprovenance— single envelope returned per call, consistent with the day/week summary precedent.ProductivityRollupEntrycarriesbucket_key, objective metrics (session/work-event counts, hour-of-day histogram, project focus share, context-switch count, outcome breakdown),evidence_inputs, and per-entrycaveats.BASELINE_CAVEATSconstant — five typed strings naming the structural limits (off-screen work not represented, untimed sessions excluded from histograms,cwd_pathsprovenance, context-switch ceiling semantics, work-event classifier support level). Surfaced on every envelope; tests pin its presence.build_productivity_rollup_insight— pure aggregator, ownership-free of the fetch, exercised identically from tests, operations, CLI, and MCP.< 3sessions/bucket), high untimed share (≥ 25%), high unattributed share (≥ 25%), and missing work events each emit specific caveats; baseline caveats are never dropped.Wiring:
polylogue/operations/archive.py:list_productivity_rollup_insightsreads profile and work-event insights via a typed cross-mixin Protocol (_SessionInsightReaders) and delegates aggregation to the pure builder. Module-level convenience function added.polylogue/insights/registry.py: registered withcli_command_name="productivity",readiness_exempt=True,mcp_default_limit=200, and CLI options for granularity / provider / since / until — registry dispatch automatically materializes the CLI subcommand and the MCPproductivity_rollupstool.polylogue/api/insights.pyandpolylogue/api/sync/insights.py: async and sync facade methods.polylogue/operations/specs.py+polylogue/artifacts/runtime.py:query-productivity-rollupsoperation andproductivity_rollup_resultsartifact node + path.polylogue/scenarios/execution.py: scenario-name mapping for the new operation.Tests in
tests/unit/insights/test_productivity.py(22 cases) cover:n-1distinct paths).work_event.kindandevidence_inputslinkage.tests/unit/mcp/test_envelope_contracts.pyextended to classify the new MCP tool as an{items, total}envelope;tests/data/witnesses/mcp-tool-schemas.jsonregenerated to include the new tool's wire schema.docs/plans/file-size-budgets.yamlceiling foroperations/archive.pyraised from 1200 → 1300 to absorb the cross-mixin Protocol plus the new method; the corresponding split candidate already exists in the same row. Topology projection regenerated.Verification
Pre-existing
test_check.pyKeyError('message_embeddings')failures reproduce onorigin/master(confirmed by reset-and-rerun); they are inherited and out of scope for this PR.Closes #1134