Skip to content

feat: explain work-thread membership - #393

Merged
Sinity merged 2 commits into
masterfrom
feature/feat/explain-work-thread-membership
Apr 24, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/feat/explain-work-thread-membership

Conversation

@Sinity

@Sinity Sinity commented Apr 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add deterministic membership evidence to durable work-thread products. Work-thread grouping remains conservative for this slice: explicit parent/continuation lineage is the only grouping authority, but each member now carries auditable evidence and each thread exposes support level/signals/confidence through CLI, facade, and MCP product payloads.

Problem

#313 asked for session-cluster/work-thread semantics. The codebase already had a durable work_threads product, but it exposed aggregates without explaining why a session belonged to a thread. That made the product hard to audit and weak as a substrate for future clustering signals.

Solution

  • extend the shared work-thread payload with per-member evidence, support level/signals, confidence, and provider breakdown
  • preserve conservative explicit lineage grouping for this issue
  • bump archive product contract version and session-product materializer version so stale rows rebuild with the expanded payload
  • include support/member signals in work-thread search text
  • cover substrate round-tripping plus CLI, facade, and MCP public product contracts

Verification

  • pytest -q tests/unit/core/test_threads_runtime.py tests/unit/cli/test_products.py::test_products_profiles_json tests/unit/cli/test_products.py::test_products_enrichments_json tests/unit/cli/test_products.py::test_products_threads_json tests/unit/core/test_facade_api.py::TestPolylogueArchiveProducts::test_durable_session_products_are_publicly_queryable tests/unit/mcp/test_tool_contracts.py::TestProductTools::test_product_list_tools_use_archive_queries passed: 8 passed in 12.09s
  • mypy --strict tests/unit/mcp/test_tool_contracts.py tests/unit/cli/test_products.py polylogue/archive_product_models.py polylogue/lib/threads.py passed: Success, no issues found
  • devtools render-all --check passed
  • devtools verify passed: verify: all checks passed
  • git push -u origin feature/feat/explain-work-thread-membership passed pre-push quick verification: verify: all checks passed

Closes #313

Summary by CodeRabbit

  • New Features

    • Work threads now include confidence scores, support levels, and support signals to indicate data quality and backing evidence.
    • Per-member evidence metadata (role, depth, conversation links) is captured and available for each thread contributor.
    • Provider breakdown information is included in thread payloads.
  • Tests

    • Added comprehensive tests for thread construction and evidence propagation.
    • Updated existing tests to validate new thread metadata structure.
  • Chores

    • Incremented contract versions for data schema updates.

Sinity and others added 2 commits April 23, 2026 23:32
Problem\n\nThe durable work-thread product grouped explicit continuation trees, but\nits public payload did not explain why individual sessions belonged to a\nthread. That made the product inspectable as an aggregate but weak as a\ncluster/work-thread substrate.\n\nWhat changed\n\nAdd typed per-member evidence for work-thread membership, deterministic\nthread support metadata, confidence, and support signals. Keep grouping\nconservative for this slice: explicit parent/continuation lineage remains\nthe only grouping authority. Bump the archive product contract and session\nproduct materializer version so stale rows are rebuilt with the expanded\npayload.\n\nCompatibility\n\nThe raw archive is unchanged. Existing product rows are treated as stale\nby the materializer-version bump and legacy payloads still validate with\ndefault weak support metadata.\n\nRef #313\nCo-Authored-By: Claude <[email protected]>
Problem

Work-thread membership evidence needs regression coverage across the
shared substrate and public product surfaces, not only the builder path.

What changed

Add core tests for explicit continuation evidence, obvious non-matches,
and payload round-tripping. Extend CLI, facade, and MCP product contract
tests to assert support metadata and member evidence appear in public
work-thread payloads.

Verification

 passes locally.

Ref #313
Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e694d216-1cc4-4ca4-900c-330686ed4596

📥 Commits

Reviewing files that changed from the base of the PR and between e714ef3 and a8bf035.

📒 Files selected for processing (9)
  • polylogue/archive_product_models.py
  • polylogue/lib/session_payload_documents.py
  • polylogue/lib/threads.py
  • polylogue/storage/session_product_threads.py
  • polylogue/storage/store_constants.py
  • tests/unit/cli/test_products.py
  • tests/unit/core/test_facade_api.py
  • tests/unit/core/test_threads_runtime.py
  • tests/unit/mcp/test_tool_contracts.py

📝 Walkthrough

Walkthrough

This PR extends work-thread payloads with per-member evidence metadata and deterministic thread-level support metrics. New payload types capture conversation IDs, roles, depths, support signals, and confidence per member. Contract and schema versions are incremented, and thread construction logic is enhanced to compute evidence from session profiles and continuation lineage.

Changes

