Skip to content

test: control asyncio timing and own harness cleanup - #838

Merged
AlexanderZ-Band merged 13 commits into
mainfrom
feat/remove-wall-clock-scheduling-assumptions-from-boun-INT-1845
Oct 20, 2026
Merged

AlexanderZ-Band merged 13 commits into
mainfrom
feat/remove-wall-clock-scheduling-assumptions-from-boun-INT-1845

Conversation

@AlexanderZ-Band

@AlexanderZ-Band AlexanderZ-Band commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Selected asyncio tests inferred readiness and deadline behavior from real sleeps and narrow scheduling margins, so results depended on host scheduling and cleanup could be skipped on exceptional exits.

What

Express test intent through a controlled clock, completion barriers, and contexts that own cleanup. OpenCode approval, human-wait and turn-timeout tests advance virtual time across one shared compute budget, including a resumed turn that overruns it. Watchdog tests observe close attempts across deadline, retry and reset boundaries, and retention reporting asserts exact callback order. Adapter owners retain task handles through failed closes, the ACP harness closes partially opened transports, and ACP startup sends run as owned background tasks. The turn-grace test waits on a completion notification instead of a timed poll and stays on real time, since randomized resync deadlines can be unreachable under looptime. pytest-randomly 5.0.0 is pinned in all four isolated development extras.

Scope

Test harnesses and regression coverage; production source is unchanged. The real ACP socketpair boundary, real-I/O safety bounds and exact behavioral assertions stay. The binary precision policy is reused from tests/toolkit/clock.py. Plan, validation results and open attribution questions: INT-1845. Making the superseded-connection watchdog test able to fail (INT-1875) and splitting OpenCode TestTurns by concern (INT-1876) are tracked separately.

@linear-code

linear-code Bot commented Oct 18, 2026

Copy link
Copy Markdown

INT-1845

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my-code-review --fix: one cycle converged with no verified findings. Reviewed the controlled-time harness, exceptional cleanup ownership, approval budget coverage, watchdog boundaries, retention callback ordering, and development dependency changes. Simplify found no behavior-preserving cleanup to apply. No existing unresolved review feedback required disposition.

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my-code-review --fix: final full-diff review converged with no verified findings. Rechecked reusable task ownership, AdapterOwner cleanup after a backend-close failure, declarative approval scenarios, controlled timer boundaries, ACP real-wire failure cleanup, and retention reporting order. The additional teardown failure probe is covered by a regression. All 22 targeted cases pass; final full-suite and OS-matrix results are tracked in INT-1845.

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my-code-review --fix: final-head review converged with no verified findings. Rechecked the full test/harness diff, including durable background-task ownership after failed explicit closes, reusable lifecycle contexts, declarative approval scenarios, and controlled deadline/callback boundaries. Non-test manifest and lock changes remain unchanged from the reviewed dependency configuration. Regression and order evidence is attached to INT-1845; final OS-matrix results are tracked there.

@AlexanderZ-Band AlexanderZ-Band left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my-code-review --fix converged on final head de6fa75 with no verified findings across groups A–F. Test Quality reviewed all changed tests/fixtures and confirmed retained OpenCode turn bodies preserve behavior. Non-test reviewers verified the isolated dependency declarations, lock, released plugin semantics, and CI callers. Edge-case and logical maps found no hypotheses requiring a skeptic. No unresolved feedback, no new simplify changes, and no review fixes required. All 26 selected cases passed individually, fixed/reversed, and under seeds 1845, 791, 32386 and 3446227654. Restoring the grace timed poll reproduces the seed3446227654 hang even with binary precision. Final-head actual Ubuntu/Windows CI passed all six Python3.11–3.13 cells. Full live rollup:41 passed checks,1 conditional skip,0 failures/pending; no unresolved review threads. Seeds, actual orders, negative controls, older native-I/O failures and remaining limitations are documented in INT-1845.

