Skip to content

Commit 6f229a8

Browse files
committed
fix(background-task): change default block to false and clarify system notification
- Change background_output default from block=true to block=false - Add documentation about system auto-notification on task completion - Clarify that block=false returns full status info, not empty 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
1 parent 5fd59af commit 6f229a8

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/tools/background-task/constants.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@ export const BACKGROUND_OUTPUT_DESCRIPTION = `Get output from a background task.
1818
1919
Arguments:
2020
- task_id: Required task ID to get output from
21-
- block: If true (default), wait for task completion. If false, return current status immediately.
21+
- block: If true, wait for task completion. If false (default), return current status immediately.
2222
- timeout: Max wait time in ms when blocking (default: 60000, max: 600000)
2323
2424
Returns:
25+
- When not blocking: Returns current status with task ID, description, agent, status, duration, and progress info
2526
- When blocking: Waits for completion, then returns full result
26-
- When not blocking: Returns current status and progress
27+
28+
IMPORTANT: The system automatically notifies the main session when background tasks complete.
29+
You typically don't need block=true - just use block=false to check status, and the system will notify you when done.
2730
2831
Use this to:
29-
- Check task progress (block=false)
30-
- Wait for and retrieve task result (block=true)
32+
- Check task progress (block=false) - returns full status info, NOT empty
33+
- Wait for and retrieve task result (block=true) - only when you explicitly need to wait
3134
- Set custom timeout for long tasks`
3235

3336
export const BACKGROUND_CANCEL_DESCRIPTION = `Cancel a running background task.

src/tools/background-task/tools.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ Description: ${task.description}
4646
Agent: ${task.agent}
4747
Status: ${task.status}
4848
49-
Use \`background_output\` tool with task_id="${task.id}" to check progress or retrieve results.
50-
- block=false: Check status without waiting
51-
- block=true (default): Wait for completion and get result`
49+
The system will notify you when the task completes.
50+
Use \`background_output\` tool with task_id="${task.id}" to check progress:
51+
- block=false (default): Check status immediately - returns full status info
52+
- block=true: Wait for completion (rarely needed since system notifies)`
5253
} catch (error) {
5354
const message = error instanceof Error ? error.message : String(error)
5455
return `❌ Failed to launch background task: ${message}`
@@ -152,7 +153,7 @@ export function createBackgroundOutput(manager: BackgroundManager, client: Openc
152153
description: BACKGROUND_OUTPUT_DESCRIPTION,
153154
args: {
154155
task_id: tool.schema.string().describe("Task ID to get output from"),
155-
block: tool.schema.boolean().optional().describe("Wait for completion (default: true)"),
156+
block: tool.schema.boolean().optional().describe("Wait for completion (default: false). System notifies when done, so blocking is rarely needed."),
156157
timeout: tool.schema.number().optional().describe("Max wait time in ms (default: 60000, max: 600000)"),
157158
},
158159
async execute(args: BackgroundOutputArgs) {
@@ -162,7 +163,7 @@ export function createBackgroundOutput(manager: BackgroundManager, client: Openc
162163
return `Task not found: ${args.task_id}`
163164
}
164165

165-
const shouldBlock = args.block !== false
166+
const shouldBlock = args.block === true
166167
const timeoutMs = Math.min(args.timeout ?? 60000, 600000)
167168

168169
// Non-blocking: return status immediately

src/tools/call-omo-agent/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ When using this tool, you must specify a subagent_type parameter to select which
1111
1212
**IMPORTANT: run_in_background parameter is REQUIRED**
1313
- \`run_in_background=true\`: Task runs asynchronously in background. Returns immediately with task_id.
14-
Use \`background_output\` tool with the returned task_id to check progress or retrieve results.
14+
The system will notify you when the task completes.
15+
Use \`background_output\` tool with task_id to check progress (block=false returns full status info).
1516
- \`run_in_background=false\`: Task runs synchronously. Waits for completion and returns full result.
1617
1718
Usage notes:

0 commit comments

Comments
 (0)