Repository navigation
fix(mobile): foreground the app once per Android app action intent - #11568
Conversation
|
bot: Emulator verification of the single-foreground behavior. The cold start-agent intent was exercised on a build of the merge base and on a build of this branch, with the same adb scenario. Logcat Base (merge base): two Head (this branch): one |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe follow-up commit only rewrites the Assumptions: Files Reviewed (2 files)
Previous Review Summary (commit cea7ffc)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit cea7ffc)Status: 1 Issue Found | Recommendation: Merge Executive SummaryThe single-foreground fix is correct: Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Reviewed by deepseek-flash-latest · Input: 37K · Output: 2.8K · Cached: 284.2K Review guidance: REVIEW.md from base branch |
|
bot: Re-ran the app-action intent scenarios on the current head of this branch, after the review round moved the head. Merge base and head were measured with the same commands on the same emulator, with a clean logcat buffer per scenario.
The attached capture is the app's own signed-out screen after the warm start-agent intent. |

Evidence
Evidence: demonstrated — the doubled foreground was reproduced on the Android emulator against a build of the merge base, and the fix was observed on a build of this branch through the same scenario.
adb shell am start -a com.kilocode.kiloapp.action.START_AGENTwith one intent): twoMainActivitylauncher starts in theActivityTaskManagerrecords, 4 ms apart, for that single request.MainActivitylauncher start.The merge-base and head runs used the same adb commands on the same emulator, with a clean logcat buffer per scenario and the launcher-activity start line counted in each buffer. The emulator kept the default display density.
Change
KiloActionActivity.handle()calledshowInApp()from two independent branches: one forisStartAgent(intent), and one whenAppActionDispatcher.dispatch(payload)returned false because the JS dispatcher had not registered yet and the payload was buffered. A start-agent request that arrived while the process was cold hit both branches and started the launcher activity twice.The fix resolves the intent once and foregrounds at most once:
KiloActionContract.resolve(intent)now returns aResolvedvalue carrying the contract slug and the JSON payload, replacing the separatepayload()andisStartAgent()lookups that each re-resolved the slug (slugOf) for the same intent.handle()holds the dispatch result in a local value and callsshowInApp()once, when the resolved slug is start-agent or when the dispatcher buffered the payload. Behavior is otherwise unchanged: a warm start-agent still opens the app, a buffered payload still opens it, and a dispatched non-start action only finishes.The shared JS contract remains the owner of the slugs; the native side still maps its action strings and URL dialect through the existing
SLUG_BY_ACTIONtable. The one source-reading test assertion that named the old call shape was updated; no other test text changed.Verification
pnpm exec vitest run modules/kilo-app-actions/inapps/mobile: 4 files, 254 tests pass.:kilo-app-actions:compileDebugKotlinsucceeds; the debug dev-client APK of the branch installs and runs on the emulator.adb logcatActivityTaskManagerstart records, with the app driven through the dev client and Metro serving the workspace bundle.Production prerequisites
None.