mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-12 23:12:23 -06:00
03f82521d9
Follow-up to the cancellation review — harden how cancel interacts with a workstream's OWN turn and tools, not just its children and agents. - wait_for_workstream: the wait loop holds no cancel handle and blocks on the child-event bus, so a cancelled coordinator parked in a wait stayed pinned for up to WAIT_MAX_TIMEOUT (600s). Add a cooperative check to the ~2s progress heartbeat — it raises GenerationCancelled, which propagates out of the otherwise cancel-blind wait (~2s abort). - spawn_batch: stop creating the rest of the children once cancel is observed; already-spawned children stay recorded (they are live, durably parent-linked workstreams), the remainder are marked not-spawned. - session worker: only clear _worker_running if this thread is still the current worker, so a late-finishing abandoned worker (force-cancel) can't clobber a live successor's flag — which would let a third send spawn a duplicate worker on the same session. - bash silent-cancel: a SIGKILL'd silent command now records outcome-UNKNOWN (is_error, partial output kept) instead of a clean "Cancelled by user." that read as a successful empty result on replay. - wire-repair: the last-resort orphan disposition now reads outcome-UNKNOWN, matching the cooperative-cancel message (unknown, never none). Deferred: MCP / web_fetch / web_search remain uninterruptible mid-call, bounded by tool_timeout; only bash is truly preemptible.
55 lines
1.2 KiB
JSON
55 lines
1.2 KiB
JSON
{
|
|
"max_tokens": 4096,
|
|
"messages": [
|
|
{
|
|
"content": "Think about the weather.",
|
|
"role": "user"
|
|
},
|
|
{
|
|
"content": "Let me check.",
|
|
"role": "assistant",
|
|
"tool_calls": [
|
|
{
|
|
"function": {
|
|
"arguments": "{\"city\": \"Paris\"}",
|
|
"name": "get_weather"
|
|
},
|
|
"id": "call_1",
|
|
"type": "function"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"content": "Tool execution was cancelled. Outcome UNKNOWN — this call may have begun executing before the generation was stopped; do not assume it did not run, and reconcile before re-issuing it.",
|
|
"role": "tool",
|
|
"tool_call_id": "call_1"
|
|
}
|
|
],
|
|
"model": "gemini-2.5-pro",
|
|
"stream": true,
|
|
"stream_options": {
|
|
"include_usage": true
|
|
},
|
|
"temperature": 0.5,
|
|
"tools": [
|
|
{
|
|
"function": {
|
|
"description": "Look up the weather for a city.",
|
|
"name": "get_weather",
|
|
"parameters": {
|
|
"properties": {
|
|
"city": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"city"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
"type": "function"
|
|
}
|
|
]
|
|
}
|