-
Notifications
You must be signed in to change notification settings - Fork 397
fix(http-bridge): stabilize silent and clean-close recovery #1394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Soju06
merged 122 commits into
Soju06:main
from
shaqman:fix/http-bridge-clean-close-penalty
Aug 4, 2026
Merged
Changes from all commits
Commits
Show all changes
122 commits
Select commit
Hold shift + click to select a range
5b588a2
fix(http-bridge): stabilize silent and clean-close recovery
e95fbf3
fix: avoid hard anchor for synthesized bridge turn state
Komzpa 3172455
docs: add @shaqman as a contributor
Komzpa e16fd4b
fix: harden bridge retry circuit cleanup
Komzpa e174c65
fix: close clean-close retry races
Komzpa c616a9d
fix(http-bridge): address reconnect clean-close review
Komzpa 89d7ac0
Handle idle bridge retry transport failures
Komzpa 48e5965
chore(proxy): keep rebase validation green
4c5019a
fix(http-bridge): avoid rejected account on model fallback
4716189
fix(http-bridge): retire stale gate holders with active siblings
e10ec0f
fix(http-bridge): synchronize retry circuit state
c206f6e
fix(http-bridge): stabilize websocket receive failures
1dcb7ad
fix(http-bridge): preserve upstream rebase behavior
512b9cc
fix(db): converge deployed request log migration heads
45c6074
fix(proxy): briefly retry saturated hard affinity owners
04088d5
fix(api): restore multipart request helpers
a53a992
fix(http-bridge): preserve file owners during recovery
b90f53a
fix(http-bridge): close recovery race paths
e489bf8
fix(http-bridge): refresh durable retry circuits
69fc09c
fix(migrations): converge retry circuit history cleanly
9902f45
fix(http-bridge): clean up cancelled handoffs
0468d63
fix(http-bridge): bound handoff and circuit state
6731b9e
fix(http-bridge): settle cancelled clean-close retries
bde5d41
fix(http-bridge): retain sessions during handoff
f84b91d
fix(http-bridge): cap anchored stuck-gate wait at 2x retire threshold
cigro-manager 0656dd4
fix(http-bridge): judge stuck-gate staleness by upstream activity, no…
cigro-manager 83a7f0b
debug(http-bridge): dump pending-state verdict inputs when stuck watc…
cigro-manager b13ee71
fix(http-bridge): treat missing response.created as the stuck-gate we…
cigro-manager 48e39fe
fix(http-bridge): prevent stuck pre-response watchdog starvation
4de32c1
fix(http-bridge): preserve reader handoff and migration head
da57604
fix(db): repair stamped request usage rollup heads
17d03a4
fix(db): keep rollup repair downgrade forward-only
fd65c65
fix(db): converge pending tool call and repair heads
c72eb8d
fix(http-bridge): preserve draining siblings and cancellation
c657e8c
fix(http-bridge): hold handoff guard through lease swap
f439f3f
fix(http-bridge): guard every reconnect handoff
b3fe8e9
fix(http-bridge): wait for guarded registry handoffs
00cd90e
fix(http-bridge): complete handoff guards before validation
36fa29f
fix(http-bridge): finalize guarded handoffs on commit failure
216315b
fix(http-bridge): retain old lease through release
d91d0cc
fix(http-bridge): finalize reconnect failures consistently
595187d
fix(http-bridge): finalize lease release failures
6f08bbf
fix(http-bridge): preserve fallback and continuity coverage
3affe4c
fix(http-bridge): select retry state before fallback checks
35377d1
fix(http-bridge): protect reconnect futures from waiter eviction
973450b
test(http-bridge): cover protected handoff timeouts
8e6cdee
fix(http-bridge): preserve reset lineage and cleanup
77fb5d6
test(http-bridge): cover cancelled owner lease release
7afa525
fix(http-bridge): clear durable circuit after lookup errors
c0c1491
fix(http-bridge): gate retry circuit on pre-response failures
ffdebde
fix(http-bridge): penalize deferred pre-response failures
bc502ae
fix(http-bridge): age stale requests by upstream activity
de59203
fix(retry-circuit): preserve merged backoff and purge expiry
4720b0a
fix(retry-circuit): release global lock during durable I/O
70f6288
fix(retry-circuit): defer durable writes and task cleanup
07a8abc
fix(http-bridge): finalize unexpected reconnect failures
5336886
fix(retry-circuit): ignore stale cooldown after reset
9648b88
fix(http-bridge): exclude handoffs from capacity and surface storage …
ac1352b
fix(retry-circuit): guard stale purges and backoff exponent
8750b6a
fix(proxy): track deferred cancellation drains
5ec3f83
fix(http-bridge): clear cooldown mode on upstream activity
740298f
fix(http-bridge): pass reader cleanup ownership
ef50b9c
fix(retry-circuit): guard concurrent resets
3ec63f5
fix(retry-circuit): clear unknown timestamp state
7a99615
fix(retry-circuit): ignore stale failure snapshots
a154978
fix(http-bridge): add safe continuity recovery bounds
shaqman 4a5265d
fix(http-bridge): preserve focused safe-continuity test diff
shaqman fe42789
fix(http-bridge): publish deployed recovery path
shaqman 8cdc0ad
fix(http-bridge): fail fast hard no-safe-replay cooldowns
shaqman 5c0ddad
fix(http-bridge): fail fast before cooldown keepalive loop
shaqman 93951b3
fix(http-bridge): reject cooldown-bound requests before submit
shaqman 855a2b3
fix(http-bridge): address owner review and bound ack watchdog
fceba50
fix(http-bridge): close review cleanup races
bdf7809
fix(http-bridge): preserve local circuit on purge failure
dc90963
fix(http-bridge): close retry ownership races
edbdc53
fix(http-bridge): make ambiguous recovery replay-safe
d78db7d
fix(http-bridge): narrow durable recovery replay
ed2ad68
fix(http-bridge): fence recovery journal ownership
c395b1f
fix(http-bridge): fence recovery recording ownership
55c240f
fix(http-bridge): retain recovery owner fence on conflicts
e0e66bf
fix(http-bridge): fail closed on stale recovery owner
b006d7d
fix(http-bridge): close remaining recovery races
ba7d07f
fix(http-bridge): keep recovery alias guard scoped
50115e1
fix(http-bridge): close journal and circuit clear races
77e4a41
fix(http-bridge): claim durable replay before resend
cae7a34
fix(http-bridge): fence replay claims and transfer leases
77b9935
fix(http-bridge): settle terminal recovery outcomes
640a2ca
fix(http-bridge): fence active recovery attempts
b8f2f7f
fix(http-bridge): arm fresh recovery journal fence
2286667
fix(http-bridge): preserve recovery journal identity
e8fcbe5
fix(http-bridge): preserve recovery and timeout safety
8199d39
fix(http-bridge): complete durable recovery fencing
d43d7f1
fix(http-bridge): preserve journal and alias ownership
75855fa
fix(http-bridge): finish recovery settlement fencing
e78875d
fix(http-bridge): fence response-observed recovery attempts
e469ca5
fix(http-bridge): renew lease during settlement backoff
3bff314
fix(http-bridge): preserve origin settlement ownership
945205f
fix(http-bridge): retain settlement fencing on shutdown
3e66fbf
fix(http-bridge): drain origin settlement before shutdown
32970ec
fix(http-bridge): bound recovery settlement fanout
4d0390f
fix(shutdown): drain settlements before owner transition
c6aea46
docs(openspec): align idle watchdog contract
01b6889
fix(shutdown): retain child cancellation cleanup
b933e88
fix(http-bridge): deduplicate settlement retries
9459301
fix(http-bridge): finalize settlement ownership
c0c957a
fix(http-bridge): preserve shutdown settlement fences
e4fb1f4
fix(http-bridge): release settled recovery origins
9442982
fix(http-bridge): track deferred cancellation cleanup
6f86988
fix(http-bridge): fence stale recovery takeover
952d93f
fix(http-bridge): revalidate recovery journal before dispatch
6e3715c
Fix HTTP bridge retry and recovery stability
52f6342
Fix CI settings drift and websocket cleanup
1a333a2
Fix telemetry deadlines and circuit clock skew
ddc800c
Handle lagging retry circuit clocks with CAS
aee76e7
Rollback un-dispatched recovery claims
b1e73d7
Carry durable replay claims into retries
89ed8a0
Track recovery dispatch after upstream send
4689b79
Record stuck gate timeouts in retry circuits
5d45c2e
Preserve retry hints in streaming errors
d27f2e1
fix(ci): merge migration heads and keep proxy facade under budget
84568e8
test(db): accept merged migration head
ce81335
Merge branch 'main' into fix/http-bridge-clean-close-penalty
Soju06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/db/alembic/versions/20260717_000000_add_http_bridge_retry_circuits.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| """add durable HTTP bridge retry circuit state | ||
|
|
||
| Revision ID: 20260717_000000_add_http_bridge_retry_circuits | ||
| Revises: 20260717_000000_optimize_dashboard_hot_path_indexes | ||
| Create Date: 2026-07-17 | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| revision = "20260717_000000_add_http_bridge_retry_circuits" | ||
| down_revision = "20260717_000000_optimize_dashboard_hot_path_indexes" | ||
|
shaqman marked this conversation as resolved.
|
||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
| _TABLE_NAME = "http_bridge_retry_circuits" | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| bind = op.get_bind() | ||
| inspector = sa.inspect(bind) | ||
| if inspector.has_table(_TABLE_NAME): | ||
| return | ||
| op.create_table( | ||
| _TABLE_NAME, | ||
|
Komzpa marked this conversation as resolved.
|
||
| sa.Column("session_key_kind", sa.String(length=64), nullable=False), | ||
| sa.Column("session_key_hash", sa.String(length=64), nullable=False), | ||
| sa.Column("api_key_scope", sa.String(length=255), nullable=False), | ||
| sa.Column("consecutive_failures", sa.Integer(), nullable=False, server_default="0"), | ||
| sa.Column("cooldown_until_epoch", sa.Float(), nullable=False, server_default="0"), | ||
| sa.Column("last_detail", sa.String(length=255), nullable=True), | ||
| sa.Column("updated_at_epoch", sa.Float(), nullable=False), | ||
| sa.PrimaryKeyConstraint( | ||
| "session_key_kind", | ||
| "session_key_hash", | ||
| "api_key_scope", | ||
| name="pk_http_bridge_retry_circuits", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| bind = op.get_bind() | ||
| if sa.inspect(bind).has_table(_TABLE_NAME): | ||
| op.drop_table(_TABLE_NAME) | ||
22 changes: 22 additions & 0 deletions
22
app/db/alembic/versions/20260717_000001_merge_retry_circuits_and_dashboard_indexes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| """merge retry circuits and dashboard index heads | ||
|
|
||
| Revision ID: 20260717_000001_merge_retry_circuits_and_dashboard_indexes | ||
| Revises: | ||
| - 20260717_000000_add_http_bridge_retry_circuits | ||
| Create Date: 2026-07-17 00:00:00.000000 | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| revision = "20260717_000001_merge_retry_circuits_and_dashboard_indexes" | ||
| down_revision = ("20260717_000000_add_http_bridge_retry_circuits",) | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| pass | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| pass |
33 changes: 33 additions & 0 deletions
33
app/db/alembic/versions/20260724_000000_merge_request_log_schema_heads.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| """merge the deployed retry-circuit and request-log schema heads | ||
|
|
||
| Revision ID: 20260724_000000_merge_request_log_schema_heads | ||
| Revises: | ||
| - 20260717_000001_merge_retry_circuits_and_dashboard_indexes | ||
| - 20260722_000000_backfill_request_log_useragent_families | ||
| Create Date: 2026-07-24 00:00:00.000000 | ||
|
|
||
| The deployed SQLite database was previously stamped at the retry-circuit | ||
| merge revision while the request-log conversation-id branch was not applied. | ||
| Keeping the retry-circuit merge and the request-usage rollup as parents lets | ||
| Alembic apply the missing request-log revisions before converging on one head | ||
| without leaving the rollup revision as a second head or rewriting migration | ||
| history. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| revision = "20260724_000000_merge_request_log_schema_heads" | ||
| down_revision = ( | ||
| "20260717_000001_merge_retry_circuits_and_dashboard_indexes", | ||
| "20260724_000000_add_request_usage_time_rollups", | ||
| ) | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| pass | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| pass |
37 changes: 37 additions & 0 deletions
37
app/db/alembic/versions/20260726_000000_repair_request_usage_rollups_after_merge.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| """repair request-usage rollups for databases stamped at the old merge head | ||
|
|
||
| Revision ID: 20260726_000000_repair_request_usage_rollups_after_merge | ||
| Revises: 20260724_000000_merge_request_log_schema_heads | ||
| Create Date: 2026-07-26 | ||
|
|
||
| Some deployed databases were stamped at the request-log merge revision before | ||
| the request-usage rollup child was connected to that merge. Changing the | ||
| parent tuple cannot make Alembic replay an already-applied revision, so those | ||
| databases need a forward-only repair step. The canonical rollup migration is | ||
| idempotent and safely creates any missing tables or watermark column here. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import importlib | ||
| from types import ModuleType | ||
|
|
||
| revision = "20260726_000000_repair_request_usage_rollups_after_merge" | ||
| down_revision = "20260724_000000_merge_request_log_schema_heads" | ||
|
shaqman marked this conversation as resolved.
|
||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def _rollup_migration() -> ModuleType: | ||
| return importlib.import_module("app.db.alembic.versions.20260724_000000_add_request_usage_time_rollups") | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| _rollup_migration().upgrade() | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # This revision repairs databases that were already stamped at the merge | ||
| # head. It must never remove objects owned by the canonical rollup | ||
| # revision, which remains an ancestor of that merge head on fresh installs. | ||
| pass | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.