Skip to content

fix(proxy): keep hard continuity owners ahead of affinity - #1732

Open
Komzpa wants to merge 10 commits into
mainfrom
fix/compact-owner-alias-drift-20260814
Open

fix(proxy): keep hard continuity owners ahead of affinity#1732
Komzpa wants to merge 10 commits into
mainfrom
fix/compact-owner-alias-drift-20260814

Conversation

@Komzpa

@Komzpa Komzpa commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • allow compact turn-state live/durable aliases that agree on the same account to resolve the compact owner instead of failing with continuity_owner_conflict
  • drop session/header affinity once compact or direct HTTP stream has a hard continuity owner, so image-capable live requests that bypass the bridge cannot reintroduce stale locality
  • normalize live usage snapshots to persisted account IDs before writing usage_history, avoiding FK failures when an upstream chatgpt-account-id appears on the serving path
  • update compact, direct-stream, and live-usage regressions

Validation

  • uv run pytest tests/unit/test_proxy_utils.py::test_plain_stream_resolves_http_bridge_turn_state_owner tests/unit/test_live_usage_ingest.py::test_ingestor_resolves_upstream_account_id_before_history_write tests/unit/test_live_usage_ingest.py::test_stream_responses_tap_publishes_rate_limit_events
  • uv run pytest tests/unit/test_proxy_utils.py::test_compact_turn_state_owner_never_falls_back_to_unscoped_sticky_sessions tests/unit/test_proxy_utils.py::test_compact_turn_state_owner_is_a_strict_selection_constraint tests/unit/test_proxy_utils.py::test_plain_stream_resolves_http_bridge_turn_state_owner tests/unit/test_proxy_utils.py::test_compact_file_pin_overrides_session_and_prompt_cache_locality tests/unit/test_live_usage_ingest.py::test_ingestor_resolves_upstream_account_id_before_history_write tests/unit/test_live_usage_ingest.py::test_stream_responses_tap_publishes_rate_limit_events
  • git diff --check

Live note

Initial live recovery at codex-lb:live-stack-790c93e / 790c93ef2f0b0d94aac1fb72b0f249304271fb6b removed the compact owner-alias failure, but a later live image-capable stream still hit continuity_owner_conflict after bypassing the HTTP bridge and live usage ingest logged sqlite3.IntegrityError: FOREIGN KEY constraint failed. This PR now includes those follow-up fixes; live redeploy/readback will be tracked separately from PR CI.

@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: 2d112a6e35

ℹ️ 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 app/modules/proxy/_service/compact.py
Comment thread tests/unit/test_proxy_utils.py Outdated
Comment thread app/modules/proxy/_service/compact.py Outdated
Comment thread app/modules/proxy/_service/compact.py Outdated
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Aug 13, 2026
@Komzpa
Komzpa force-pushed the fix/compact-owner-alias-drift-20260814 branch from 2d112a6 to 44d6c2f Compare August 13, 2026 22:49
@Komzpa Komzpa changed the title fix(proxy): allow compact owner aliases to override affinity fix(proxy): keep hard continuity owners ahead of affinity Aug 13, 2026
@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label Aug 13, 2026
@Komzpa
Komzpa force-pushed the fix/compact-owner-alias-drift-20260814 branch 2 times, most recently from 4c84dd6 to 5eb9304 Compare August 14, 2026 04:20
@Komzpa

Komzpa commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 5eb930427e

ℹ️ 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 app/modules/proxy/_service/streaming/retry.py Outdated
Comment thread tests/unit/test_live_usage_ingest.py
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Aug 14, 2026
@Komzpa
Komzpa force-pushed the fix/compact-owner-alias-drift-20260814 branch from 5eb9304 to 2c5f314 Compare August 14, 2026 09:19
@Komzpa

Komzpa commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 2c5f31443d

ℹ️ 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 app/modules/proxy/_service/streaming/retry.py Outdated
Comment thread app/modules/usage/live_ingest.py Outdated
@github-actions github-actions Bot added the db migration PR changes Alembic database migrations; maintainer must coordinate merge order label Aug 14, 2026
@Komzpa Komzpa added needs rebase Needs rebase or conflict repair against current main and removed 🤖 codex: needs work [@codex review] raised an issue labels Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

db migration PR changes Alembic database migrations; maintainer must coordinate merge order needs rebase Needs rebase or conflict repair against current main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant