Skip to content

fix(desktop): stop pinning agents to deprecated SPROUT_ACP_TURN_TIMEOUT#592

Merged
tlongwell-block merged 1 commit into
mainfrom
chore/desktop-drop-deprecated-turn-timeout
May 15, 2026
Merged

fix(desktop): stop pinning agents to deprecated SPROUT_ACP_TURN_TIMEOUT#592
tlongwell-block merged 1 commit into
mainfrom
chore/desktop-drop-deprecated-turn-timeout

Conversation

@tlongwell-block
Copy link
Copy Markdown
Collaborator

Why

Desktop-launched agents were being killed at exactly 320s even after PR #566 raised the sprout-acp idle-timeout default to 620s. The reason: the desktop spawn path always emitted the deprecated SPROUT_ACP_TURN_TIMEOUT env var with a hard-coded fallback of 320, which the harness's deprecation handler then used as the effective idle timeout — silently overriding the new default.

What

In desktop/src-tauri/src/managed_agents/runtime.rs, only emit SPROUT_ACP_IDLE_TIMEOUT when the agent record has an explicit idle_timeout_seconds override. When unset, say nothing and let the harness apply its own DEFAULT_IDLE_TIMEOUT_SECS (currently 620s).

Net: -8 / +3 logic lines, plus a doc-comment refresh on DEFAULT_AGENT_TURN_TIMEOUT_SECONDS.

-    if let Some(idle) = record.idle_timeout_seconds {
-        command.env("SPROUT_ACP_IDLE_TIMEOUT", idle.to_string());
-        command.env("SPROUT_ACP_TURN_TIMEOUT", idle.to_string());
-    } else {
-        command.env(
-            "SPROUT_ACP_TURN_TIMEOUT",
-            record.turn_timeout_seconds.to_string(),
-        );
-    }
+    if let Some(idle) = record.idle_timeout_seconds {
+        command.env("SPROUT_ACP_IDLE_TIMEOUT", idle.to_string());
+    }

Effect

  • New desktop-launched agents pick up whatever the harness default is. No more drift between desktop and sprout-acp.
  • Agents whose users have customized idle_timeout_seconds are unchanged.
  • The deprecation warning emitted by sprout-acp when it sees SPROUT_ACP_TURN_TIMEOUT will stop appearing in desktop agent logs.

Notes / Follow-ups

  • The legacy turn_timeout_seconds field on ManagedAgentRecord (and its UI exposure in CreateAgentDialog with default "320") is now a dead input on the spawn path. Doc comment on DEFAULT_AGENT_TURN_TIMEOUT_SECONDS updated to reflect that. Removing the field entirely is a separate change — touches DB schema migrations + the dialog UI + the e2e bridge.
  • No tests assert on env-var emission (grepped); existing managed_agents tests pass (115/115).

Verification

  • cargo build --lib clean
  • cargo test --lib managed_agents → 115 passed
  • Pre-push lefthook (11 hooks: fmt, check, clippy, tests, tauri-check, web-build, mobile-check, mobile-test, desktop-build) all green

The desktop spawn path was always emitting `SPROUT_ACP_TURN_TIMEOUT` (the
deprecated knob in sprout-acp) with a hard-coded default of 320s, which
overrode the harness's own `DEFAULT_IDLE_TIMEOUT_SECS` (now 620s after
PR #566). The visible symptom: agents launched from the desktop kept
being killed at exactly 320 seconds even though the harness defaults
to 620.

Fix: only emit `SPROUT_ACP_IDLE_TIMEOUT` when the agent record has an
explicit `idle_timeout_seconds` override. Otherwise, say nothing and
let the harness apply its own default — single source of truth.

Notes:
- The legacy `turn_timeout_seconds` field on the agent record (and its
  exposure in CreateAgentDialog) is now a dead input on the spawn path.
  Doc comment on `DEFAULT_AGENT_TURN_TIMEOUT_SECONDS` updated to reflect
  that. Removing the field entirely is a follow-up (touches DB schema
  and UI).
- No tests assert on the env-var emission; existing managed_agents tests
  still pass (115/115).

Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
@tlongwell-block tlongwell-block merged commit 13dc0df into main May 15, 2026
15 checks passed
@tlongwell-block tlongwell-block deleted the chore/desktop-drop-deprecated-turn-timeout branch May 15, 2026 01:51
tlongwell-block added a commit that referenced this pull request May 15, 2026
* origin/main: (33 commits)
  dev-mcp: add view_image tool (#602)
  fix(relay,desktop): only advertise NIP-43 when enforced; probe pairing by supported_nips (#601)
  fix(desktop): derive unread state from NIP-RS + relay catch-up only (#599)
  docs(testing): rewrite TESTING.md for current API and CLI-first workflow (#597)
  fix(agent): fix OpenAI-compat request body serialization and max_tokens (#595)
  feat(desktop): per-persona and per-agent env var overrides (#594)
  fix(desktop): stop pinning agents to deprecated SPROUT_ACP_TURN_TIMEOUT (#592)
  fix(desktop): populate member_count in get_channels so channel browser shows real counts (#548)
  fix(desktop): autofocus message composer on channel/thread open (#572)
  refactor(cli): restructure flat commands into 12 subcommand groups (#585)
  feat(sdk): add builder functions for workflows, DMs, and presence (#589)
  feat(desktop): add message more-actions dropdown menu (#590)
  fix(mobile): preserve channel list across background/resume reconnection (#588)
  Redesign Home as an inbox (#582)
  fix(desktop): drive unread badges from live subscription, not refetched lastMessageAt (#581)
  fix(desktop): refine header scaling and shadow (#573)
  fix(desktop): keep day dividers below header (#574)
  Move agent activity below composer (#579)
  docs(nips): NIP-AE — Agent Engrams (#575)
  refactor: extract shared @mention resolver into sprout-sdk (#580)
  ...

Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
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.

1 participant