mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
fix(runtime): harden tool-call pairing and extend run_command timeouts
Prevent invalid tool_calls replay by requiring immediate tool-result adjacency in message building, and raise run_command default and tool-level timeout ceilings to reduce install-command timeout failures. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6628cd1220
commit
d731288ffa
4 changed files with 26 additions and 7 deletions
|
|
@ -66,7 +66,7 @@ class LocalAdapter:
|
|||
os.environ[k] = str(value)
|
||||
return {"ok": True, "key": k, "value": os.environ.get(k), "deleted": False}
|
||||
|
||||
def run_command(self, *, command: str, cwd: str | None = None, timeout: int = 30) -> dict[str, Any]:
|
||||
def run_command(self, *, command: str, cwd: str | None = None, timeout: int = 300) -> dict[str, Any]:
|
||||
cmd = str(command or "").strip()
|
||||
if not cmd:
|
||||
return {"ok": False, "error_code": "command_required", "error": "command_required"}
|
||||
|
|
@ -103,7 +103,7 @@ class LocalAdapter:
|
|||
except Exception:
|
||||
return {"ok": False, "error_code": "disabled", "error": "disabled"}
|
||||
try:
|
||||
timeout_s = max(1, min(int(timeout or 30), 600))
|
||||
timeout_s = max(1, min(int(timeout or 300), 600))
|
||||
# run_command never follows adapter cd state.
|
||||
# It only uses explicit cwd; otherwise defaults to data/workspace.
|
||||
workdir = str(resolve_workspace_path(cwd or "data/workspace"))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ def run_command_tool() -> ToolSpec:
|
|||
if not command:
|
||||
return {"ok": False, "error_code": "command_required", "error": "command_required"}
|
||||
cwd = str(args.get("cwd") or "").strip() or None
|
||||
timeout = int(args.get("timeout") or 30)
|
||||
timeout = int(args.get("timeout") or 300)
|
||||
return get_local_adapter().run_command(command=command, cwd=cwd, timeout=timeout)
|
||||
|
||||
return ToolSpec(
|
||||
|
|
@ -23,7 +23,7 @@ def run_command_tool() -> ToolSpec:
|
|||
"properties": {
|
||||
"command": {"type": "string", "description": "Shell command to execute."},
|
||||
"cwd": {"type": "string", "description": "Optional working directory."},
|
||||
"timeout": {"type": "integer", "description": "Timeout in seconds.", "default": 30},
|
||||
"timeout": {"type": "integer", "description": "Timeout in seconds.", "default": 300},
|
||||
},
|
||||
"required": ["command"],
|
||||
"additionalProperties": False,
|
||||
|
|
@ -31,7 +31,7 @@ def run_command_tool() -> ToolSpec:
|
|||
handler=_handler,
|
||||
tags=frozenset({"public", "exec"}),
|
||||
risk_level="high",
|
||||
timeout_s=90.0,
|
||||
timeout_s=620.0,
|
||||
read_only=False,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue