Skip to content

Codex/multi profile#41

Open
tifroz wants to merge 36 commits intoskiptools:mainfrom
tifroz:codex/multi-profile
Open

Codex/multi profile#41
tifroz wants to merge 36 commits intoskiptools:mainfrom
tifroz:codex/multi-profile

Conversation

@tifroz
Copy link
Contributor

@tifroz tifroz commented Mar 12, 2026

  • Added first-class WebProfile support (.default / .named(String)) and WebProfileError handling across WebEngineConfiguration and runtime operations.
  • Implemented per-profile storage behavior:
    • iOS: named profiles map to dedicated WKWebsiteDataStore instances.
    • Android: named profiles use AndroidX WebKit multi-profile APIs with runtime gating (MULTI_PROFILE) and explicit failure when unsupported/invalid (no silent fallback).
  • Spawned children inherit the parent profile by default

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Codex-generated code under supervision, tested from a native sandbox app on iOS + Android


@cla-bot cla-bot bot added the cla-signed label Mar 12, 2026
@tifroz
Copy link
Contributor Author

tifroz commented Mar 13, 2026

@marcprux I keep running into either one of these 2 issues - I am not well-versed in GitHub Action environments, but it does seem like an issue with the test environment, not a problem with the test code or feature code.

It looks like it might a fluke, maybe running into quotas or just the GH infrastructure being overtaxed? I gave it a rest overnight, but same behavior this morning

Specifically:

Test iOS
The requested device could not be found because no available devices matched the request.

Cache Android emulator snapshot
Error: Timeout waiting for emulator to boot.

@marcprux
Copy link
Member

The requested device could not be found because no available devices matched the request.

This is a rather notorious intermittent issue with running tests in GitHub actions. It has always been a problem, but it recently started occurring more frequently. My solution has always been to just re-run the CI job (or issue a bogus commit to trigger the CI again in the case of a PR where you don't have permission to re-start it).

As it happens, I've found that simple running xcrun simctl list devices available before trying to run the iOS tests can often (always?) mitigate the issue, and this is included in a current outstanding PR (skiptools/actions#8) for the workflow: https://github.com/skiptools/actions/pull/8/changes#diff-89d228b0889c90902b8b3456f645db037183620fd7db4905984e67eab976a7b0R160

…but it needs a bit more work before it can be merged (since it includes some other improvements).

So for the time being, I'm afraid you'll just need to re-run the CI when you hit that particular glitch 🫤

@tifroz
Copy link
Contributor Author

tifroz commented Mar 14, 2026

Does the Android environment error fall into the same "just retry" category? (Error: Timeout waiting for emulator to boot.)

I have force-run the CI test a dozen times over the last couple of days, but fell into the Android environment error every time I am lucky enough to escape the iOS environment issue curse (every ~4 attempts).

Meanwhile the main branch CI Action completed successfully 3 times out of 4 in the same timeframe - which would suggest there is something different about the PR branch CI environment?

Really baffling :( I'd welcome any insight

@tifroz
Copy link
Contributor Author

tifroz commented Mar 16, 2026

@marcprux The original iOS + Android environment errors are no longer affecting the CI environment (at least for now), but I am now consistently hitting a hardware compatibility issue in the Android CI environment (HVF error: HV_UNSUPPORTED see below).

To my knowledge there is nothing in the new code that would have this effect? I have limited understanding of how hardware selection works in the GH Actions, but this really looks like an Action issue

I looked at the logs for the scheduled CI Action running on main: it is using a cached emulator image, while the CI Action for my PR is trying to spawn a new emulator from scratch and hitting this issue. So at least in this respect they are following completely different paths

...
emulator-28-medium_phone
[✓] List available AVDs (0.03s)
note: launching tool:  /Users/runner/Library/Android/sdk/emulator/emulator @emulator-28-medium_phone -no-metrics -no-window -no-boot-anim -logcat *:D
INFO         | Android emulator version 36.4.10.0 (build_id 15004761) (CL:N/A)
INFO         | Graphics backend: gfxstream
INFO         | Found systemPath /Users/runner/Library/Android/sdk/system-images/android-28/google_apis/arm64-v8a/
HVF error: HV_UNSUPPORTED
qemu-system-aarch64-headless: failed to initialize HVF: Invalid argument
Error: signalled(9): /Users/runner/Library/Android/sdk/emulator/emulator @emulator-28-medium_phone -no-metrics -no-window -no-boot-anim -logcat *:D output:

@marcprux
Copy link
Member

Yeah, this is a new issue we're hitting since I updated (skiptools/actions#8) the workflow actions to use the new skip android emulator create/launch commands added in skiptools/skip#574 (and with follow-ups in skiptools/skipstone#194 and skiptools/skipstone#200).

I was too hasty in merging that and making it the default runner mode. I just reverted back to using the older ReactiveCircus launcher (which has its own set of issues, but at least is more mature and stable) and made a new release v1.6.13 of the actions, so your next push should at least use the more stable runner for testing. Let me know if you continue running into the errors.

Sorry for the trouble; I know it can be frustrating to run into CI issues like this.

Copy link
Member

@marcprux marcprux left a comment

Choose a reason for hiding this comment

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

This is looking good! Once we manage to get CI to pass, I'll go ahead and merge.

}
}

@MainActor private func webKitDataStoreIdentifier(for identifier: String) -> UUID? {
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain this? Is there some reason the identified needs to go from a String to a SHA1 hash to a fixed UUID? Is this just to derive a deterministic UUID from the String identifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to derive a deterministic UUID from the String identifier.

If I remember correctly there was a little bit gymnastics required because the UUID is not bridge-friendly but the required identifier type for iOS's WKWebsiteDataStore

tifroz added 23 commits March 18, 2026 15:35
…g androidTest

Added a Kotlin @BeforeClass hook via SKIP INSERT in SkipWebTests.swift (line 16) to ensure Build.FINGERPRINT is set when missing.
Implemented the Robolectric call via reflection (Class.forName("org.robolectric.shadows.ShadowBuild")) so the generated code compiles in both unit-test and instrumented-test source sets.
This prevents Compose test initialization crashes in Robolectric (Build.FINGERPRINT == null) while avoiding direct org.robolectric compile-time dependency in androidTest.
…dependent tests when isRobolectric == true, and to skip before calling those APIs.
…or failures

Wrap rect/width snapshot capture in a timeout guard and skip only transient simulator-side failures (WKErrorDomain Code=1 / timeout) seen under CI load, while preserving normal assertions when snapshots succeed.
… propagation on slower or noisy CI simulators, causing intermittent false negatives.

Add a bounded polling helper (awaitCookieHeaderContains) and use it in:
- testIOSNamedProfileIsolatesCookiesAcrossDifferentProfiles
- testIOSNamedProfileSharesCookiesAcrossEnginesWithSameIdentifier

Behavioral intent is unchanged:
- still requires cookie presence in the expected profile
- still fails on cross-profile leakage
- now includes clearer assertion context (observed headers) for CI diagnostics
@tifroz tifroz force-pushed the codex/multi-profile branch from 77b3f26 to 08e42da Compare March 18, 2026 22:35
@tifroz
Copy link
Contributor Author

tifroz commented Mar 19, 2026

I keep consistently hitting this HVF error: HV_UNSUPPORTED eventually followed by Error: Timeout waiting for emulator to boot in the Generate ReactiveCircus Android emulator snapshot phase :(

@marcprux any ideas? I think we can exclude random glitches as an explanation given the consistency

From GH Action logs

...
Run reactivecircus/android-emulator-runner@v2
Configure emulator
Install Android SDK
Create AVD
Launch Emulator
  Starting emulator.
  /bin/sh -c \/Users/runner/Library/Android/sdk/emulator/emulator -port 5554 -avd stable_default_28 -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none &
  INFO         | Android emulator version 36.4.10.0 (build_id 15004761) (CL:N/A)
  INFO         | Graphics backend: gfxstream
  INFO         | Found systemPath /Users/runner/Library/Android/sdk/system-images/android-28/default/arm64-v8a/
  HVF error: HV_UNSUPPORTED
  qemu-system-aarch64-headless: failed to initialize HVF: Invalid argument
  /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
  * daemon not running; starting now at tcp:5037
  * daemon started successfully
  adb: device 'emulator-5554' not found
  The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
  /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
  adb: device 'emulator-5554' not found
  The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
  /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
  adb: device 'emulator-5554' not found
  The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
  /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
  adb: device 'emulator-5554' not found
  The process '/Users/runner/Library/Android/sdk/platform-tools/adb' failed with exit code 1
  /Users/runner/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop sys.boot_completed
  adb: device 'emulator-5554' not found
...
[goes on until giving up]

@marcprux
Copy link
Member

This is looking good to me now that CI passes. How much local testing of this have you done? Are you confident that it is ready to go?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants