Skip to content

sdk/python: rebind find_iter after an owner moves - #484

Merged
CMGS merged 3 commits into
mainfrom
codex/fix-find-iter-rebind
Nov 6, 2026
Merged

CMGS merged 3 commits into
mainfrom
codex/fix-find-iter-rebind

Conversation

@CMGS

@CMGS CMGS commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

After a sandbox moves, a direct find_iter() call still targets the old owner on every retry. Unlike find(), the iterator never called _rebind, leaving the handle stale after an owner 404 or refused connection. This closes the P2 found after #483.

find_iter() now opens its stream through the existing _open_stream, which follows one move: on an owner 404 or a refused connection it looks the sandbox up and retries once at the new owner, as the Go FindSeq does through retryMoved. A moved owner shows only at the dial or the upgrade reply, both before the first frame, so the retry replays no match. find() collects find_iter() and drops its own _follows_move, so a call still makes one lookup and one retry at most. _open_stream with an empty expect returns the first frame of any type.

The regression uses in-process fake nodes and the existing relay fixture, with no sleeps or timing assertions. It covers both owner 404 and connection refusal, for find_iter() and find(): the first call returns the matches from the new owner, with one lookup and one upgrade there.

Validation on Python 3.12:

  • Negative control with the previous find_iter: both find_iter cases fail; both find cases pass.
  • Focused migration and callback-error checks: 6 passed.
  • Full Python SDK suite: 289 passed.
  • Ruff and mypy at the CI pins (ruff 0.15.22, mypy 1.20.2): passed.
  • Repository-wide ruff format --check . and ruff check .: passed.
  • SDK strict python -m mypy: passed, 11 source files.
  • git diff --check: passed.

LOC: production +7/-6 (net +1); tests +22. No dependencies or public API changes. No hardware migration run; this validates the SDK routing and retry boundary.

CMGS added 3 commits November 6, 2026 15:33
…Seq does

A moved owner shows only at the dial or the upgrade reply, both before the first frame, so a retry replays no match. find_iter opens through _open_stream, which already follows one move, and find drops its own decorator.
@CMGS
CMGS merged commit 1a48e2b into main Nov 6, 2026
2 checks passed
@CMGS
CMGS deleted the codex/fix-find-iter-rebind branch November 6, 2026 07:53
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