mirror of
https://github.com/usestrix/strix.git
synced 2026-08-24 11:52:38 +02:00
refactor: scrub migration scars, dead code, and unused helpers
- Strip PLAYBOOK / AUDIT / Phase-N / C-numbered references from module docstrings across 16 files; rename ``_PHASE1_PARALLEL_DEFAULT`` → ``_PARALLEL_TOOL_CALLS_DEFAULT``. - Delete unused exception classes: ``SandboxInitializationError``, ``ImplementedInClientSideOnlyError``. - Delete the no-op ``on_handoff`` hook (we don't use SDK handoffs). - Delete the unreachable backward-compat tab-delimited fallback in ``_parse_git_diff_output``. - Delete orphaned ``strix/tools/load_skill/`` (dir contained only a pycache) and stale pycache files. - Rewrite ``strix/skills/__init__.py``: 168 → 56 LoC. Drop seven helper functions (``get_available_skills``, ``get_all_skill_names``, ``validate_skill_names``, ``parse_skill_list``, ``validate_requested_skills``, ``generate_skills_description``, ``_get_all_categories``) — none had external callers; only ``load_skills`` is used. - Drop the stale ``strix/agents/sdk_factory.py`` per-file ruff ignore (file no longer exists). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
e4be5f9588
commit
4146174503
@@ -1,14 +1,8 @@
|
||||
"""StrixTracingProcessor — SDK trace processor that writes events.jsonl.
|
||||
"""``StrixTracingProcessor`` — SDK trace processor that writes ``events.jsonl``.
|
||||
|
||||
Hooks into the SDK's tracing pipeline and writes events to
|
||||
``strix_runs/<run-name>/events.jsonl``. PII scrubbing via the existing
|
||||
``TelemetrySanitizer``.
|
||||
|
||||
References:
|
||||
- PLAYBOOK.md §2.9
|
||||
- AUDIT_R2.md §1.2 (C7 — JSONL writes must be lock-protected)
|
||||
- AUDIT_R3.md C16 (writes must catch OSError; never tear down the run)
|
||||
- AUDIT_R3.md F3 (every TracingProcessor hook is SYNC, not async)
|
||||
``strix_runs/<run-name>/events.jsonl``. PII scrubbing runs through
|
||||
:class:`TelemetrySanitizer`.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -47,17 +41,11 @@ def _lock_for(path: Path) -> threading.Lock:
|
||||
class StrixTracingProcessor(TracingProcessor):
|
||||
"""Append trace + span events as JSONL into ``run_dir/events.jsonl``.
|
||||
|
||||
Every hook is synchronous — required by ``TracingProcessor`` ABC.
|
||||
Every write is protected by a per-path ``threading.Lock`` so concurrent
|
||||
spans (e.g., from parallel agent tasks) cannot interleave bytes
|
||||
mid-line and corrupt the JSONL (C7).
|
||||
|
||||
Every write is wrapped in ``try/except OSError`` so a full disk or a
|
||||
permission error during the run does NOT propagate up the hook chain
|
||||
and tear down the agent (C16).
|
||||
|
||||
PII scrubbing via :class:`TelemetrySanitizer` runs on every event
|
||||
before it hits the file.
|
||||
Every hook is synchronous — required by the ``TracingProcessor``
|
||||
ABC. Each write is protected by a per-path ``threading.Lock`` so
|
||||
concurrent spans can't interleave bytes mid-line. ``OSError`` is
|
||||
swallowed so a full disk or permission error doesn't tear the run
|
||||
down. PII scrubbing runs on every event before it hits the file.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -80,8 +68,8 @@ class StrixTracingProcessor(TracingProcessor):
|
||||
def _emit(self, event: dict[str, Any]) -> None:
|
||||
"""Sanitize ``event`` and append it as one JSONL line.
|
||||
|
||||
Failures are swallowed — we'd rather lose a trace event than fail
|
||||
the run. Errors are logged at WARNING (C16).
|
||||
Failures are swallowed — we'd rather lose a trace event than
|
||||
fail the run.
|
||||
"""
|
||||
try:
|
||||
clean = self.sanitizer.sanitize(event)
|
||||
|
||||
Reference in New Issue
Block a user