Skip to content

feat(worker): make turn inactivity timeouts configurable - #86

Open
andrewkcchung wants to merge 1 commit into
mainfrom
upstream/u05-turn-inactivity-timeout
Open

andrewkcchung wants to merge 1 commit into
mainfrom
upstream/u05-turn-inactivity-timeout

Conversation

@andrewkcchung

@andrewkcchung andrewkcchung commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Why

Turn silence is not inherently failure: legitimate tools and models can have very different quiet periods. Making the existing worker watchdog configurable gives every deployment a common bounded mechanism for detecting genuinely stalled turns without forcing one fleet's timing assumptions on the platform.

What changed

  • Add an SDK worker option for the turn inactivity timeout.
  • Support deployment configuration through PILOTSWARM_TURN_INACTIVITY_TIMEOUT_MS.
  • Preserve the existing timeout when no valid override is supplied.
  • Let an explicit value take precedence over the environment; 0 intentionally disables the watchdog.
  • Document the public configuration and edge behavior.

Behavioral proof

Command:

npm run build --workspace=packages/sdk
node --test packages/sdk/test/unit/worker-turn-inactivity-timeout.test.mjs
  • Red — test-only patch on main: The test failed because main did not provide the timeout resolver or configurable worker behavior.
  • Green — this branch: SDK build succeeded; 6 tests passed.

Risk assessment

Relative risk: Low

The new timeout is optional and preserves the established default when absent or invalid. It changes no durable state or wire format. The main behavioral risks are disabling protection with 0 or selecting a threshold below legitimate quiet operations; precedence, environment parsing, default, disable, and invalid-value tests cover these cases.

Review focus

  • Confirm environment configuration is resolved when the worker is constructed, not dynamically during a turn.
  • Confirm invalid, negative, and non-finite values retain the established default.
  • Confirm 0 as the explicit disable value is an acceptable public contract.
  • Review whether the documented default remains suitable across supported worker environments.

Expose a bounded worker inactivity watchdog through constructor and environment configuration while preserving the existing default behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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