Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
41 changes: 40 additions & 1 deletion docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
46 changes: 45 additions & 1 deletion ios/AidenOnTheGoTests/AidenChatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -6099,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())")
Expand Down Expand Up @@ -11917,7 +11947,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() {
Comment thread
sambitcreate marked this conversation as resolved.
Resolved
let completion = lock.withLock {
heldPathSuffix = nil
onHeldRequest = nil
let held = heldCompletion
heldCompletion = nil
return held
}
completion?()
}

static var progressRequestCount: Int {
lock.lock()
Expand Down
7 changes: 7 additions & 0 deletions scripts/check-ci-policy.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +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");
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));
Expand Down
Loading