refactor: collapse dual stat buckets, prune unused params, kill dead helpers

Tracer:
- Collapse the ``live`` / ``completed`` LLM stat buckets into one
  flat dict. The ``completed`` bucket was only ever written by tests
  — production never moved stats across, and ``get_total_llm_stats``
  always summed both for display.
- Drop ``record_llm_usage(agent_id=...)``: argument was unused, and
  the per-call ``bucket=`` knob is gone with the buckets.

run_config_factory:
- Drop unused ``parallel_tool_calls``, ``tool_choice`` parameters
  from ``make_run_config`` — no caller ever overrode them.
- Drop ``agent_name`` from ``make_agent_context`` — set into the
  context dict but no consumer ever read it; the bus's ``names`` map
  is the source of truth.

Wire reasoning_effort through:
- ``Config.get("strix_reasoning_effort")`` is now actually plumbed
  to ``make_run_config`` from ``entry.py``. Previously the env var
  was advertised but never consumed.

Multi-agent graph tools:
- Replace six copies of
  ``inner = ctx.context if isinstance(ctx.context, dict) else {}``
  with a single ``_ctx(ctx)`` helper.

Todo tools:
- Lift the duplicated ``priority_order`` / ``status_order`` dicts
  to module-level ``_PRIORITY_RANK`` / ``_STATUS_RANK`` and replace
  both inline sort lambdas with ``_todo_sort_key``.

Notes tools:
- Delete ``append_note_content`` (and its test): docstring claimed
  it was for an "agents-graph wiki-update hook on agent_finish" that
  was never wired up. Pure dead public API.

Style:
- Drop the ``del ctx`` no-ops from notes / reporting / web_search
  tools. ``ARG001`` is already silenced project-wide for tool
  modules; the ``del`` was cargo-culted.
This commit is contained in:
0xallam
2026-04-25 12:44:48 -07:00
parent 1aeee5dc29
commit 43ebb786a2
13 changed files with 76 additions and 198 deletions
+1 -9
View File
@@ -1,15 +1,7 @@
from .tools import (
append_note_content,
create_note,
delete_note,
get_note,
list_notes,
update_note,
)
from .tools import create_note, delete_note, get_note, list_notes, update_note
__all__ = [
"append_note_content",
"create_note",
"delete_note",
"get_note",
+1 -22
View File
@@ -246,7 +246,7 @@ def _create_note_impl( # noqa: PLR0911
category: str = "general",
tags: list[str] | None = None,
) -> dict[str, Any]:
"""Create one note. Public — used by ``append_note_content`` and tests."""
"""Create one note. Public — used by tests."""
with _notes_lock:
try:
_ensure_notes_loaded()
@@ -398,22 +398,6 @@ def _delete_note_impl(note_id: str) -> dict[str, Any]:
}
def append_note_content(note_id: str, delta: str) -> dict[str, Any]:
"""Append text to an existing note's content. Used by the agents-graph
wiki-update hook on agent_finish."""
with _notes_lock:
try:
_ensure_notes_loaded()
if note_id not in _notes_storage:
return {"success": False, "error": f"Note with ID '{note_id}' not found"}
note = _notes_storage[note_id]
existing = str(note.get("content") or "")
updated = f"{existing.rstrip()}{delta}"
return _update_note_impl(note_id=note_id, content=updated)
except (ValueError, TypeError) as e:
return {"success": False, "error": f"Failed to append note content: {e}"}
# --- public tools ---------------------------------------------------------
@@ -457,7 +441,6 @@ async def create_note(
category: One of the categories above. Default ``"general"``.
tags: Optional free-form tags.
"""
del ctx
return _dump(
await asyncio.to_thread(_create_note_impl, title, content, category, tags),
)
@@ -489,7 +472,6 @@ async def list_notes(
include_content: When False (default) entries have a preview;
when True the full ``content`` is included.
"""
del ctx
return _dump(
await asyncio.to_thread(
_list_notes_impl,
@@ -508,7 +490,6 @@ async def get_note(ctx: RunContextWrapper, note_id: str) -> str:
Args:
note_id: Note id from ``create_note`` or a ``list_notes`` entry.
"""
del ctx
return _dump(await asyncio.to_thread(_get_note_impl, note_id))
@@ -532,7 +513,6 @@ async def update_note(
content: New content, or ``None`` to keep.
tags: New tags list, or ``None`` to keep.
"""
del ctx
return _dump(
await asyncio.to_thread(
_update_note_impl,
@@ -551,5 +531,4 @@ async def delete_note(ctx: RunContextWrapper, note_id: str) -> str:
Args:
note_id: Note id to delete.
"""
del ctx
return _dump(await asyncio.to_thread(_delete_note_impl, note_id))