@AlexanderZ-Band
AlexanderZ-Band added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 19, 2026
@AlexanderZ-Band
AlexanderZ-Band marked this pull request as draft October 20, 2026 12:10
AlexanderZ-Band and others added 3 commits October 20, 2026 15:45
…from-boun-INT-1845

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzhwJvLEnTtZiBUbi7SW6V
Main moved the OpenCode turn task onto TurnState.watcher, and the merge left
dev-parlant declaring pytest-randomly twice while the parlant job guard still
treated it as parlant-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzhwJvLEnTtZiBUbi7SW6V

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking — would be REQUEST_CHANGES on a PR by someone else.

my-code-review --fix, cycle 1 on 5764245 (after merging main and a simplify pass). One in-scope issue: TestGraceControls is back on looptime via the merge resolution, and a resync deadline drawn under some pytest-randomly seeds livelocks it (seed 74). One out-of-scope issue: the superseded-connection watchdog test can't fail. Two suggestions and a nit on opencode/test_turns.py. Four hang-vs-fail hypotheses were dropped as no-fix records.

Comment thread tests/runtime/turnadmission/test_grace_controls.py Outdated
Comment thread tests/websocket/test_watchdog.py
Comment thread tests/adapters/opencode/test_turns.py
Comment thread tests/adapters/opencode/test_turns.py Outdated
Comment thread tests/adapters/opencode/test_turns.py Outdated
Comment thread tests/adapters/opencode/approvalclock.py
Comment thread tests/websocket/test_watchdog.py
Comment thread tests/integrations/acp/roomownership/test_harness_cleanup.py
Comment thread tests/runtime/turnadmission/test_grace_controls.py
AlexanderZ-Band and others added 2 commits October 20, 2026 17:56
Under looptime a randomized resync deadline can land a fraction of a tick
past any reachable virtual time, re-arming the process loop's timeout
forever (pytest-randomly seed 74). Restore main's real-time configuration
for TestGraceControls while keeping the completion barrier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzhwJvLEnTtZiBUbi7SW6V
…d clock

The human-wait reset test now banks an exact deliberation on the
controlled clock and asserts it was banked before the next turn resets
it. The turn-timeout test uses the owned make_adapter fixture and crosses
turn_timeout_s explicitly, asserting no abort just before the deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzhwJvLEnTtZiBUbi7SW6V

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my-code-review --fix, cycle 2 on 0002765: no verified issues — converged. Two nits and a suggestion on the OpenCode approval-timing tests; four hypotheses (harness task joins, looptime teardown, setup_looptime resets, setup-case match) were dropped as no-fix records.

Comment thread tests/adapters/opencode/test_approval_timing.py Outdated
Comment thread tests/adapters/opencode/test_approval_timing.py
Comment thread tests/adapters/opencode/helpers.py
Comment thread tests/adapters/opencode/ownership.py
Comment thread tests/adapters/opencode/ownership.py
Comment thread tests/toolkit/timecontrol.py
Comment thread tests/integrations/acp/roomownership/test_harness_cleanup.py
AlexanderZ-Band and others added 3 commits October 20, 2026 20:34
COMPUTE_BUDGET_S lives once in the OpenCode test helpers; the approval
window and timing rows are expressed through it, and a resumed turn that
overruns the budget is shown to be aborted with a timeout failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzhwJvLEnTtZiBUbi7SW6V
…from-boun-INT-1845

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzhwJvLEnTtZiBUbi7SW6V
@AlexanderZ-Band
AlexanderZ-Band marked this pull request as ready for review October 20, 2026 17:47
@AlexanderZ-Band
AlexanderZ-Band added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit aff3692 Oct 20, 2026
43 checks passed
@AlexanderZ-Band
AlexanderZ-Band deleted the feat/remove-wall-clock-scheduling-assumptions-from-boun-INT-1845 branch October 20, 2026 19:29
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit that referenced this pull request Oct 20, 2026
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