Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

Tell the agent how to stop a stuck Termux command via the notification Exit action

Jalebi786cdd8b158f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6cec2db..4deb699 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
All notable changes to Gotcha are documented here.
## [Unreleased]
+### Fixed
+- The agent is now told how to stop a stuck Termux command: a `run_termux_command`
+ cannot kill a previously running one, so the instructions guide it to open the
+ notifications shade and tap Exit on the Termux notification (asking the user to
+ do so when it cannot reach it), instead of failing or starting more commands.
## [1.0.2]
### Fixed
diff --git a/app/src/main/java/com/gotcha/tools/TermuxMessages.kt b/app/src/main/java/com/gotcha/tools/TermuxMessages.kt
index 3e27465..6467d01 100644
--- a/app/src/main/java/com/gotcha/tools/TermuxMessages.kt
+++ b/app/src/main/java/com/gotcha/tools/TermuxMessages.kt
@@ -65,8 +65,11 @@ internal object TermuxMessages {
fun tooManyInFlight(limit: Int) = ToolResult.error(
"$limit Termux commands are already running and none has finished yet. Earlier commands keep running " +
- "even after they time out — I cannot kill them. Wait for them to finish (use the sleep tool), or " +
- "check Termux directly, rather than starting another."
+ "even after they time out — a run_termux_command cannot kill them. To stop them, open the " +
+ "notifications shade (global_action or press_key 'notifications') and tap the Exit action on the " +
+ "Termux notification, which ends every Termux session. If you cannot reach it, ask the user to tap " +
+ "Exit on the Termux notification. Otherwise wait for them to finish (use the sleep tool) rather " +
+ "than starting another."
)
/**
@@ -85,7 +88,10 @@ internal object TermuxMessages {
append("here. Retry with a non-interactive flag (e.g. -y) or pass the answer in stdin.")
}
append("\n- or it is genuinely slow. Retry with a larger timeout_seconds. Note it keeps running ")
- append("either way — I cannot kill another app's process — so check Termux before starting again.")
+ append("either way — a run_termux_command cannot stop it. To stop it, open the notifications shade ")
+ append("(global_action or press_key 'notifications') and tap the Exit action on the Termux ")
+ append("notification, which ends every Termux session. If you cannot reach it, ask the user to tap ")
+ append("Exit on the Termux notification.")
}
)
diff --git a/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt b/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt
index 87d86b1..1843ee8 100644
--- a/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt
+++ b/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt
@@ -1877,7 +1877,13 @@ object ToolDefinitions {
"Termux runs under its own user id, so Gotcha's working directory and app files are NOT " +
"visible here — use run_command for those. Shared storage (/sdcard) is only reachable if " +
"the user has run `termux-setup-storage` in Termux; if a /sdcard path fails, say so " +
- "rather than retrying.",
+ "rather than retrying.\n" +
+ "You cannot stop a command with this tool — there is no kill, each call only starts a new " +
+ "background shell, and a previous one that has not finished (e.g. after a timeout) keeps " +
+ "running. To stop a stuck one, open the notifications shade (global_action or press_key " +
+ "'notifications') and tap the Exit action on the Termux notification, which ends every " +
+ "Termux session. If you cannot reach that, ask the user to tap Exit on the Termux " +
+ "notification.",
schema {
putJsonObject("properties") {
putJsonObject("command") {