Skip to content

feat: tail ahead-of-archive source sessions - #392

Merged
Sinity merged 3 commits into
masterfrom
feature/feat/tail-ahead-of-archive-sessions
Apr 23, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/feat/tail-ahead-of-archive-sessions

Conversation

@Sinity

@Sinity Sinity commented Apr 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add an opt-in --tail query mode that runs the normal query path against a
throwaway overlay archive built from source files that are ahead of stable
archive state. Query semantics stay the same as non-tail mode; the only
addition is machine-readable provenance showing when a result came from
source state the archive has not caught up to yet.

Problem

#308 originally used a looser “live session” framing, but the actual need is
narrower and more concrete: users want to tail sources that have advanced on
disk without inventing a separate transcript ontology or a second query model.
Before this change, Polylogue could only query the stable archive. Claude Code
sessions that were newer on disk were invisible until the next ingest, and any
attempt to expose that state risked drifting into bespoke live-only semantics.

Solution

  • add polylogue.pipeline.tail_overlay and polylogue.lib.tail_overlay to
    snapshot the stable archive into a temporary SQLite overlay and materialize
    ahead-of-archive Claude Code source state there
  • keep the normal query planner and execution path intact by routing --tail
    queries through the overlay runtime services instead of inventing a second
    query surface
  • expose tail provenance on conversation and summary runtime models plus JSON
    surface payloads
  • preserve summary-query lightweight metadata behavior by projecting only the
    tail_overlay fragment out of provider_meta
  • add read-only guardrails for mutation/delete/open routes while rendered
    artifacts still reflect stable archive state
  • cover replacement, unseen-session, parse-failure fallback, catch-up, and CLI
    help/output behavior with direct runtime tests

Verification

  • mypy --strict polylogue/cli/query.py polylogue/lib/tail_overlay.py polylogue/pipeline/tail_overlay.py polylogue/surface_payloads.py polylogue/lib/conversation_runtime.py polylogue/lib/conversation_summary_runtime.py polylogue/storage/backends/queries/conversations_reads.py
  • pytest -q tests/unit/pipeline/test_tail_overlay_runtime.py tests/unit/cli/test_tail_query_runtime.py tests/unit/cli/test_click_app.py tests/unit/cli/test_query_exec.py
  • pytest -q tests/unit/storage/test_store_ops.py::test_list_summaries_by_query_omits_large_provider_meta_payloads tests/unit/cli/test_tail_query_runtime.py tests/unit/cli/test_terminal_snapshots.py --snapshot-update
  • devtools render-all
  • devtools verify
  • git push -u origin feature/feat/tail-ahead-of-archive-sessions (pre-push devtools verify --quick)

Closes #308

Sinity added 3 commits April 23, 2026 22:43
Problem\n\nPolylogue could only query the stable archive state. For Claude Code\nsessions still advancing on disk, that meant users had to choose between\nwaiting for ingest or inventing a separate live-mode model with different\nquery semantics.\n\nWhat changed\n\nAdd a temporary tail overlay that snapshots the stable archive into a\nthrowaway SQLite database, reparses supported source files that are ahead\nof archive state, and runs the normal query path against that overlay.\nExpose tail provenance on conversation and summary payloads, preserve\nsummary-query lightweight provider metadata by projecting only the\ntail_overlay fragment, and add the root --tail flag plus read-only route\nguards.\n\nCompatibility\n\nThe stable archive remains authoritative and unchanged. --tail is opt-in,\ncurrently scoped to configured Claude Code sources, and unsupported for\nmutation and open routes.\n\nRef #308\nCo-Authored-By: Claude <[email protected]>
Problem\n\nThe new tail overlay path spans real Claude Code source discovery,\noverlay materialization, query execution, summary projection, and CLI\nhelp surfaces. Without direct coverage, it would be easy to regress the\nsemantics while the stable archive path still passes.\n\nWhat changed\n\nAdd runtime tests for ahead-of-archive replacement, unseen sessions,\nparse-failure fallback, and archive catch-up. Add CLI coverage for JSON\nlist output and unsupported-source errors, extend query execution tests\nfor rejected mutation/open routes, and refresh terminal help snapshots.\n\nRef #308\nCo-Authored-By: Claude <[email protected]>
Problem\n\nThe root CLI help gained a new tail query flag and example. The rendered\nreference needs to match the live surface so operators can discover the\nfeature without reading implementation details.\n\nWhat changed\n\nRegenerate the CLI reference after adding the --tail option and example.\n\nRef #308\nCo-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 23, 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 17 minutes and 52 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 52 seconds.

