From 1a7d26da6e39cc1bb6c0dc4426040038b36bc62f Mon Sep 17 00:00:00 2001 From: Sambit Biswas Date: Tue, 24 Nov 2026 08:38:10 -0500 Subject: [PATCH 1/3] Release a held fixture request even when it arrives late releaseHeldRequest() only completed a request that was already held. A request that arrived after the test's release stayed held with nobody to release it, so a slow simulator turned a 2 s wait into a stall until the URLSession timeout. Release now ends the hold, and each AidenChatTests test starts by resetting the fixture's holds, overrides and open stream. --- ios/AidenOnTheGoTests/AidenChatTests.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ios/AidenOnTheGoTests/AidenChatTests.swift b/ios/AidenOnTheGoTests/AidenChatTests.swift index 3dd59d585..4443e440e 100644 --- a/ios/AidenOnTheGoTests/AidenChatTests.swift +++ b/ios/AidenOnTheGoTests/AidenChatTests.swift @@ -22,6 +22,9 @@ final class AidenChatTests: XCTestCase { override func setUp() { super.setUp() AidenChatProgressLifecycleURLProtocol.beginTestEpoch() + // A test that ended early can leave an armed hold, override, or open + // event stream behind; the next test starts without them. + AidenChatProgressLifecycleURLProtocol.reset() storageRoot = FileManager.default.temporaryDirectory.appending(path: "aiden-chat-tests-\(UUID())") preferenceSuite = "AidenChatTests.\(UUID().uuidString)" testCache = AidenChatCache(root: storageRoot.appending(path: "cache")) @@ -11917,7 +11920,21 @@ private final class AidenChatProgressLifecycleURLProtocol: URLProtocol, @uncheck } } - static func releaseHeldRequest() { takeHeldRequest()?() } + /// Ends the hold: a request already held completes, and one that has not + /// arrived yet is no longer held when it does. Otherwise a request that + /// arrives after the test's release, as on a slow simulator, stays parked + /// with nobody left to release it, and the test waits on it until the + /// session's request timeout. + static func releaseHeldRequest() { + let completion = lock.withLock { + heldPathSuffix = nil + onHeldRequest = nil + let held = heldCompletion + heldCompletion = nil + return held + } + completion?() + } static var progressRequestCount: Int { lock.lock() From dfdaf8fca72fe5e4708270af3eeff9ba31944da4 Mon Sep 17 00:00:00 2001 From: Sambit Biswas Date: Tue, 24 Nov 2026 08:38:14 -0500 Subject: [PATCH 2/3] Run iOS XCTest on one simulator in CI Two parallel clones on the 3-core, 7 GB hosted runner took 6-9 minutes to boot, stalled whole test processes for minutes, and sometimes never launched, hanging the job until its 50-minute limit. The suite's summed test time is below the clones' wall time. Both iOS jobs now pass -parallel-testing-enabled NO. --- .github/workflows/ci.yml | 10 ++++++++ docs/ci.md | 41 +++++++++++++++++++++++++++++++- scripts/check-ci-policy.test.mjs | 4 ++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 260706d79..c8fd240b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -417,6 +417,10 @@ jobs: -derivedDataPath '${{ runner.temp }}/AidenOnTheGoDerivedData' -clonedSourcePackagesDirPath '${{ runner.temp }}/AidenOnTheGoSourcePackages' CODE_SIGNING_ALLOWED=NO + # One simulator, no clones. On the 3-core, 7 GB hosted runner two clones + # took 6-9 minutes to boot, stalled whole test processes for minutes, and + # sometimes never launched, which hung the step until the job timed out. + # The suite's summed test time is below what the clones took end to end. - name: Run Aiden On The Go XCTest on the simulator run: >- xcodebuild test-without-building -quiet @@ -428,6 +432,7 @@ jobs: -clonedSourcePackagesDirPath '${{ runner.temp }}/AidenOnTheGoSourcePackages' -resultBundlePath '${{ runner.temp }}/AidenOnTheGoSimulator.xcresult' -skip-testing:AidenOnTheGoUITests + -parallel-testing-enabled NO CODE_SIGNING_ALLOWED=NO # Cover the demo launch matrix and pairing through the unpaired shell. @@ -539,6 +544,10 @@ jobs: -derivedDataPath '${{ runner.temp }}/AidenOnTheGoDerivedData' -clonedSourcePackagesDirPath '${{ runner.temp }}/AidenOnTheGoSourcePackages' CODE_SIGNING_ALLOWED=NO + # One simulator, no clones. On the 3-core, 7 GB hosted runner two clones + # took 6-9 minutes to boot, stalled whole test processes for minutes, and + # sometimes never launched, which hung the step until the job timed out. + # The suite's summed test time is below what the clones took end to end. - name: Run Aiden On The Go XCTest on the simulator run: >- xcodebuild test-without-building -quiet @@ -550,6 +559,7 @@ jobs: -clonedSourcePackagesDirPath '${{ runner.temp }}/AidenOnTheGoSourcePackages' -resultBundlePath '${{ runner.temp }}/AidenOnTheGoSimulator.xcresult' -skip-testing:AidenOnTheGoUITests + -parallel-testing-enabled NO CODE_SIGNING_ALLOWED=NO # Cover the demo launch matrix and pairing through the unpaired shell. diff --git a/docs/ci.md b/docs/ci.md index 9b85618c0..ec40de39a 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -53,7 +53,8 @@ superseded. Runner capacity can still cause queueing. - Apple Foundation Models tests run in their own job. The `ios` job resolves Swift packages into a cached directory keyed on `Package.resolved`, builds for testing once for the generic device and once for the simulator, then runs - `test-without-building` against the shared DerivedData. iOS-only changes also + `test-without-building` against the shared DerivedData on one simulator, + with parallel clones off. iOS-only changes also run shipping and TestFlight policies in that job; full desktop runs execute them through the preserved regression lane. - Four desktop lanes use `scripts/ci-test-registry.json`. GitHub allows five @@ -404,6 +405,44 @@ showed `settingsPrepared:false`. startup milestones the bootstrap recorded, so a later hang shows how far launch got. +On 2026-11-24 the blocking iOS job was failing or hanging on `main` (job +138014789163) and on PRs that touch no iOS code (#890, #900, #901, #904, #915). +Different tests failed each time, and every failing test had stalled for +minutes on a test that takes a fraction of a second locally: + +- `AidenSandboxedHTMLTests.testAPreviewPageMakesNoNetworkConnections` ran + 192 and 345 seconds and missed a 30-second page load (jobs 138345806379, + 138355678757). +- `AidenNativeIntegrationTests.testReconcileEndsAnActivityFromAnOlderPairing` + ran 128 seconds; its in-memory demo machines took about 95 seconds to + connect, past the scheduler's 10-second probe (job 138386215673). +- `AidenChatTests.testUploadCleanupRevocationDoesNotDeadlockRemoval` ran 228 + and 596 seconds (job 138014789163, then an `IDERunOperation` crash in + xcodebuild, and #904's run 45340108118). +- #900's run 45336499109 hung after 2,512 passes with both clones silent until + the 50-minute limit, and #890's run had a clone time out connecting to + `com.apple.instruments.deviceservice.lockdown`. + +Two causes were fixed: + +- The XCTest step ran two parallel simulator clones on the 3-core, 7 GB hosted + runner. The clones took 6 to 9 minutes to boot before any test ran, and + then the suite took 1,360 to 1,550 seconds of wall time, more than the 759 + to 1,032 seconds its tests summed to. One test host grows to about 1.6 GB + over a local full run, so two of them plus WebKit content processes left + whole test processes stalled. The step now passes + `-parallel-testing-enabled NO` and runs one simulator, in both iOS jobs. + Local Xcode keeps the scheme's parallel setting. On one simulator the full + suite ran in 273 seconds locally (2,569 passed) with the host's load + average near 130. +- `AidenChatProgressLifecycleURLProtocol.releaseHeldRequest()` only completed + a request that had already been held. A request that arrived after the + test's release was still held, with nobody left to release it, so a test + whose request was late waited on it until the session's request timeout + instead of failing at its own short wait. Release now ends the hold, and + each `AidenChatTests` test starts by resetting the fixture's holds, + overrides and open stream. + Release workflows, signing/notarization, publication and repository protection settings remain unchanged. The previous draft's release-admission rewrite has been removed to keep release hardening separate from this CI rollout. diff --git a/scripts/check-ci-policy.test.mjs b/scripts/check-ci-policy.test.mjs index d17fd6c05..f0fb275a2 100644 --- a/scripts/check-ci-policy.test.mjs +++ b/scripts/check-ci-policy.test.mjs @@ -249,6 +249,10 @@ test("desktop E2E and unit work are sharded with independent Apple and iOS check assert.equal(simulatorResults.if, "failure()"); assert.equal(simulatorResults.uses, "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"); assert.ok(simulatorTest.run.includes("-skip-testing:AidenOnTheGoUITests"), "the unit run must not launch the UI target"); + assert.ok( + simulatorTest.run.includes("-parallel-testing-enabled NO"), + "simulator clones stall and hang the hosted runner; the unit run uses one simulator", + ); const shellSmoke = jobs.ios.steps.find((step) => step.run?.includes("-only-testing:AidenOnTheGoUITests/AidenShellUITests/testShellLaunchesForEveryScenario")); assert.ok(shellSmoke, "the shell UI smoke step is missing"); assert.ok(jobs.ios.steps.indexOf(shellSmoke) > jobs.ios.steps.indexOf(simulatorTest)); From 814a19d883193c94ea622694fca3d9a460d90ff4 Mon Sep 17 00:00:00 2001 From: Sambit Biswas Date: Tue, 24 Nov 2026 08:52:49 -0500 Subject: [PATCH 3/3] Cover a late request after release and both iOS jobs' serial flag A fixture test arms a hold, releases it before the request starts, and expects the request to be answered without a second release. It fails on the old releaseHeldRequest() and passes on the fix. The CI policy test now checks -parallel-testing-enabled NO in the ios-27 unit run too. --- ios/AidenOnTheGoTests/AidenChatTests.swift | 27 ++++++++++++++++++++++ scripts/check-ci-policy.test.mjs | 11 +++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ios/AidenOnTheGoTests/AidenChatTests.swift b/ios/AidenOnTheGoTests/AidenChatTests.swift index 4443e440e..dbc8ec2ce 100644 --- a/ios/AidenOnTheGoTests/AidenChatTests.swift +++ b/ios/AidenOnTheGoTests/AidenChatTests.swift @@ -6102,6 +6102,33 @@ final class AidenChatTests: XCTestCase { try await assertRemovalJoinsUploadCleanup(revokedCleanup: true) } + /// The fixture's release ends a hold whose request has not arrived yet, as + /// when a slow simulator delivers it after the test has moved on. + func testAReleasedHoldLetsALateRequestThrough() async throws { + let arrived = expectation(description: "the hold callback never runs after release") + arrived.isInverted = true + AidenChatProgressLifecycleURLProtocol.holdNextRequest(endingIn: "/late-release") { arrived.fulfill() } + AidenChatProgressLifecycleURLProtocol.releaseHeldRequest() + + let configuration = URLSessionConfiguration.ephemeral + configuration.protocolClasses = [AidenChatProgressLifecycleURLProtocol.self] + configuration.httpAdditionalHeaders = [ + AidenChatProgressLifecycleURLProtocol.epochHeader: AidenChatProgressLifecycleURLProtocol.epoch, + ] + let session = URLSession(configuration: configuration) + defer { session.invalidateAndCancel() } + let answered = expectation(description: "the late request is answered without a second release") + let task = session.dataTask(with: URL(string: "https://aiden.test/api/aiden/v1/late-release")!) { _, response, error in + XCTAssertNil(error) + XCTAssertEqual((response as? HTTPURLResponse)?.statusCode, 404) + answered.fulfill() + } + task.resume() + await fulfillment(of: [answered], timeout: 5) + await fulfillment(of: [arrived], timeout: 0.1) + XCTAssertTrue(AidenChatProgressLifecycleURLProtocol.heldRequestEpochs.isEmpty, "nothing was held") + } + @MainActor private func assertRemovalJoinsUploadCleanup(purging: Bool = false, revokedCleanup: Bool = false) async throws { let root = FileManager.default.temporaryDirectory.appending(path: "aiden-removed-upload-\(UUID())") diff --git a/scripts/check-ci-policy.test.mjs b/scripts/check-ci-policy.test.mjs index f0fb275a2..5dbffc881 100644 --- a/scripts/check-ci-policy.test.mjs +++ b/scripts/check-ci-policy.test.mjs @@ -249,10 +249,13 @@ test("desktop E2E and unit work are sharded with independent Apple and iOS check assert.equal(simulatorResults.if, "failure()"); assert.equal(simulatorResults.uses, "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"); assert.ok(simulatorTest.run.includes("-skip-testing:AidenOnTheGoUITests"), "the unit run must not launch the UI target"); - assert.ok( - simulatorTest.run.includes("-parallel-testing-enabled NO"), - "simulator clones stall and hang the hosted runner; the unit run uses one simulator", - ); + for (const job of ["ios", "ios-27"]) { + const unitRun = jobs[job].steps.find((step) => step.run?.includes("-skip-testing:AidenOnTheGoUITests")); + assert.ok( + unitRun?.run.includes("-parallel-testing-enabled NO"), + `${job}: simulator clones stall and hang the hosted runner; the unit run uses one simulator`, + ); + } const shellSmoke = jobs.ios.steps.find((step) => step.run?.includes("-only-testing:AidenOnTheGoUITests/AidenShellUITests/testShellLaunchesForEveryScenario")); assert.ok(shellSmoke, "the shell UI smoke step is missing"); assert.ok(jobs.ios.steps.indexOf(shellSmoke) > jobs.ios.steps.indexOf(simulatorTest));