Skip to content

fix(daemon): keep Codex append identity hot - #1461

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/codex-append-identity
May 24, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/codex-append-identity

Conversation

@Sinity

@Sinity Sinity commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

Codex live append planning now accepts an existing conversation identity even when that conversation is currently linked through an append-only raw record. This prevents hot long-running sessions from falling back to full-file replay when the archive has already converged through append ingest.

Problem

Live deployment of #1460 through Sinnix still showed unsafe catch-up behavior under #1447. The daemon replayed an 81 MB Codex file as ~10.5k changed messages and then started a 234 MB full replay. Inspection of the 234 MB source showed the append planner returned None because _existing_provider_conversation_id() filtered out raw_conversations.source_index = -1; the only linked conversation identity for that path came from an append raw record, so the planner treated the next tail as requiring full ingest.

Solution

Remove the full-raw-only filter from Codex conversation identity lookup. Append-only raw records are valid convergence state for source identity, and using them preserves full daemon scope while keeping hot-session catch-up on the bounded append path. A regression seeds the exact archive shape and asserts _append_plan() produces a bounded Codex append payload with the session metadata prefix.

Verification

  • pytest tests/unit/sources/test_live_batch_support.py -q -> 13 passed
  • pytest tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_live_hot_session_convergence.py -q -> 81 passed
  • ruff check polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py -> passed
  • mypy polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py -> passed
  • devtools verify --quick -> exit_code 0, total_duration_s 37.29
  • pre-push devtools verify --quick -> exit_code 0, total_duration_s 34.94
  • Manual live-archive planner probe for /home/sinity/.codex/sessions/2026/05/16/rollout-2026-05-16T13-50-17-019e309f-7614-7381-a8ac-f9080f304ee6.jsonl: before fix _append_plan() returned None; after fix it returns _AppendPlan with start=232985578, last=234554166, bytes_read=1568588, payload_len=1568668.

Ref #1447

Problem: live catch-up could fall back to full-file replay for a hot Codex session when the latest conversation identity for that source path was linked through an append-only raw record. That path is valid convergence state, but the planner filtered it out and then treated the next tail as requiring full ingest.\n\nWhat changed: Codex append identity lookup now accepts any conversation linked to the source path, including append-only raw records. A regression seeds that exact archive shape and asserts append planning still produces a bounded tail plan with the Codex session metadata prefix.\n\nVerification: pytest tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_live_catchup_planning.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_live_hot_session_convergence.py -q; ruff check polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py; mypy polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py; devtools verify --quick.\n\nRef #1447
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 46 minutes and 18 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 @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 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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 21697680-6bcd-498c-8a72-598a85ffcc0a

📥 Commits

Reviewing files that changed from the base of the PR and between 55f5698 and 774cb9d.

📒 Files selected for processing (2)
  • polylogue/sources/live/batch.py
  • tests/unit/sources/test_live_batch_support.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/codex-append-identity

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 2179002 into master May 24, 2026
6 checks passed
@Sinity
Sinity deleted the feature/fix/codex-append-identity branch May 24, 2026 00:55

@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: 774cb9da8f

ℹ️ 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/sources/live/batch.py Resolved
Sinity added a commit that referenced this pull request May 24, 2026
Live full ingest now suspends FTS triggers at the same 8 MiB threshold where it already switches to streaming blob ingestion. Large same-size source rewrites still fully converge, but they use one bounded FTS repair at commit instead of per-row trigger churn.\n\nThis follows live #1447 evidence after #1461: append-planned hot Codex tails were fixed, but an 18 MiB same-size full replay in a 37.8 MiB chunk still drove read_bytes past 24 GB and hit database locking.\n\nVerification:\n- pytest tests/unit/sources/test_live_batch_support.py -q\n- ruff check polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py\n- mypy polylogue/sources/live/batch.py tests/unit/sources/test_live_batch_support.py\n- devtools verify --quick\n- PR checks: Analyze (python), CodeQL, container builds, GitGuardian, CodeRabbit\n\nRef #1447
@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.

  • 70.F050 / P1: fixed-already at the checked revision: The identity lookup now selects the indexed session's native identity, not native_id from the newest append raw. polylogue/sources/live/batch.py:7082-7089 joins its owning raw solely to establish the same path and matching source/index origins; the append parser receives the resolved session identity as its fallback.

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.

1 participant