⌛ 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: 074f7829-ab1c-426f-81f0-c33d0c17816d

📥 Commits

Reviewing files that changed from the base of the PR and between 811c948 and 63cd6c3.

📒 Files selected for processing (15)
  • docs/cli-reference.md
  • polylogue/cli/click_app.py
  • polylogue/cli/click_option_groups.py
  • polylogue/cli/query.py
  • polylogue/lib/conversation_runtime.py
  • polylogue/lib/conversation_summary_runtime.py
  • polylogue/lib/tail_overlay.py
  • polylogue/pipeline/tail_overlay.py
  • polylogue/storage/backends/queries/conversations_reads.py
  • polylogue/surface_payloads.py
  • tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr
  • tests/unit/cli/test_click_app.py
  • tests/unit/cli/test_query_exec.py
  • tests/unit/cli/test_tail_query_runtime.py
  • tests/unit/pipeline/test_tail_overlay_runtime.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/tail-ahead-of-archive-sessions

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 e714ef3 into master Apr 23, 2026
11 of 13 checks passed
@Sinity
Sinity deleted the feature/feat/tail-ahead-of-archive-sessions branch April 23, 2026 20:45

@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: 63cd6c3f16

ℹ️ 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/pipeline/tail_overlay.py Resolved
Comment thread polylogue/pipeline/tail_overlay.py Resolved

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Add an opt-in `--tail` query mode that runs the normal query path
against a
throwaway overlay archive built from source files that are ahead of
stable
archive state. Query semantics stay the same as non-tail mode; the only
addition is machine-readable provenance showing when a result came from
source state the archive has not caught up to yet.

## Problem

`#308` originally used a looser “live session” framing, but the actual
need is
narrower and more concrete: users want to tail sources that have
advanced on
disk without inventing a separate transcript ontology or a second query
model.
Before this change, Polylogue could only query the stable archive.
Claude Code
sessions that were newer on disk were invisible until the next ingest,
and any
attempt to expose that state risked drifting into bespoke live-only
semantics.

## Solution

- add `polylogue.pipeline.tail_overlay` and `polylogue.lib.tail_overlay`
to
snapshot the stable archive into a temporary SQLite overlay and
materialize
  ahead-of-archive Claude Code source state there
- keep the normal query planner and execution path intact by routing
`--tail`
queries through the overlay runtime services instead of inventing a
second
  query surface
- expose tail provenance on conversation and summary runtime models plus
JSON
  surface payloads
- preserve summary-query lightweight metadata behavior by projecting
only the
  `tail_overlay` fragment out of `provider_meta`
- add read-only guardrails for mutation/delete/open routes while
rendered
  artifacts still reflect stable archive state
- cover replacement, unseen-session, parse-failure fallback, catch-up,
and CLI
  help/output behavior with direct runtime tests

## Verification

- `mypy --strict polylogue/cli/query.py polylogue/lib/tail_overlay.py
polylogue/pipeline/tail_overlay.py polylogue/surface_payloads.py
polylogue/lib/conversation_runtime.py
polylogue/lib/conversation_summary_runtime.py
polylogue/storage/backends/queries/conversations_reads.py`
- `pytest -q tests/unit/pipeline/test_tail_overlay_runtime.py
tests/unit/cli/test_tail_query_runtime.py
tests/unit/cli/test_click_app.py tests/unit/cli/test_query_exec.py`
- `pytest -q
tests/unit/storage/test_store_ops.py::test_list_summaries_by_query_omits_large_provider_meta_payloads
tests/unit/cli/test_tail_query_runtime.py
tests/unit/cli/test_terminal_snapshots.py --snapshot-update`
- `devtools render-all`
- `devtools verify`
- `git push -u origin feature/feat/tail-ahead-of-archive-sessions`
(pre-push `devtools verify --quick`)

Closes #308
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

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.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

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.

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.

[feat] Tail ahead-of-archive source sessions

2 participants