Skip to content

fix(ios): match alert labels through the OS prompt strings of the preferred languages - #4006

Merged
thymikee merged 1 commit into
callstack:mainfrom
kazutoyo:fix/ios-alert-localized-vocabulary
Oct 28, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
kazutoyo:fix/ios-alert-localized-vocabulary

Conversation

@kazutoyo

@kazutoyo kazutoyo commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Since #3715, the iOS XCUITest runner taps only listed English labels. On a Japanese simulator, alert dismiss on the notification prompt 許可しない / 許可 fails with ALERT_BUTTON_NOT_FOUND.

The runner now reads the OS's own notification, privacy (including ATT), and location prompt strings once at startup. It pairs each English value with the same key in every preferred language. A localized label then matches through the English labels it translates. These are Apple's own translations, not guesses (#3627):

  • a source must be a whole button label;
  • a translation that reads as an English label keeps its English meaning;
  • a translation claimed by both actions stays unknown;
  • unreadable tables leave the English vocabulary in place.

#3922's localized launch confirmation (Ouvrir) stays uncovered: its strings are not read.

8 files. Scope: iOS simulators; physical iOS, tvOS, and visionOS keep English labels. Limrun iOS stays English-only: tree capture cannot read device string tables.

Validation

Head f6cfbb215 (base b396bd009), tree-identical to checked d28809ed8.

  • check:affected --run --head d28809ed8 (run-N8cSYR, exactCommit=true): all pass except help-conformance-sample-outputs (4, identical on base) and 4 host-load timeouts (7/7 on rerun).
  • Runner XCTest: 15 alert tests pass; macOS and device runners build.
  • Live ja-JP/en-US evidence:
    • notification dismiss → denied;
    • location accept → authorizedWhenInUse;
    • ATT dismiss → TCC auth_value=0;
    • an unknown lone button refuses with dispatched: no.

Risks: the string-table locations are undocumented and may move. If any table fails to read, matching degrades to English-only refusal and logs AGENT_DEVICE_RUNNER_ALERT_VOCABULARY_UNAVAILABLE.

View guided diff

…ferred languages

On a non-English iOS simulator, `alert accept`/`dismiss` refused system
permission prompts such as Japanese 「許可しない」 with ALERT_BUTTON_NOT_FOUND,
because the runner only recognized English labels since callstack#3715.

The runner now reads the OS's own notification, privacy (including App
Tracking Transparency), and location prompt strings once, pairs each English
value with the same key in every preferred language, and matches a localized
label through the English labels it translates. Matching stays exact: a
source must be a whole button label, a translation that reads as an English
label keeps its English meaning, and one claimed by both actions stays
unknown (callstack#3627). Unreadable tables leave the English vocabulary in place.
Limrun iOS stays English-only because its tree capture cannot read the
device's string tables.
@vercel

vercel Bot commented Oct 28, 2026

Copy link
Copy Markdown

@kazutoyo is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@kazutoyo

kazutoyo commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Live evidence at d28809ed8

The runner was built from the head with pnpm build:xcuitest:ios. The simulator is a dedicated iPhone 17 Pro on iOS 26.5. A minimal UIKit app (dev.local.promptlab) raises one real system prompt per launch argument and shows the app-side callback in an outcome: label. The app was reinstalled before each case, so every case starts from notDetermined.

Lang Prompt Command Button the runner activated App callback OS record
ja-JP Notifications alert dismiss 許可しない granted=false BulletinBoard authorizationStatus=1 (denied)
ja-JP Location alert accept アプリの使用中は許可, over 1度だけ許可 authorizedWhenInUse —
ja-JP ATT alert dismiss アプリにトラッキングしないように要求 status=2 (denied) TCC kTCCServiceUserTracking auth_value=0
ja-JP Unknown lone button 謎のボタン alert dismiss none: ALERT_BUTTON_NOT_FOUND, dispatched: no; alert get still lists it waiting —
en-US ATT alert dismiss Ask App Not to Track status=2 TCC auth_value=0
en-US Notifications alert dismiss Don’t Allow granted=false authorizationStatus=1

The "Button the runner activated" column comes from the runner's AGENT_DEVICE_RUNNER_ALERT_ACTIVATION action=… label=… log lines. For example:

AGENT_DEVICE_RUNNER_ALERT_ACTIVATION action=accept label=アプリの使用中は許可 frame=(57.0,484.0,288.0,48.0) point=(201.0,508.0)
AGENT_DEVICE_RUNNER_ALERT_ACTIVATION action=dismiss label=アプリにトラッキングしないように要求 frame=(57.0,522.7,288.0,48.0) point=(201.0,546.7)

Before / after (ja-JP):

Notifications Location ATT Unknown
ja notification prompt before ja location prompt before ja ATT prompt before ja unknown-button prompt before
ja notification prompt after ja location prompt after ja ATT prompt after ja unknown-button prompt after

Before the location case, the evidence script runs xcrun simctl privacy <udid> reset location. Without it, CoreLocation sometimes did not answer the first launches after a language-switch reboot.

Cleanup: I closed every session and stopped the dedicated --state-dir daemon with --clean. I touched no other device or session.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertLabelVocabularyTests.swift">

<violation number="1" location="apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertLabelVocabularyTests.swift:53">
P3: No test covers the unreadable-table fallback. Add a case that makes `fromSystemStrings` see a missing table and asserts English-only matching. The all-tables-or-none rule also needs coverage.</violation>
</file>

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Re-trigger cubic

}
#endif

