Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(ios): make custom-action reads atomically single-flight - #1749

Merged
thymikee merged 2 commits into
mainfrom
agent/fix-xctest-single-flight-timing
Aug 12, 2026
Merged

fix(ios): make custom-action reads atomically single-flight#1749
thymikee merged 2 commits into
mainfrom
agent/fix-xctest-single-flight-timing

Conversation

@thymikee

@thymikee thymikee commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

Keep custom-action AX reads truly single-flight under contention. Admission now atomically claims the only in-flight slot, and rejected reads return without queue dispatch, semaphore waiting, or synchronous per-refusal logging.

The regression asserts the production contract directly: five blocked admissions, one dispatched read, and one read still in flight. It no longer uses a wall-clock threshold.

Root cause

The previous admission split its check and increment across two atomic operations, so concurrent callers could both observe an empty slot before either claimed it. The blocked branch also logged synchronously, making the XCTest's elapsed-time assertion measure runner scheduling and log delivery rather than the no-work containment invariant.

The fix uses one compare-and-exchange for admission and exposes the blocked-admission count alongside the existing dispatch and in-flight counters.

Validation

  • Planted red: the targeted regression failed with blocked admissions 0 instead of 5 before production incremented the new counter.
  • Targeted testHungCustomActionReadIsContainedAndRecovers XCTest passed after the fix.
  • All seven custom-action XCTest regressions from the iOS smoke step passed.
  • pnpm check:affected --run passed; the Swift runner build/smoke lanes remain GitHub-authoritative.

Three files changed within the existing Apple runner snapshot module. No docs or skills changed because the public command behavior and guidance are unchanged.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.18 MB 2.18 MB +10 B
JS gzip 712.0 kB 712.0 kB +3 B
npm tarball 838.3 kB 838.3 kB +21 B
npm unpacked 2.92 MB 2.92 MB +107 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 29.1 ms 29.1 ms +0.0 ms
CLI --help 71.9 ms 72.9 ms +1.0 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/internal/daemon.js +10 B +3 B

@thymikee

Copy link
Copy Markdown
Member Author

Reviewed exact head e7b02cad. P2 regression validity: raising the repeat bound to 1.5s exceeds the production AX read deadline of 1.0s, so the test can now admit a full-deadline refusal regression while still claiming repeats “return immediately instead of paying the deadline.” A planted 1.0–1.4s stall before the atomic refusal would pass.

The exact in-flight and dispatch-count assertions remain strong for the real no-work containment invariant: removing the guard would enqueue additional reads and fail those counts. Please choose and test one contract deterministically:

  • If the contract is “blocked captures add no AX work,” remove the misleading wall-clock/immediate claim and expose/assert an explicit blocked admission result or blocked counter alongside unchanged dispatch/in-flight state.
  • If bounded refusal latency is itself required, expose an injectable refusal/logging seam and prove the blocked branch performs no semaphore wait or queue dispatch. Do not use an XCTest wall-clock threshold equal to or greater than the downstream timeout.

The observed 1.1s old red demonstrates that the 0.2s wall-clock assertion is contention-sensitive; it does not validate 1.5s as a latency regression bound. The current failed Android smoke is unrelated to this Swift-test-only diff: API 36 live E2E failed with Active application interaction viewport is unavailable, an Android helper/device-state flake that should be rerun. Remaining pending authoritative lanes still gate merge.

@thymikee thymikee changed the title fix(ios): relax custom-action refusal timing assertion fix(ios): make custom-action reads atomically single-flight Aug 12, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Addressed in ae9a6c707 by replacing the timing contract with deterministic production bookkeeping.

  • Admission now uses one atomic compare-and-exchange instead of a separate load and increment.
  • Rejected admissions increment an explicit blocked counter and return without queue dispatch, semaphore wait, or synchronous per-refusal logging.
  • The regression asserts five blocked admissions, one dispatch, and one in-flight read; the wall-clock assertion and its long explanatory comment are gone.

Red/green evidence: before wiring the production blocked counter, the targeted XCTest failed with 0 blocked admissions instead of 5; after the fix it passes, as does the full seven-test custom-action subset.

I also checked #1767. It touches the fixture alert flow and live iOS alert smoke scenario only, so there is no file or behavior overlap with this AX custom-action single-flight fix.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Aug 12, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Exact-head re-review at ae9a6c70: code-clean and merge-ready. The prior timing-test finding is fixed at the owning interface rather than relaxed: admission is now one atomic compare-and-exchange, blocked reads increment an explicit refusal counter, and the regression deterministically proves five refusals with exactly one dispatch and one read still in flight. The wall-clock assertion and misleading immediate-return contract are gone; synchronous per-refusal logging is also removed from the blocked path. Red-before evidence is load-bearing (0 blocked admissions before production bookkeeping, 5 after), the full custom-action XCTest subset passes, and all authoritative exact-head checks—including iOS, Android, macOS, Linux, Coverage, Integration, Fallow, and Layering—are green. Branch is CLEAN/MERGEABLE. Applied ready-for-human.

@thymikee
thymikee merged commit 85aef7a into main Aug 12, 2026
28 checks passed
@thymikee
thymikee deleted the agent/fix-xctest-single-flight-timing branch August 12, 2026 10:53
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-12 10:54 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant