Skip to content

fix: deliver Termux RUN_COMMAND results via pending intent - #80

Merged
Zhou-Shilin merged 2 commits into
Zhou-Shilin:mainfrom
Chumor:fix/termux-results
Sep 24, 2026
Merged

Zhou-Shilin merged 2 commits into
Zhou-Shilin:mainfrom
Chumor:fix/termux-results

Conversation

@Chumor

@Chumor Chumor commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator
  • Start RunCommandService as a foreground service from the background
  • Bind the result broadcast to the application context
  • Keep the result receiver alive until the plugin result bundle is applied

Refs:

Summary by CodeRabbit

  • New Features
    • Added automatic model selection based on provider defaults and the current conversation.
    • Added configurable prompt-cache retention for AI requests.
    • Reasoning summaries, titles, navigation, and compaction now use the active conversation model when appropriate.
    • Simplified default-model settings to focus on chat and title models.
  • Bug Fixes
    • Improved chat-history synchronization, preserving unchanged messages and cleaning up stale checkpoint data.
    • Improved Termux command reliability, including foreground-service compatibility and asynchronous result handling.
  • Improvements
    • Default reasoning is now enabled at a medium level.

- Start RunCommandService as a foreground service from the background
- Bind the result broadcast to the application context
- Keep the result receiver alive until the plugin result bundle is applied
@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: fe2b3a87-6f25-4cad-aded-1ff31c0aa8ed

📥 Commits

Reviewing files that changed from the base of the PR and between b2ad0e7 and b2e81d5.

📒 Files selected for processing (1)
  • app/src/main/java/com/zhousl/aether/termux/TermuxBashTool.kt

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The Termux command flow now uses application context for result delivery, attempts foreground-service startup with fallback handling, and keeps broadcast processing active until result handling finishes.

Changes

Termux execution lifecycle

Layer / File(s) Summary
Service dispatch handling
app/src/main/java/com/zhousl/aether/termux/TermuxBashTool.kt
Result intents use applicationContext. Service startup uses startForegroundService and falls back to startService when startup fails.
Asynchronous result completion
app/src/main/java/com/zhousl/aether/termux/TermuxResultReceiver.kt
onReceive uses goAsync() and calls PendingResult.finish() in finally after result processing.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: zhou-shilin

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. 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: fixing delivery of Termux RUN_COMMAND results through a pending intent.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

ContextCompat.startForegroundService() is void here, so the try/catch
was inferred as Any? and failed Kotlin compile.
@Chumor

Chumor commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @Zhou-Shilin, please review this PR when you have a chance. If everything looks good, please squash and merge it.

@Chumor
Chumor requested a review from Zhou-Shilin September 19, 2026 04:01
@Chumor
Chumor force-pushed the fix/termux-results branch 2 times, most recently from 5bd3657 to b2e81d5 Compare September 19, 2026 09:15
@Zhou-Shilin
Zhou-Shilin merged commit b59e3b5 into Zhou-Shilin:main Sep 24, 2026
4 checks passed
@Chumor
Chumor deleted the fix/termux-results branch September 24, 2026 15:16
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.

2 participants