Repository navigation
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
1 issue found across 3 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="packages/platform-android/src/app-lifecycle.ts">
<violation number="1" location="packages/platform-android/src/app-lifecycle.ts:555">
P2: Both fences can still succeed after expiry when an in-flight probe returns “not foreground” or “no process” after the deadline; the early return bypasses this timeout. Check the deadline after each awaited probe before accepting success, so relaunch refuses when the fence expires.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| if (foreground?.package !== packageName) return; | ||
| await sleep(ANDROID_CLOSE_FOCUS_POLL_MS); | ||
| } | ||
| throw new AppError( |
There was a problem hiding this comment.
P2: Both fences can still succeed after expiry when an in-flight probe returns “not foreground” or “no process” after the deadline; the early return bypasses this timeout. Check the deadline after each awaited probe before accepting success, so relaunch refuses when the fence expires.
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 packages/platform-android/src/app-lifecycle.ts, line 555:
<comment>Both fences can still succeed after expiry when an in-flight probe returns “not foreground” or “no process” after the deadline; the early return bypasses this timeout. Check the deadline after each awaited probe before accepting success, so relaunch refuses when the fence expires.</comment>
<file context>
@@ -552,6 +552,16 @@ async function waitForAndroidPackageNotForeground(
if (foreground?.package !== packageName) return;
await sleep(ANDROID_CLOSE_FOCUS_POLL_MS);
}
+ throw new AppError(
+ 'COMMAND_FAILED',
+ `Android app ${packageName} remained foreground after close`,
</file context>
|
Reviewed 5d05dc2. I found no problems in the change: an expired close fence is now a typed refusal, and The open cubic P2 thread on the deadline at Not blocking, take or leave: CI is green and there are no conflicts. The exact-head Android live job covers the confirmed-close relaunch path; the refusal branch is covered by unit tests. The PR can merge after its stacked base #3560. |
Summary
Android close could report success after its two-second foreground or process fence expired. Consequently,
agent-device open settings --relaunchcould launch without establishing that Settings stopped. Both fences now return typedCOMMAND_FAILED/android-app-close-timeoutwith phase, package and budget details. Relaunch stops before open or observation after refusal.Three files; existing budgets, polling and stable-process checks remain. Related to #3077, stacked on #3560. This enforces the existing restart promise; it does not diagnose native persistence or decide readiness.
Validation
Tested head:
5d05dc21eb6873d666326305a78b9ab1aff437c4.Same focused command:
pnpm exec vitest run --project unit-core packages/platform-android/src/__tests__/app-lifecycle-open.test.ts packages/platform-android/src/lifecycle.test.ts.30942efb5d05dc21Fresh install/build, format, Fallow, independent review and exact affected gate pass: 355 related files / 2,379 tests. CI: 16 passed, one skipped, including Coverage and Integration.
Android live passes full fixtures and 6/6 ordinary cases, 87 actions, first attempts, zero healing; seven Settings relaunches complete close before launch. Native stopped-state logs and live timeout refusal were absent; refusal is regression-test evidence. Separate iOS startup preflight fails, so the whole manual workflow is not green. Cleanup is observed; post-shutdown host leases are unobserved.