Skip to content

fix(agent-mode): allow configuration without Termux - #98

Merged
Zhou-Shilin merged 2 commits into
Zhou-Shilin:mainfrom
yumiru11:fix/agent-mode-requires-termux
Oct 3, 2026
Merged

Zhou-Shilin merged 2 commits into
Zhou-Shilin:mainfrom
yumiru11:fix/agent-mode-requires-termux

Conversation

@yumiru11

@yumiru11 yumiru11 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #93

Problem

Agent Mode could not be configured at all unless Termux was installed. The settings entry refused to open ("Complete Termux setup before configuring Agent Mode"), the chat composer toggle stayed disabled, and the follow-up onboarding skipped the authorization step — even with Shizuku already authorized and Alpine ready.

Root cause

termuxSetupState.isReady was used as a proxy for "Agent Mode is configurable" in five places, but the feature does not use Termux:

  • AgentModeController injects TermuxBashTool and never references it — the constructor property is the only occurrence in the file.
  • Privilege injection goes through the Shizuku user service (agentmode/AetherAgentModeShizukuService.kt) or a root app_process; neither involves Termux.
  • The workspace comes from the current runtime, and screenshots are persisted through RuntimeWorkspaceFileBridge, which resolves the Alpine workspace path first.

settings_agent_mode_unavailable_body documented the opposite ("Agent Mode uses the Termux bridge for its workspace and screenshot flow"), which is why the gate looked intentional.

Fix

Relax every Agent Mode gate to accept any local runtime (Termux or Alpine), consistent with Alpine being the default runtime:

  • settings entry guard, hub row, and the in-page unavailable placeholder
  • chat composer availability (AetherApp) and the selection guard in AetherViewModel.setComposerAgentModeSelected, which would otherwise silently reject the toggle
  • the follow-up onboarding step that previously skipped authorization

Also corrects the misleading copy in all three locales (en / zh-rCN / fa) and renames the two string keys that encoded the Termux assumption.

Root automatic setup is intentionally left Termux-gated: RootSetupController genuinely probes Termux, and that path is unchanged.

Verification

  • PR Check CI (run on the fork): :shared:testDebugUnitTest, :app:testDebugUnitTest and :app:assembleDebug all pass.
  • Physical device with Shizuku only (Termux not installed, no root): Agent Mode can be enabled and authorized from Settings, the virtual display is created, input injection and screenshot capture work.

Summary by CodeRabbit

  • Updates
    • Agent Mode can be ready when authorization is enabled and either Termux or Alpine is ready.
    • Onboarding and settings recognize either runtime for Agent Mode setup and access. The Hub is available when either runtime is ready; otherwise, settings indicate that runtime setup is needed.
    • Agent Mode setup messages describe the local runtime requirement rather than referring only to Termux. The Termux subtitle no longer describes it as providing the Agent Mode workspace.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f6dd82f-e379-4015-b8b3-1cf71429e5e7
📥 Commits

Reviewing files that changed from the base of the PR and between d6f51c0 and b6b9693.

📒 Files selected for processing (1)
  • app/src/main/java/com/zhousl/aether/ui/AetherViewModel.kt
 _______________________________________________________________________
< Simplicity does not precede complexity, but follows it. - Alan Perlis >
 -----------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b29898d5-aaf2-49bd-9d57-68a8a5eac3fd
📥 Commits

Reviewing files that changed from the base of the PR and between b9433bb and d6f51c0.

📒 Files selected for processing (1)
  • shared/src/commonMain/composeResources/values-fa/strings.xml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Agent Mode readiness and setup now accept either a ready Termux or Alpine runtime. Authorization requirements remain in place. Onboarding, settings access, and localized messages reflect the runtime options.

Changes

Agent Mode Runtime Readiness

Layer / File(s) Summary
Broaden Agent Mode readiness
app/src/main/java/com/zhousl/aether/ui/AetherApp.kt, app/src/main/java/com/zhousl/aether/ui/AetherViewModel.kt
Agent Mode readiness accepts either a ready Termux or Alpine runtime. Authorization, developer override, and root-based conditions remain.
Update setup and settings access
app/src/main/java/com/zhousl/aether/ui/OnboardingScreen.kt, app/src/main/java/com/zhousl/aether/ui/SettingsScreen.kt, shared/src/commonMain/composeResources/values*/strings.xml
Onboarding and settings use either runtime for Agent Mode setup and access. Translations name Termux or Alpine as runtime options and revise the Termux subtitle.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: zhou-shilin

Merge Risk: ⚪ Minimal · up to d6f51

Alpine-only users can reach Agent Mode through the Alpine runtime, and the updated messages are available in each inspected locale. No actionable merge-blocking issue was established.

Security Architecture Review

Security architecture risk: 🔵 Low · up to d6f51

Alpine-only users gain access to Agent Mode while existing authorization requirements remain. No new authorization bypass was established, but immediate revocation and concurrent runtime-reset behavior are not fully proven.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The expanded exposure is to newly eligible Alpine-only sessions on an authorized device. Those sessions can invoke the same privileged display/input operations and screenshot capture as existing Agent Mode sessions; the sensitive scope is device applications and screen content, not merely files inside Alpine.

Trust Boundaries and Controls

  • observed — Initial Shizuku service acquisition checks that Shizuku is running and package permission is granted; initial root acquisition requires successful privileged service startup. Cached services are reused when their binders remain live, so these acquisition checks are not proof of fresh authorization validation for every tool action.

Resilience and Maintainability Implications

  • observed — Display reuse requires matching authorization method, binder identity and binder liveness. Shizuku binder death clears its service and releases an owned display; changing authorization method also resets the display. Disabling authorization refreshes its status, but the inspected disable and refresh functions do not themselves stop the display. These mechanisms predate this PR; complete in-flight revocation behavior remains unresolved.

Hardening Proposals

  • proposed — Consider centralizing live authorization checks immediately before privileged operations and defining disable/revocation behavior for active displays and outstanding tool requests. This is a hardening proposal, not a verified PR-introduced bypass.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: Agent Mode can be configured when Termux is unavailable and Alpine is ready.
Linked Issues check ✅ Passed Issue #93 is closed and supplies historical context only. No active directly linked issue remains, so no linked-issue coding requirements apply.
Out of Scope Changes check ✅ Passed The reported changes broaden Agent Mode runtime readiness across Settings, the composer, and onboarding, and update related localized copy. These changes match the PR’s stated intent. No unrelated cha…
Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yumiru11

yumiru11 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

所有改动均由deepseek-v4.1-flash生成

Agent Mode gated its settings entry, composer toggle and onboarding step on
Termux readiness, but nothing in the feature uses Termux: the virtual display,
input injection and screenshot capture go through the Shizuku user service or a
root app_process, and screenshots persist into the Alpine workspace. The
TermuxBashTool injected into AgentModeController was never referenced.

Relax every Agent Mode gate to accept any local runtime (Termux or Alpine),
which matches Alpine being the default runtime, and drop the "uses the Termux
bridge" copy that documented the wrong dependency.

Fixes Zhou-Shilin#93
@yumiru11
yumiru11 force-pushed the fix/agent-mode-requires-termux branch from b9433bb to d6f51c0 Compare October 3, 2026 09:36
@Zhou-Shilin
Zhou-Shilin merged commit b46388d into Zhou-Shilin:main Oct 3, 2026
1 check was pending
@yumiru11

yumiru11 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@Zhou-Shilin
image
😅ds依旧白饭管够

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 仅安装 Shizuku 但未安装 Termux 时无法配置 Agent 模式

2 participants