Cohort / File(s) Summary
Data Model Definitions
polylogue/archive_product_models.py, polylogue/lib/session_payload_documents.py
Added WorkThreadMemberEvidencePayload / WorkThreadMemberEvidenceDocument types to capture per-member conversation ID, parent ID, role, depth, confidence, support signals, and evidence. Extended WorkThreadPayload / WorkThreadDocument with provider_breakdown, thread-level confidence, support_level, support_signals, and member_evidence array. Contract version bumped from 4 to 5.
Thread Construction & Enrichment
polylogue/lib/threads.py
Added WorkThreadMemberEvidence dataclass with serialization methods. Enhanced WorkThread to include confidence, support level, support signals, and member evidence tuple. Updated build_session_threads to compute per-member depths, derive roles and evidence from parent/continuation lineage, generate support signals from session/branch counts and repo presence, and compute confidence/support level from deterministic session metrics.
Storage & Serialization
polylogue/storage/session_product_threads.py, polylogue/storage/store_constants.py
Extended thread search text generation to include support-level and support-signals fields for richer indexing. Updated thread payload document serialization to include provider_breakdown, top-level confidence/support metadata, and fully structured member_evidence entries. Materializer version incremented from 8 to 9.
Test Coverage
tests/unit/cli/test_products.py, tests/unit/core/test_facade_api.py, tests/unit/core/test_threads_runtime.py, tests/unit/mcp/test_tool_contracts.py
Updated contract version assertions and expanded thread payload verification to validate support_level, support_signals, and member_evidence structure including roles, parent IDs, and per-member depths. New test module validates session-to-thread construction with explicit parent/continuation linkage and serialization round-tripping.

Sequence Diagram

sequenceDiagram
    participant Sessions as Session Profiles
    participant ThreadBuilder as build_session_threads
    participant Evidence as Evidence Computation
    participant WorkThread as WorkThread Object
    participant Storage as Thread Storage

    Sessions->>ThreadBuilder: Provide profiles with parent/continuation lineage
    ThreadBuilder->>Evidence: Extract depths, roles, lineage info
    Evidence->>Evidence: Compute support signals (session count, repos, bounds)
    Evidence->>Evidence: Compute confidence & support level
    Evidence->>ThreadBuilder: Return evidence data
    ThreadBuilder->>WorkThread: Create thread with member evidence<br/>(role, depth, confidence, support signals)
    WorkThread->>WorkThread: Serialize member_evidence tuples
    WorkThread->>Storage: Store enriched thread payload<br/>(provider_breakdown, thread-level metadata, member evidence)
    Storage->>Storage: Index support_level and support_signals<br/>for search coverage
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

area:storage, area:schema, area:cli

Poem

🐰 The threads grow wise with reason clear,
Each member's evidence brought near—
No hidden magic, just the facts,
Support and depth in audit tracks!
From roots to children, roles aligned,
A conversation's task, refined. ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/explain-work-thread-membership

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit d095414 into master Apr 24, 2026
10 of 12 checks passed
@Sinity
Sinity deleted the feature/feat/explain-work-thread-membership branch April 24, 2026 00:03
@Sinity

Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

@Sinity
Sinity requested a review from Copilot May 1, 2026 01:54
@Sinity
Sinity removed the request for review from Copilot May 1, 2026 02:15
Sinity added a commit that referenced this pull request May 7, 2026
Summary

Add deterministic membership evidence to durable work-thread products. Work-thread grouping remains conservative for this slice: explicit parent/continuation lineage is the only grouping authority, but each member now carries auditable evidence and each thread exposes support level/signals/confidence through CLI, facade, and MCP product payloads.

Problem

#313 asked for session-cluster/work-thread semantics. The codebase already had a durable `work_threads` product, but it exposed aggregates without explaining why a session belonged to a thread. That made the product hard to audit and weak as a substrate for future clustering signals.

Solution

- extend the shared work-thread payload with per-member evidence, support level/signals, confidence, and provider breakdown
- preserve conservative explicit lineage grouping for this issue
- bump archive product contract version and session-product materializer version so stale rows rebuild with the expanded payload
- include support/member signals in work-thread search text
- cover substrate round-tripping plus CLI, facade, and MCP public product contracts

Verification

- `pytest -q tests/unit/core/test_threads_runtime.py tests/unit/cli/test_products.py::test_products_profiles_json tests/unit/cli/test_products.py::test_products_enrichments_json tests/unit/cli/test_products.py::test_products_threads_json tests/unit/core/test_facade_api.py::TestPolylogueArchiveProducts::test_durable_session_products_are_publicly_queryable tests/unit/mcp/test_tool_contracts.py::TestProductTools::test_product_list_tools_use_archive_queries` passed: 8 passed in 12.09s
- `mypy --strict tests/unit/mcp/test_tool_contracts.py tests/unit/cli/test_products.py polylogue/archive_product_models.py polylogue/lib/threads.py` passed: Success, no issues found
- `devtools render-all --check` passed
- `devtools verify` passed: verify: all checks passed
- `git push -u origin feature/feat/explain-work-thread-membership` passed pre-push quick verification: verify: all checks passed

Closes #313
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[research] Session-cluster / work-thread concept — group conversations on same task

1 participant