Repository navigation
refactor(agents): let agents declare their own confirmation-required tool sets (#1440) - #1963
Conversation
…tool sets (#1440) Email/calendar tool names (send_draft, send_now, forward_message, permanent_delete, accept_invite, decline_invite, create_event_from_email, quarantine_phishing_message) were hard-coded into the base TOOLS_REQUIRING_CONFIRMATION set, coupling the framework to one agent's domain. Any agent's destructive tool had to be added to a central list in the base module. The base set now holds only generic dangerous tools (shell / file mutation). Each agent declares its own gated tools on the class attribute CONFIRMATION_REQUIRED_TOOLS; Agent.confirmation_required_tools() unions the two, and _execute_tool gates on the merged set. Net gating behavior is identical — the email agent's effective set is the same 17 tools as before.
Verdict: ApproveThis moves the eight email/calendar tool names off the framework's central hard-coded confirmation list and onto the email agent itself, where they belong — a third-party agent can now self-declare its destructive tools without patching core. Gating behavior is unchanged: the email agent's effective set is the same 17 tools it gated before, just owned by the right class. Well-scoped, and the docstrings + OpenAI spec + both spec docs were all updated in the same PR so nothing drifts. One thing worth keeping in mind for later (not blocking): the merge is a simple class-attribute override, so if a future agent ever spreads 🔍 Technical detailsCorrectness — no issues found
🟢 Minor (non-blocking)
Strengths
|
…nfirmation-tools-1440 # Conflicts: # src/gaia/agents/base/agent.py
The behavior-e2e harness spawned gaia.ui.server with unread subprocess.PIPE stdout/stderr. The server logs several KB during startup; on the Windows runner the OS pipe buffer (~4-8 KB) filled and the server blocked on write, so the ASGI lifespan never finished and /api/health never came up — the 30 s 'did not become healthy' timeout. Redirect the child's output to a file (never blocks) under an artifacts subdir so it uploads for diagnosis, widen the health budget to 90 s for a cold first-run, and surface the server log tail on every failure path. Once the server booted, the harness client timeout (180 s) was below the server's own 600 s inference ceiling, so a still-running builder request was cut client-side and wedged the single worker. Align the client timeout to 620 s so the server-side bound governs.
|
Merged Conflict resolution. The only real conflict was in What fixed
🔍 Verification
|
|
Re-validated The run still reports failure, but for a reason that is not an infrastructure issue and is unrelated to this PR: on the builder scenario the model (
|
Why this matters
Adding a destructive tool to any GAIA agent used to require editing a central hard-coded list in the base framework:
TOOLS_REQUIRING_CONFIRMATIONinagent.pycarried eight email/calendar-specific tool names (send_draft,send_now,forward_message,permanent_delete,accept_invite,decline_invite,create_event_from_email,quarantine_phishing_message), coupling the framework to one agent's domain. A third-party agent had no way to self-declare a tool as confirmation-gated without patching core.Now the base set holds only generic dangerous tools (shell / file mutation). Each agent declares its own gated tools on a
CONFIRMATION_REQUIRED_TOOLSclass attribute;Agent.confirmation_required_tools()merges (unions) it with the base set, and_execute_toolgates on the merged set. Net gating behavior is identical — the email agent's effective confirmation set is the same 17 tools it gated before; only ownership moved ontoEmailTriageAgent.Test plan
pytest tests/unit/agents/test_confirmation_required_tools.py— new unit tests: base set is generic-only, merge produces the union, subclass declaration doesn't mutate the shared base set, gated tool body never runs on denial, undeclared tool isn't gatedpytest tests/unit/agents/test_email_agent_confirmation.py tests/integration/test_never_auto_send.py tests/integration/test_email_rest_api_e2e.py— existing gating guards pass against the merged set (53 passed)EmailTriageAgent.confirmation_required_tools()== the pre-refactor 17-tool union (9 base + 8 email)black --check/isort --check/flake8clean onsrc/gaia+testsopenapi.email.json(docstring reference updated) — contract drift test passesTwo unrelated failures in the touched files (
test_email_agent.py::test_no_unexpected_tool_seton memory-mixin tools, and a phishing undo-window test that only fails under cross-test ordering) were confirmed pre-existing on a clean tree.Closes #1440