Skip to content

test(android): order the exhausted-budget read and wait for the held connector's completion; diagnose both (CI 44355808074, 44354309423) - #1071

Merged
egerev merged 2 commits into
mainfrom
bb/android-ci-settlement-thr_ngb3g9karf
Nov 18, 2026
Merged

egerev merged 2 commits into
mainfrom
bb/android-ci-settlement-thr_ngb3g9karf

Conversation

@egerev

@egerev egerev commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Two Android CI failures are test observations, not product defects. Both mechanisms are reproduced below. Which interleaving the CI runs actually hit is UNKNOWN: neither run kept the state at the moment of failure. Both tested Android trees (38f5b79 for #1065's queue run, 8a4e0af for #1066's head) are identical to main 02ff2f5. Production code is unchanged.

A. CI run 44355808074: test_exhausted_active_budget_refuses_due_input_before_any_native_preflight raised KeyError at line 566.

  • end() first retains the handle and budget, and only then makes the terminal state visible. The fake native child's timer is due 0.3 s after its check; locally about 0.21 s of that remains when finished() returns.
  • A slower test thread reads the budget after the wake was already admitted with its budget intact. That wake's native turn marks the obligation received. The next tick drops the handle (no refs) and, in the same tick, prunes the budget, which is the intended contract.
  • Fix (existing test, this function only): a scoped Supervision.tick gate. It is installed with monkeypatch before host(), so it is restored at teardown. It opens only after seconds_used = seconds_limit, in a finally. The 0.3 s delay, the caps and every native-preflight assertion are unchanged.

B. CI run 44354309423: test_an_ended_request_handle_never_reacquires_while_the_new_request_awaits_admission failed at line 68 (connector task pending).

  • ForwardJournal.close() commits the held row. Everything after that commit, up to the connector task's completion, is synchronous, so it happens in the same loop step.
  • The test polls SQLite from its own thread, so it can read the row inside that step.
  • Fix (line 68 only): keep ended.task == first and still require the task to complete, waiting for it with the existing until() and its 5 s bound. No other assertion, rig or timeout changes.

New diagnostic files (real lifecycle, synthetic native/ADB fakes, in-memory barriers):

  • test_budget_supervision_diagnostics.py gates the tick.
    • Exhausted first: the wake is refused with lease_unavailable, there are 0 native inputs and 1 turn.
    • Read late: the budget is absent, 0 handles, 1 native input, the obligation is received, the wake is accepted, 2 turns. This is line 566's KeyError.
  • test_usb_settlement_diagnostics.py holds the loop thread right after the held commit.
    • The row is visible: the first request's, matching the receipt, reason collection_cleanup_unconfirmed. The task is not done.
    • A loop callback queued at that point finds the task done right after that step. So there is no await window inside the connector.

Red/green on disk: the same private perturbations were used for both runs. The test thread reads 0.6 s after finished(), and the loop thread pauses 0.3 s after the held commit.

  • The pre-fix tests (937e7a8) fail exactly as in CI: the KeyError, and line 68's ... and False.
  • The fixed tests (82df802) pass.

The fixed budget test still catches a missing refusal. These are in-memory mutants:

  • Unmutated control: 0 wake admissions.
  • The exhaustion check removed in budget(): killed, with 117 wakes reaching native preflight.
  • authority() skipping budget(): killed, with 121 admissions.

Local runs: the touched USB and budget files pass (71/71), and so does the full Android suite (1063 passed, 1 skipped; the 4 test_screen_quality.py failures are this host lacking Tesseract ind, which the CI step installs and DEEDKIT_OCR_REQUIRED=1 demands). Ruff is clean.

Spec: ANYM-993, ANYM-997
Change path: AUTO (test-only ordering of two observations; no cap, deadline or contract change)
Review record: none (owner 11-11: no reviews)

🤖 Generated with Claude Code

egerev and others added 2 commits November 19, 2026 01:36
…d task read (CI 44355808074, 44354309423)

Two new diagnostic files, real lifecycle with the synthetic native/ADB fakes:
- A tick gate orders the budget read against the .3 s timer wake: exhausted
  first, the wake is refused lease_unavailable; read late, the wake was
  admitted, the obligation received and the budget pruned (KeyError).
- A barrier right after the 'held' forward commit shows the row visible to
  another thread while the connector task is still pending, and the task done
  right after that loop step: no await window in the connector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: egerev <egor@gosync.ai>
…for the held connector's completion

- test_exhausted_active_budget_refuses_due_input_before_any_native_preflight:
  a scoped Supervision.tick gate opens only after the budget is exhausted, so
  a runner slower than the .3 s timer cannot admit the wake first (CI run
  44355808074). Delay, caps and native-preflight assertions are unchanged.
- test_an_ended_request_handle_never_reacquires_while_the_new_request_awaits_admission:
  the 'held' commit precedes the connector task's completion in the same loop
  step, so the test still requires completion but waits for it within
  until()'s bound (CI run 44354309423).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: egerev <egor@gosync.ai>
@egerev egerev added the ship Small-fix rule: orchestrator Diff read at head; merge-keeper may enqueue label Nov 18, 2026
@egerev
egerev added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit a35709e Nov 18, 2026
33 checks passed
@egerev
egerev deleted the bb/android-ci-settlement-thr_ngb3g9karf branch November 18, 2026 18:19
egerev added a commit that referenced this pull request Nov 18, 2026
…ransliteration

Root granted this exact accepted main SHA (main CI 44368410370, publication 1616, exact sync B 44369454136) after
the earlier merge-group failure (run 44355808074, android test_order_supervision). The PR's own scope is unchanged:
packages/npm/test/base-url-boundaries.test.js and tests/test_people_transliteration_contract.py only.

Signed-off-by: egerev <egor@gosync.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
egerev added a commit that referenced this pull request Nov 18, 2026
Brings in #1071 (the accepted Android test ordering fix for the CI 44354309423 failure that stopped this PR's
previous head 8a4e0af). The branch's own change is unchanged: one new gateway test file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: egerev <egor@gosync.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ship Small-fix rule: orchestrator Diff read at head; merge-keeper may enqueue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant