Skip to content

Contain interactions that race provider turn acceptance - #19

Merged
0thernet merged 1 commit into
mainfrom
codex/gateway-settlement-race
Aug 20, 2026
Merged

Contain interactions that race provider turn acceptance#19
0thernet merged 1 commit into
mainfrom
codex/gateway-settlement-race

Conversation

@0thernet

Copy link
Copy Markdown
Contributor

Cause

The app-server can write a turn/start response and an interaction request in one stdout drain. SessionService may dispatch that request after resolving startTurn but before ChatService binds the returned provider turn ID. The existing exact-turn guard then treated an owned request as foreign and missed fail-closed containment.

Main CI run 32324202341 exposed this timing in compiled gateway boundary > hosts durable chat panes with independent admission, fenced streams, and fail-closed interaction recovery: settlementObserved remained false after 7.31 seconds.

Design

  • Latch early interactions whose logical turn, account, and provider thread match the pending startup.
  • After acceptance, use exact-turn containment for a matching provider turn and account-generation containment for conflicting lineage.
  • Retain the latch through admission closure, clear it through existing terminal cleanup, and delay queue/stream publication until containment resolves.
  • Emit the fixture interaction immediately after the start response to test same-drain ordering deterministically.

Tests

  • Chat-service suite: 172/172 passed, 1,147 expectations.
  • Compiled-gateway target: 1/1 passed, 29 expectations, 121.87 seconds.
  • Desktop typecheck, lint, and diff checks passed.
  • Independent review found no issues.
  • Full bun run check: all changed-area tests passed; 2,929/2,936 workspace tests passed. The seven failures are unchanged bundled-Git sandbox/process-group tests that passed on the preceding GitHub PR and remain delegated to required GitHub CI.

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hra Ready Ready Preview Aug 20, 2026 3:29am

Request Review

@0thernet
0thernet enabled auto-merge (squash) August 20, 2026 03:28
@0thernet
0thernet merged commit e85b57f into main Aug 20, 2026
4 checks passed
@0thernet
0thernet deleted the codex/gateway-settlement-race branch August 20, 2026 03:56
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