mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 13:30:46 +08:00
fix(scheduler): inherit creator specialist in schedule_create
When the model omits specialist, inject selected_specialist from the current tool executor context so scheduled jobs run under the expert that created them. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
ad052daaf0
commit
a27bca5648
2 changed files with 77 additions and 0 deletions
|
|
@ -505,6 +505,21 @@ class ToolExecutor:
|
|||
path_policy_tenant_id=ctx.path_policy_tenant_id,
|
||||
path_policy_user_id=ctx.path_policy_user_id,
|
||||
)
|
||||
# Default specialist context: if the model did not explicitly provide a specialist for
|
||||
# schedule tools, inherit from the current executor specialist.
|
||||
#
|
||||
# This makes scheduled jobs created by ops/generalist reflect the creator specialist by default,
|
||||
# which is important for "created-by specialist" semantics and for later scheduled runs.
|
||||
try:
|
||||
tname = str(tc.name or "")
|
||||
if tname == "schedule_create":
|
||||
cur_spec = str(ctx.specialist or "").strip().lower()
|
||||
if cur_spec and not str(tool_args.get("specialist") or "").strip() and not str(
|
||||
tool_args.get("selected_specialist") or ""
|
||||
).strip():
|
||||
tool_args["selected_specialist"] = cur_spec
|
||||
except Exception:
|
||||
pass
|
||||
tool_args = filter_arguments_to_schema(tool.parameters, tool_args)
|
||||
|
||||
ok, v_err = validate_tool_arguments(tool.parameters, tool_args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue