Skip to content

Commit 7ae2bf8

Browse files
authored
feat: disable permission auto-prompts + typing indicator on webhook channels (tinyhumansai#552)
* feat(config): default screen intelligence, dictation, and vision model off Flip defaults so no macOS TCC permission prompt fires on first run: - `dictation.enabled`: `true` → `false` (was auto-starting rdev::listen, which requests Accessibility/Input Monitoring on macOS) - `screen_intelligence.use_vision_model`: `true` → `false` (fewer surprise vision-model calls; Pass 1 Apple Vision OCR still runs) Aligns all permission-gated auto-starts on a consistent opt-in posture: `screen_intelligence.enabled`, `autocomplete.enabled`, and `voice_server.auto_start` already default to `false`. Users must now explicitly flip each toggle (config or JSON-RPC) before the core triggers any OS permission dialog. * feat(channels): fire typing indicator on webhook-inbound path Two inbound flows exist today and only one fires typing: - Local bot (`channels_config.telegram.bot_token` set) → dispatch.rs already calls `channel.start_typing` + `spawn_scoped_typing_task` - Backend webhook (Telegram → backend → socket.io → core) → `ChannelInboundSubscriber` had **no typing call** — replies route via backend REST, so the local `Channel` trait isn't reachable. Close the gap by going through the backend: - `api/rest.rs`: add `send_channel_typing(channel, jwt, body)` hitting the new `POST /channels/:id/typing` backend route. - `channels/bus.rs`: extract the agent-wait loop into `run_agent_loop` and wrap it with a typing task that fires immediately on `start_chat` success, refreshes every 4s (beats Telegram's ~5s and Discord's ~10s typing TTLs), and cancels on every exit path (done / error / empty / bus-closed / lagged / timeout). Backend failures log at debug — a flaky typing call must never block the reply flow. Generalises to every channel with a backend adapter; adapters without a native typing API no-op gracefully. * Enhance test stability by introducing a Mutex guard for TRIAGE_DISABLED_ENV in tests - Added a static Mutex guard to ensure safe concurrent access to the `TRIAGE_DISABLED_ENV` variable during tests, preventing interleaved set_var/remove_var calls that could lead to spurious failures. - Updated relevant test cases to acquire the Mutex lock when accessing the environment variable, ensuring consistent behavior across concurrent test executions.
1 parent 933c233 commit 7ae2bf8

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/openhuman/composio/bus.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,13 @@ async fn wait_for_connection_active(
489489
mod tests {
490490
use super::*;
491491
use serde_json::json;
492+
use std::sync::Mutex;
493+
494+
/// Cargo runs tests concurrently by default, and `TRIAGE_DISABLED_ENV`
495+
/// is process-global. Every test that reads or writes it must hold this
496+
/// guard for the duration of its env-var usage, otherwise interleaved
497+
/// `set_var` / `remove_var` calls cause spurious failures.
498+
static TRIAGE_ENV_GUARD: Mutex<()> = Mutex::new(());
492499

493500
#[tokio::test]
494501
async fn ignores_non_composio_events() {
@@ -505,6 +512,7 @@ mod tests {
505512
async fn handles_trigger_event_without_panic() {
506513
// Disable triage so this test takes the log-only path and
507514
// doesn't spawn a real LLM turn.
515+
let _guard = TRIAGE_ENV_GUARD.lock().unwrap_or_else(|e| e.into_inner());
508516
std::env::set_var(TRIAGE_DISABLED_ENV, "1");
509517
let sub = ComposioTriggerSubscriber::new();
510518
sub.handle(&DomainEvent::ComposioTriggerReceived {
@@ -520,6 +528,7 @@ mod tests {
520528

521529
#[test]
522530
fn triage_disabled_flag_parser() {
531+
let _guard = TRIAGE_ENV_GUARD.lock().unwrap_or_else(|e| e.into_inner());
523532
// Truthy values disable triage.
524533
for val in ["1", "true", "TRUE", "yes", "YES"] {
525534
std::env::set_var(TRIAGE_DISABLED_ENV, val);

src/openhuman/config/schema/accessibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn default_autocomplete_enabled() -> bool {
6868
}
6969

7070
fn default_use_vision_model() -> bool {
71-
true
71+
false
7272
}
7373

7474
impl Default for ScreenIntelligenceConfig {

src/openhuman/config/schema/dictation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub struct DictationConfig {
4444
}
4545

4646
fn default_enabled() -> bool {
47-
true
47+
false
4848
}
4949

5050
fn default_hotkey() -> String {

0 commit comments

Comments
 (0)