Factory experiment 4. Hypothesis: Add structlog to 4 uninstrumented high-traffic modules.
What to Build
Add structured logging via structlog.get_logger() to these modules:
-
factory/mcp_server.py (8 functions, 0 log statements): Add log = structlog.get_logger() and log at function entry for list_tools, call_tool, server startup/shutdown, and tool dispatch errors.
-
factory/runners/__init__.py (2 functions, 0 log statements): Log runner selection and initialization.
-
factory/runners/_stream.py (3 functions, 0 log statements): Log stream processing start, chunk handling, and completion.
-
factory/runners/protocol.py (2 functions, 0 log statements): Log protocol method dispatch.
Use log.info() for key operations, log.debug() for routine paths, log.warning() for fallback/error paths. Follow existing codebase patterns — bind context with log.bind(runner=..., role=...) where relevant.
Acceptance Criteria
Constraints
- Read CLAUDE.md before starting
- Do NOT touch files outside declared scope
- Do NOT modify eval/score.py or .factory/
- Do NOT add logging to pure data models (models.py, ace/models.py)
- Use log.debug() for routine operations, log.info() for key state transitions
Factory experiment 4. Hypothesis: Add structlog to 4 uninstrumented high-traffic modules.
What to Build
Add structured logging via
structlog.get_logger()to these modules:factory/mcp_server.py(8 functions, 0 log statements): Addlog = structlog.get_logger()and log at function entry forlist_tools,call_tool, server startup/shutdown, and tool dispatch errors.factory/runners/__init__.py(2 functions, 0 log statements): Log runner selection and initialization.factory/runners/_stream.py(3 functions, 0 log statements): Log stream processing start, chunk handling, and completion.factory/runners/protocol.py(2 functions, 0 log statements): Log protocol method dispatch.Use
log.info()for key operations,log.debug()for routine paths,log.warning()for fallback/error paths. Follow existing codebase patterns — bind context withlog.bind(runner=..., role=...)where relevant.Acceptance Criteria
Constraints