#if AGENT_DEVICE_RUNNER_UNIT_TESTS && os(iOS) && targetEnvironment(simulator)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: No test covers the unreadable-table fallback. Add a case that makes fromSystemStrings see a missing table and asserts English-only matching. The all-tables-or-none rule also needs coverage.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertLabelVocabularyTests.swift, line 53:

<comment>No test covers the unreadable-table fallback. Add a case that makes `fromSystemStrings` see a missing table and asserts English-only matching. The all-tables-or-none rule also needs coverage.</comment>

<file context>
@@ -0,0 +1,83 @@
+}
+#endif
+
+#if AGENT_DEVICE_RUNNER_UNIT_TESTS && os(iOS) && targetEnvironment(simulator)
+extension RunnerTests {
+  /// The OS's own strings supply the translations: a Japanese device words the notification,
</file context>

@thymikee

Copy link
Copy Markdown
Member

The code looks good at f6cfbb2, and I found no blocking problems. Not blocking, and fine to take or leave: the alert vocabulary reads three private-framework .strings paths, and if one is missing on an older simulator runtime, it silently falls back to English (RunnerAlertLabelVocabulary.swift#L42). Only iOS 26.5 was run live, so you could note the verified runtime in the PR body or spot-check the oldest supported one. The live run was at d28809ed8, which I could not find, so I could not confirm it matches this head. No live run used two preferred languages. The cross-language collision filter was checked by reading the code only.

The open inline thread on the missing fallback test still applies as a low-priority note: #4006 (comment)

The only check that did not pass is Vercel. Its bot comment says a Callstack team member must authorize the deployment for a fork, so this looks unrelated to the change. No runner, daemon, or unit CI ran on this fork PR. There are no conflicts. Before merge, a maintainer needs to approve the fork workflow run so the runner and unit jobs run, and authorize or ignore the Vercel preview.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 28, 2026
@thymikee
thymikee merged commit 1b5a3d4 into callstack:main Oct 28, 2026
14 of 15 checks passed
thymikee added a commit that referenced this pull request Oct 28, 2026
* origin/main: (76 commits)
  fix(open): refuse --launch-console on a provider-owned device before the relaunch close (#3938)
  fix(test-app): keep the inert surface control above the settings fold (#3993)
  fix(fill): redact the read-back of a sensitive fill (#4014)
  fix(apple): read the runner cache toolchain key from Xcode's own files (#3995)
  docs: point stable test suites to e2e (#4010)
  docs(mutation): state the file-name rule that marks test support code (#4011)
  refactor(kernel): read the Action Button leaf from isHandheldAppleDevice (#3988)
  fix(ios): match alert labels through the OS prompt strings of the preferred languages (#4006)
  fix(mutation): measure each kernel against the tests that import it (#3994)
  fix(webdriver): avoid unused pre-tap focus geometry reads (#3997)
  refactor(apple): share coordinate drag execution (#4003)
  fix(apple): type a text-entry-trait element as a text input in the simulator AX tree (#4008)
  refactor(contracts): own the unsupported-interactor stub both platforms duplicated (#4002)
  refactor: reuse canonical device identity projections (#3996)
  refactor(apple): share simulator status-bar diagnostics (#3998)
  refactor(runtime): share host command runner construction (#3999)
  refactor(android): centralize session error encoding (#4000)
  chore: mark 0.21.33 as released
  chore(gates): detect new native duplication with jscpd (#3980)
  fix(android): publish the Compose role on its clickable parent instead of a fake child (#3983)
  ...
thymikee added a commit to janjankowski-cs/agent-device that referenced this pull request Oct 28, 2026
* base-3865: (76 commits)
  fix(open): refuse --launch-console on a provider-owned device before the relaunch close (callstack#3938)
  fix(test-app): keep the inert surface control above the settings fold (callstack#3993)
  fix(fill): redact the read-back of a sensitive fill (callstack#4014)
  fix(apple): read the runner cache toolchain key from Xcode's own files (callstack#3995)
  docs: point stable test suites to e2e (callstack#4010)
  docs(mutation): state the file-name rule that marks test support code (callstack#4011)
  refactor(kernel): read the Action Button leaf from isHandheldAppleDevice (callstack#3988)
  fix(ios): match alert labels through the OS prompt strings of the preferred languages (callstack#4006)
  fix(mutation): measure each kernel against the tests that import it (callstack#3994)
  fix(webdriver): avoid unused pre-tap focus geometry reads (callstack#3997)
  refactor(apple): share coordinate drag execution (callstack#4003)
  fix(apple): type a text-entry-trait element as a text input in the simulator AX tree (callstack#4008)
  refactor(contracts): own the unsupported-interactor stub both platforms duplicated (callstack#4002)
  refactor: reuse canonical device identity projections (callstack#3996)
  refactor(apple): share simulator status-bar diagnostics (callstack#3998)
  refactor(runtime): share host command runner construction (callstack#3999)
  refactor(android): centralize session error encoding (callstack#4000)
  chore: mark 0.21.33 as released
  chore(gates): detect new native duplication with jscpd (callstack#3980)
  fix(android): publish the Compose role on its clickable parent instead of a fake child (callstack#3983)
  ...
strzhao added a commit to strzhao/agent-device-upstream that referenced this pull request Nov 23, 2026
… device

On a physical iOS device, `alert accept`/`dismiss` refused a Chinese
permission prompt with ALERT_BUTTON_NOT_FOUND, because the label
vocabulary is only the OS prompt strings of a simulated OS (callstack#4006): a
device's runtime keeps its framework string files from the runner
process, so the non-simulator build compiled `system` as the English
vocabulary.

The device build now carries a built-in table of the system prompts'
Simplified Chinese wording instead: the notification, App Tracking
Transparency, and location prompts' buttons, the general-purpose 好/取消
pair, and the launch confirmation's 打开. Each entry pairs an English
button label with its localized wording, so the localized label ranks
exactly like the English original — 仅在使用期间允许 outranks 仅本次允许.
The callstack#3627 guards hold unchanged: a source must be a whole button label,
and a translation both actions claim stays unknown. English resolution
is untouched, and the simulator keeps reading the OS strings for every
preferred language. The table grows only with wording a device really
shows, so it starts at Simplified Chinese and other languages stay
unknown until device evidence names them.

Co-Authored-By: Claude Code <noreply@anthropic.com>
thymikee pushed a commit that referenced this pull request Nov 24, 2026
… device (#4859)

* fix(ios): recognize the system prompts' Chinese wording on a physical device

On a physical iOS device, `alert accept`/`dismiss` refused a Chinese
permission prompt with ALERT_BUTTON_NOT_FOUND, because the label
vocabulary is only the OS prompt strings of a simulated OS (#4006): a
device's runtime keeps its framework string files from the runner
process, so the non-simulator build compiled `system` as the English
vocabulary.

The device build now carries a built-in table of the system prompts'
Simplified Chinese wording instead: the notification, App Tracking
Transparency, and location prompts' buttons, the general-purpose 好/取消
pair, and the launch confirmation's 打开. Each entry pairs an English
button label with its localized wording, so the localized label ranks
exactly like the English original — 仅在使用期间允许 outranks 仅本次允许.
The #3627 guards hold unchanged: a source must be a whole button label,
and a translation both actions claim stays unknown. English resolution
is untouched, and the simulator keeps reading the OS strings for every
preferred language. The table grows only with wording a device really
shows, so it starts at Simplified Chinese and other languages stay
unknown until device evidence names them.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(ios): shed the alert search keyword the description now carries

The device-coverage sentence puts the word "system" in the alert
description, so the "dialog system" search hint no longer adds a word
the text lacks; `command-tools-loading-meta`'s hint contract fails on
the repeat. "system" stays searchable through the description itself,
so the hint keeps "dialog" only.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(ios): pin the device table's zh_CN rows to the pairs iOS ships

The three hand-typed rows drifted from Apple's zh_CN wording (使用App时允许,
允许一次, 要求App不追踪): on a zh-Hans device the location accept and the ATT
dismiss matched no row and answered ALERT_BUTTON_NOT_FOUND. The rows now
equal the OS strings, and a simulator-lane test pins every deviceTranslations
row to a pair in fromSystemStrings(["zh-Hans"]) so the table cannot drift
from the OS wording again; the vocabulary keeps the handed-in rows for it.

* fix(ios): carry both zh_CN wordings of the ATT decline the shipped iOS versions show

A zh-Hans iPhone 12 Pro Max on iOS 18.1 words the ATT decline 要求App不跟踪;
the iOS 26.5-27.x zh_CN string tables the earlier simulator check pinned ship
要求App不追踪. The table carried only the newer wording, so alert dismiss on
the device answered ALERT_BUTTON_NOT_FOUND having tapped nothing. The table
now carries both rows, the zh-Hans pairs test keeps asserting every row equals
a pair this lane's OS ships except the cross-version wording it pins by
presence, and the device evidence doc records the three prompts' verbatim
alert get labels with the accept/dismiss outcomes and authorization
read-backs. A probe read on the device also answers the review's question:
the OS string tables are present on device but their localizations are not
readable, so widening the OS-string read to os(iOS) cannot replace the table.

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: strzhao <strzhao@users.noreply.github.com>
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.

2 participants