fix(app): stabilize Android local runtime boot#2153
Conversation
ApprovabilityVerdict: Needs human review Unable to check for correctness in 85335e9. This PR fundamentally changes Android local runtime boot architecture by delegating startup to native Java code instead of calling the BunRuntime plugin. It also introduces new UI fallback components and substantially refactors build configuration. The scope and runtime behavior impact warrant human review. You can customize Macroscope's approvability policy. Learn more. |
|
Credit balance is too low |
|
Credit balance is too low |
|
Credit balance is too low |
|
Credit balance is too low |
|
Credit balance is too low |
# Conflicts: # scripts/validate-ci-bootstrap-contract.mjs
|
Merge coordination note, 2026-05-19: Normal package-mode CI for this PR is green. The remaining Auth P0 / Agent Review red gate is the known Clean path: review/merge this app/runtime package-mode PR first, then handle stacked follow-up #2158 ( |
…lish-20260516 # Conflicts: # apps/app/src/main.tsx
|
Credit balance is too low |
|
Latest-sync note, 2026-05-19: merged current |
|
Build follow-up, 2026-05-19: the refreshed head exposed a real package-mode Build failure from latest |
|
Credit balance is too low |
|
Credit balance is too low |
|
Final CI refresh, 2026-05-19: latest head |
|
Update 2026-05-19: pushed |
|
Credit balance is too low |
|
Status refresh (2026-05-19):
No new source changes pushed to this PR in this refresh; this comment is only a status/maintainer-context update. |
There was a problem hiding this comment.
Pull Request Overview
The PR successfully addresses Android local runtime stabilization and configuration hardening for Vite and CI environments. Codacy analysis indicates the changes are 'Up to Standards' with no new quality issues or complexity regressions.
However, a significant functional change was identified where sendLocalAgentMessage and getLocalAgentStatus are now expected to fail on Android, which may impact features relying on renderer-side control. Additionally, while the core acceptance criteria for Android WebView delegation and CI guards are met, there are notable gaps in the automated test coverage regarding token resolution and device bridge retry logic that should be addressed before merging.
About this PR
- The changes to the Android local runtime will cause
sendLocalAgentMessageandgetLocalAgentStatusto fail unconditionally. Verify that no critical features currently depend on these renderer-side controls before merging.
Test suggestions
- Verify Android local runtime returns 'delegated' status and defers readiness
- Verify Vite correctly resolves UI and app-core aliases in package-mode
- Verify CI bootstrap contract when eliza/ directory is absent
- Verify local agent token resolution and persistence logic (readInjectedLocalAgentToken/persistLocalAgentToken)
- Verify device bridge startup retry logic on Android when token is missing
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify local agent token resolution and persistence logic (readInjectedLocalAgentToken/persistLocalAgentToken)
2. Verify device bridge startup retry logic on Android when token is missing
Low confidence findings
- Auth P0 gate failures are expected in this PR due to workflow changes not being reflected in the base branch for pull_request_target events. This should not block the PR if other CI checks pass.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Update after reading the author comments and validation history: this branch had substantial package-mode validation on its May 19 base, including green normal CI lanes, focused package/workflow tests, and a documented limitation that the red Auth P0 gate came from pull_request_target using base workflow YAML. I should have read that thread before posting this review.
The current-state concern remains, but it should be read as a refresh/split request, not as a dismissal of the prior validation. Since #2160/#2161 have now landed on develop, this branch is stale against the current CI/source-install hardening and would weaken or remove current workflow contract coverage if resolved mechanically.
Please refresh onto current develop while preserving the current package-mode guards and security/CI contract behavior. Separately, the Android runtime behavior change still needs fresh proof on the refreshed branch: sendLocalAgentMessage now throws and getLocalAgentStatus reports not-ready, which is acceptable only if the Java ElizaAgentService / Agent transport owns every Android local-mode caller.
Keeping changes requested until the branch is refreshed and the Android ownership proof is current.
|
Closing as part of the Milady -> elizaOS/eliza PR migration sweep. This PR has requested changes/conflicts and targets Milady Android/local-runtime wrapper paths from the old apps/app layout. The related upstream native/runtime work has moved on; this should not be migrated as-is. |
Summary
Stabilizes the wrapper-side Android/local-runtime build path so Milady can build against the package-mode CI environment and the local Eliza runtime path without stale package drift.
This PR currently covers five verified areas:
ElizaAgentService/Agent transport remains the owner of local runtime startup and token injection.elizaos-ui-*compatshims with focused, app-owned voice capture / voice pill fallbacks, while keeping real package exports for@elizaos/ui/browser, style files, and source subpaths when available.@elizaos/uibrowser/voice source paths, native plugin packages, and generated package layouts instead of staledist/npm edges.eliza/is absent, skips local Eliza runtime release-contract steps when the nested checkout is intentionally absent, and tsdown falls back through current bundled@elizaos/app-corelayouts without relying on unexportedpackage.jsonsubpaths.The latest refresh also refactors the CodeFactor-reported complexity hotspots in
apps/app/vite.config.tsinto named helper functions and removes theunicorn/no-useless-fallback-in-spreadissue fromscripts/pixel-local-voice-benchmark.mjs.Related Eliza core/native PR: elizaOS/eliza#7792.
Current Source Base
Updated 2026-05-19 with normal merges, not rebases.
85335e9cborigin/develop:8c10e9fb06c8f89faa175334bc4eliza/checkout; local-Eliza-only release-contract steps are skipped by design in that mode.Validation
Local validation on
fbc44b75d/175334bc4after the CodeFactor cleanup:bun install --frozen-lockfile bunx vitest run --passWithNoTests \ apps/app/test/package-mode-aliases.test.ts \ scripts/standalone-eliza-package-contract.test.ts \ scripts/validate-ci-bootstrap-contract.test.ts bun run verify:typecheck bun run verify:lint bun run build bun run test bun run test:release:contract git diff --checkResults:
eliza/release-check steps skipped because this is the package-mode worktreeGitHub validation on
fbc44b75d:All Tests Passed: successPrevious Android APK validation still applies to the local-runtime build path:
That build completed with
BUILD SUCCESSFUL in 1m 53s, produced a771Mdebug APK, and packaged stable Bun, Agent/BunRuntime local plugins, Shaw'sllama.cppfork libs, Qwen35/Qwen35MoE/Qwen3Next/DFlash markers, MTP markers, and QJL/Polar/TBQ/fused-attention kernel strings.Known External Gate
Auth tests (P0 gate)/Agent Review Verdictstill fails because it is apull_request_targetworkflow, so it runs the workflow file from basedevelop, not this PR branch. Earlier logs failed before the PR-side guard could take effect. This branch includes the guard, but that specific P0 cannot observe the workflow fix until the workflow change exists on the base branch.Caveats
No Pixel device was available in this desktop validation session, so this refresh does not claim fresh on-device chat, audio, NNAPI/TPU, microphone, or trajectory validation. The latest evidence is package-mode host build/test/release-contract proof plus the earlier APK build proof.
This PR validates the local-runtime sideload APK build path. The Play Store/cloud APK remains a separate thin-client target and should not inherit the bundled local native runtime by accident.
Current CI Note
The normal package-mode CI lanes for this PR are green. The remaining red gate is the shared
pull_request_targetAgent Review/Auth P0 workflow from basedevelop, which cannot see PR-side workflow changes. The focused base-workflow fix is tracked in #2158 (fix(ci): guard package-mode workflows); this PR remains the app/runtime package-mode fix.Current Stack Note
Updated 2026-05-19 after latest
origin/developadvanced to8c10e9fb0: merged the base, resolved theapps/app/src/main.tsxconflict by keeping upstream app-core window-shell helpers plus the package-modepill-stubs.tsx, then fixed the refreshed CI Build failure caused by an unguardednode eliza/packages/app-core/scripts/link-docker-local-app-packages.mjsstep in package-mode checkouts. Local checks passed:bun run --cwd apps/app typecheck,bun run test:release:contract,bun run verify:lint,bunx vitest run scripts/ci-bootstrap-contract.test.ts,node scripts/validate-ci-bootstrap-contract.mjs, andgit diff --check. GitHub checks are re-running on85335e9cb. Local package-mode validation on this head passed: focused Vitest package/workflow contracts (4 files, 60 passed, 1 skipped),node scripts/validate-ci-bootstrap-contract.mjs, Biome on touched TS/MJS files,git diff --check, andbun run buildin a worktree with noeliza/checkout.#2158 remains stacked on this PR and has also been refreshed onto the new #2153 head. The remaining Auth P0 / Agent Review red checks are still the known
pull_request_targetlimitation: GitHub runs the workflow YAML from currentdevelop, so PR-side workflow guards cannot affect that gate until the guard lands ondevelop.Note
Delegate Android local runtime boot to ElizaAgentService and stabilize CI package linking
delegatedtoElizaAgentServiceand always returnsfalsefor readiness, removing all plugin loading andAGENT_READY_EVENTdispatch from the renderer.readInjectedLocalAgentToken,persistLocalAgentToken) in main.tsx and defers device bridge startup on Android until a pairing token is available, retrying after 1s if none is found.hashFiles('eliza/package.json') != ''so builds that lack an eliza workspace checkout no longer fail on that step;MILADY_FORCE_LOCAL_UPSTREAMSis also set conditionally.@elizaos/uisubpaths are not yet published.node_modules, auto-discover native plugins, and verify build output content.sendLocalAgentMessageandgetLocalAgentStatusnow unconditionally throw/return not-ready on Android; any caller that previously received plugin responses will stop working.Macroscope summarized 85335e9.