Skip to content

feat: add typed recall-pack target evidence - #1054

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/recall-pack-target-evidence
May 15, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/recall-pack-target-evidence

Conversation

@Sinity

@Sinity Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner

Summary

Add the next #867 recall-pack slice: recall packs now store typed target evidence with explicit resolved/degraded item states, and recall-pack operations have CLI and MCP parity.

Problem

After target-aware marks, annotations, and saved views landed, recall packs still accepted an opaque payload and only exposed daemon endpoints. That left recall packs unable to cite message, mark, and annotation targets with auditable degraded states, and left operator/agent surfaces without parity.

Solution

  • Normalize recall-pack saves through the Polylogue facade into schema_version: 1 payloads.
  • Preserve legacy conversation_ids input while converting it to typed conversation items.
  • Resolve conversation, message, mark, and annotation items into stable evidence where possible.
  • Preserve missing targets with status and disabled_reason instead of dropping them.
  • Preserve unsupported future target kinds as degraded items for later topology/workspace expansion.
  • Add polylogue user-state recall-packs list/save/delete.
  • Add MCP list_recall_packs, save_recall_pack, and delete_recall_pack, with envelope classification and regenerated tool-schema witness.
  • Record the slice in docs/plans/mk3-execution-log.md.

Ref #867

Verification

  • pytest -q -n0 tests/unit/storage/test_user_state_contracts.py tests/unit/daemon/test_web_reader.py::TestReaderUserState::test_recall_packs_roundtrip_cited_conversations tests/unit/cli/test_user_state_command.py tests/unit/mcp/test_user_state_tools.py -> 24 passed
  • pytest -q -n0 tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_envelope_contracts.py tests/unit/cli/test_click_app.py::TestCliMetadata::test_all_subcommands_registered tests/unit/mcp/test_user_state_tools.py tests/unit/cli/test_user_state_command.py -> 46 passed
  • ruff check polylogue/api/archive.py polylogue/cli/commands/user_state.py polylogue/mcp/payloads.py polylogue/mcp/server_mutation_tools.py tests/unit/storage/test_user_state_contracts.py tests/unit/daemon/test_web_reader.py tests/unit/cli/test_user_state_command.py tests/unit/mcp/test_user_state_tools.py -> passed
  • python -m mypy polylogue/api/archive.py polylogue/cli/commands/user_state.py polylogue/mcp/payloads.py polylogue/mcp/server_mutation_tools.py -> passed
  • devtools render-all --check -> passed
  • devtools verify --quick -> exit_code 0, total_duration_s 27.19 before commit; pre-push quick gate at 9dc6a58b -> exit_code 0, total_duration_s 17.8

Problem: recall packs still stored opaque payloads and only exposed daemon endpoints after the durable reader-state work. That left #867 without explicit degraded-target evidence and without CLI/MCP parity for recall-pack operations.

What changed: normalize recall-pack saves through the Polylogue facade into schema-versioned item payloads with resolved/degraded counts, add conversation/message/mark/annotation target resolution, preserve unsupported future targets as degraded items, and expose recall-pack list/save/delete through CLI and MCP with updated witness coverage.

Verification: pytest -q -n0 tests/unit/storage/test_user_state_contracts.py tests/unit/daemon/test_web_reader.py::TestReaderUserState::test_recall_packs_roundtrip_cited_conversations tests/unit/cli/test_user_state_command.py tests/unit/mcp/test_user_state_tools.py; pytest -q -n0 tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_envelope_contracts.py tests/unit/cli/test_click_app.py::TestCliMetadata::test_all_subcommands_registered tests/unit/mcp/test_user_state_tools.py tests/unit/cli/test_user_state_command.py; devtools render-all --check; devtools verify --quick.
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 53 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 175b2d6c-0898-4a5a-8e68-65b96dc34975

📥 Commits

Reviewing files that changed from the base of the PR and between 3633308 and 9dc6a58.

📒 Files selected for processing (12)
  • docs/cli-reference.md
  • docs/plans/mk3-execution-log.md
  • polylogue/api/archive.py
  • polylogue/cli/commands/user_state.py
  • polylogue/mcp/payloads.py
  • polylogue/mcp/server_mutation_tools.py
  • tests/data/witnesses/mcp-tool-schemas.json
  • tests/unit/cli/test_user_state_command.py
  • tests/unit/daemon/test_web_reader.py
  • tests/unit/mcp/test_envelope_contracts.py
  • tests/unit/mcp/test_user_state_tools.py
  • tests/unit/storage/test_user_state_contracts.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/recall-pack-target-evidence

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 9555507 into master May 15, 2026
4 checks passed
@Sinity
Sinity deleted the feature/feat/recall-pack-target-evidence branch May 15, 2026 15:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9dc6a58b5f

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

Comment thread polylogue/api/archive.py
Comment on lines +958 to +960
for key, value in payload.items():
if key not in {"items", "summary", "reason"}:
normalized_payload[key] = value

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block caller payload from overriding normalized recall fields

After building a normalized recall-pack payload (schema_version, items, resolved_count, degraded_count), the loop copies every key from the caller payload except items/summary/reason, which lets clients overwrite those normalized fields by sending keys like schema_version, resolved_count, or degraded_count in payload_json. In that case the stored pack can claim incompatible counts/version relative to its resolved items, breaking the typed-evidence contract this change introduces.

Useful? React with 👍 / 👎.

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.

1 participant