mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-22 20:55:29 -04:00
feat(agent): add manage_bg_jobs tool to inspect and kill background bash jobs (#4577)
Detached bash jobs (#!bg) could be launched and auto-reported on completion, but the agent had no way to act on a running one: no on-demand output read and no kill (it blocked until the 1h max-runtime). bg_jobs had the pieces (_read_output, list_for_session, internal _kill) but none was exposed. Adds: - bg_jobs.kill(job_id): tears down the process tree, marks the job killed, and sets followed_up so the monitor does not also auto-continue a deliberate kill. - manage_bg_jobs registry tool with actions list / output / kill, scoped to the chat that launched the job (cross-session access reads as not found). - Wiring: TOOL_HANDLERS/TAGS, function schema, RAG index + keyword hints, parser name map, dispatch (threads session_id via _direct_fallback). Gated like bash (NON_ADMIN_BLOCKED_TOOLS; plan-mode mutator). - agent_loop: background-job intent regex maps to the files domain (and the tool joins _DOMAIN_TOOL_MAP[files]) so short commands like 'kill that job' are not dropped by the low-signal gate that skips tool retrieval. - bg launch message tells the model to call manage_bg_jobs itself for check/stop rather than printing raw tool syntax to the user. Tests: tests/test_bg_job_tools.py (kill semantics, per-chat scoping, actions, and the intent classifier).
This commit is contained in:
committed by
GitHub
parent
39a802bea2
commit
cdae9879f2
@@ -14,6 +14,7 @@ logger = logging.getLogger(__name__)
|
||||
NON_ADMIN_BLOCKED_TOOLS = {
|
||||
"bash",
|
||||
"python",
|
||||
"manage_bg_jobs",
|
||||
"read_file",
|
||||
"write_file",
|
||||
"edit_file",
|
||||
@@ -114,6 +115,8 @@ _PLAN_MODE_KNOWN_MUTATORS = {
|
||||
# Shell is never read-only-safe; block it explicitly so it stays out of plan
|
||||
# mode even if the schema list fails to load.
|
||||
"bash", "python",
|
||||
# Controls shell processes (kill); plan mode can't run bash anyway.
|
||||
"manage_bg_jobs",
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user