feat(delegate-task): ⚙️ make sync subagent timeout configurable via syncPollTimeoutMs#2173
feat(delegate-task): ⚙️ make sync subagent timeout configurable via syncPollTimeoutMs#2173Lynricsy wants to merge 1 commit intocode-yeongyu:devfrom
Conversation
…yncPollTimeoutMs Allow users to set `background_task.syncPollTimeoutMs` in config to override the default 10-minute sync subagent timeout. Affects sync task, sync continuation, and unstable agent task paths. Minimum value: 60000ms (1 minute). Co-authored-by: Wine Fox <fox@ling.plus>
There was a problem hiding this comment.
Pull request overview
This PR makes the hardcoded 10-minute sync subagent polling timeout configurable via the syncPollTimeoutMs field in the background_task configuration section. The change follows the existing pattern established by other timeout configurations like messageStalenessTimeoutMs.
Changes:
- Added
syncPollTimeoutMsconfiguration field toBackgroundTaskConfigSchemawith 60-second minimum - Introduced
DEFAULT_SYNC_POLL_TIMEOUT_MSconstant (600,000ms = 10 minutes) for backward compatibility - Threaded the configuration through the delegate-task tool chain: plugin config → tool options → executor context → polling functions
- Updated all three synchronous polling code paths to use the configurable timeout with the default fallback pattern
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/config/schema/background-task.ts |
Added syncPollTimeoutMs field to schema with 60-second minimum |
src/config/schema/background-task.test.ts |
Added 4 validation tests for the new schema field |
src/tools/delegate-task/timing.ts |
Added DEFAULT_SYNC_POLL_TIMEOUT_MS constant (600,000ms) |
src/tools/delegate-task/types.ts |
Added syncPollTimeoutMs optional property to DelegateTaskToolOptions |
src/tools/delegate-task/executor-types.ts |
Added syncPollTimeoutMs optional property to ExecutorContext |
src/plugin/tool-registry.ts |
Threaded pluginConfig.background_task.syncPollTimeoutMs to delegate-task options |
src/tools/delegate-task/sync-session-poller.ts |
Updated pollSyncSession to accept optional timeoutMs parameter and use fallback pattern |
src/tools/delegate-task/sync-task.ts |
Passed syncPollTimeoutMs from executor context to pollSyncSession |
src/tools/delegate-task/sync-continuation.ts |
Passed syncPollTimeoutMs from executor context to pollSyncSession |
src/tools/delegate-task/unstable-agent-task.ts |
Replaced hardcoded MAX_POLL_TIME_MS with configurable timeout using fallback pattern |
src/tools/delegate-task/sync-session-poller.test.ts |
Updated timeout test to pass explicit 0 value |
src/tools/delegate-task/sync-poll-timeout.test.ts |
Added 4 behavior tests verifying timeout threading and fallback logic |
src/tools/delegate-task/tools.test.ts |
Enhanced mock client to support multiple polling calls for variant preservation test |
assets/oh-my-opencode.schema.json |
Auto-generated JSON schema update |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -8,6 +8,7 @@ export const BackgroundTaskConfigSchema = z.object({ | |||
| staleTimeoutMs: z.number().min(60000).optional(), | |||
| /** Timeout for tasks that never received any progress update, falling back to startedAt (default: 600000 = 10 minutes, minimum: 60000 = 1 minute) */ | |||
| messageStalenessTimeoutMs: z.number().min(60000).optional(), | |||
There was a problem hiding this comment.
Missing JSDoc comment for the syncPollTimeoutMs field. The other timeout fields in this schema (lines 7-10) include descriptive JSDoc comments explaining their purpose, default values, and minimums. For consistency and documentation completeness, this field should have a similar comment explaining that it controls the timeout for synchronous subagent polling operations.
| messageStalenessTimeoutMs: z.number().min(60000).optional(), | |
| messageStalenessTimeoutMs: z.number().min(60000).optional(), | |
| /** Timeout in milliseconds for synchronous subagent polling operations (minimum: 60000 = 1 minute) */ |
There was a problem hiding this comment.
No issues found across 14 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: The PR safely makes a hardcoded 10-minute timeout configurable with backward-compatible defaults, includes validation, and adds comprehensive tests without changing existing behavior.
Summary
The hardcoded 10-minute
MAX_POLL_TIME_MSin sync subagent polling is now configurable viabackground_task.syncPollTimeoutMsin user/project config.Changes
syncPollTimeoutMs(optional, min 60000ms) toBackgroundTaskConfigSchemapluginConfig.background_task.syncPollTimeoutMs→DelegateTaskToolOptions→ExecutorContext→pollSyncSession()sync-task.ts,sync-continuation.ts,unstable-agent-task.ts— all usetimeoutMs ?? DEFAULT_SYNC_POLL_TIMEOUT_MSDEFAULT_SYNC_POLL_TIMEOUT_MS = 600_000(backward-compatible default)Usage
Files Changed (14)
src/config/schema/background-task.tssyncPollTimeoutMsZod fieldsrc/tools/delegate-task/timing.tsDEFAULT_SYNC_POLL_TIMEOUT_MSconstantsrc/tools/delegate-task/types.tsDelegateTaskToolOptions.syncPollTimeoutMssrc/tools/delegate-task/executor-types.tsExecutorContext.syncPollTimeoutMssrc/tools/delegate-task/sync-session-poller.tstimeoutMs?parametersrc/tools/delegate-task/sync-task.tssrc/tools/delegate-task/sync-continuation.tssrc/tools/delegate-task/unstable-agent-task.tssrc/plugin/tool-registry.tsassets/oh-my-opencode.schema.jsonsrc/config/schema/background-task.test.tssrc/tools/delegate-task/sync-poll-timeout.test.tssrc/tools/delegate-task/sync-session-poller.test.tssrc/tools/delegate-task/sync-task-deps.tsDesign Decisions
background_tasksection (consistent with existingmessageStalenessTimeoutMs)timeoutMs ?? DEFAULT_SYNC_POLL_TIMEOUT_MS(same asmessageStalenessTimeoutMspattern)Summary by cubic
Makes the sync subagent polling timeout configurable via background_task.syncPollTimeoutMs, so teams can adjust the default 10-minute limit across sync flows. Default remains 600,000 ms; minimum is 60,000 ms.
Written for commit d09cf56. Summary will update on new commits.