feat(migration): phase 1 — Session + Tracer + RunConfig factory

Three foundation modules per PLAYBOOK §2.8 / §2.9 / §2.10 with all
relevant R2/R3 corrections (C7, C10, C11, C16, C21):

  strix/llm/strix_session.py            SessionABC wrapper around the
                                        legacy MemoryCompressor; on any
                                        compression failure, returns
                                        uncompressed history and
                                        permanently disables compression
                                        for the rest of the run (C10 +
                                        Round 3.4 W5/E2).

  strix/telemetry/strix_processor.py    SDK TracingProcessor that writes
                                        events.jsonl in our schema. All
                                        hooks SYNC per ABC (F3); writes
                                        protected by per-path
                                        threading.Lock (C7); OSError
                                        swallowed and logged (C16); PII
                                        scrubbed via the existing
                                        TelemetrySanitizer.

  strix/run_config_factory.py           make_run_config() with our
                                        defaults: parallel_tool_calls=
                                        False (C1 Phase-1 safe default),
                                        retry policy explicitly excludes
                                        401/403/400 (C11), reasoning
                                        effort + model_settings_override
                                        merge path (C21).
                                        make_agent_context() returns the
                                        canonical per-agent dict
                                        including is_whitebox/diff_scope/
                                        run_id (C21).

32 new smoke tests (197/197 total). mypy strict + ruff clean. Per-file
ignores added for tests/** S105/PT018 and for the two new src modules'
intentional broad-Exception catches (BLE001).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
0xallam
2026-04-25 00:01:05 -07:00
parent 3652b449d1
commit 375389b8bc
7 changed files with 1038 additions and 1 deletions
+8 -1
View File
@@ -248,11 +248,13 @@ ignore = [
"strix/llm/llm.py" = ["PLC0415"]
"strix/tools/notes/notes_actions.py" = ["PLC0415"]
"tests/**/*.py" = [
"S106", # Possible hardcoded password
"S105", # Possible hardcoded password (string literal)
"S106", # Possible hardcoded password (function call)
"S108", # Possible insecure usage of temporary file/directory
"ARG001", # Unused function argument
"ARG002", # Unused method argument (test helpers / fakes mirror SDK signatures)
"PLR2004", # Magic value used in comparison
"PT018", # Multi-part assertions are a pytest style preference
"TC002", # Type-only third-party import (tests import for runtime instantiation)
"TC003", # Type-only stdlib import
]
@@ -281,6 +283,11 @@ ignore = [
"strix/tools/_decorator.py" = [
"TC002", # FunctionTool imported for annotation
]
# StrixSession + StrixTracingProcessor catch broad Exception intentionally:
# the whole point is that compressor / sanitizer / disk failures must not
# tear down the agent run (C10, C16). Calls already log at exception level.
"strix/llm/strix_session.py" = ["BLE001"]
"strix/telemetry/strix_processor.py" = ["BLE001"]
[tool.ruff.lint.isort]
force-single-line = false