feat(claude_sdk): add CSDK-019, tool prints to stdout for diagnostics - #83
feat(claude_sdk): add CSDK-019, tool prints to stdout for diagnostics#83bradAGI wants to merge 1 commit into
Conversation
Claude SDK and MCP were the two mature packs with no observability rule; OpenAI ships OAI-010 and ADK ships ADK-009 for the same pattern. Two Claude-SDK-specific consequences go beyond the lost log line OAI-010 describes. A tool defined in a Python SDK server is commonly served to the agent over an MCP stdio transport, where stdout carries the JSON-RPC frames and a loose print makes the client hit a parse error on a line that is not JSON. And when the SDK is driven programmatically, the host application is already reading the SDK's own message stream, so tool prints land interleaved with it rather than in the application's logs, attributable to no particular turn or tool call.
|
Thanks @bradAGI, this slots into the pack cleanly. CSDK-019 is unclaimed on One question on the Worth adding an |
Claude SDK and MCP were the two mature packs with no observability rule. OpenAI ships OAI-010 and ADK ships ADK-009 for the same
print()pattern.Two Claude-SDK-specific consequences go beyond the lost-log-line framing OAI-010 uses:
The fix reflects the first point: where the tool may be served over stdio, the log handler needs to write to stderr, which the transport leaves alone. Swapping
printfor a logger that still defaults to stdout doesn't fix that case.Severity/confidence match OAI-010 (
low/ 0.65) since the dominant case here is still the lost diagnostic. The sharper stdio-corruption case is the primary reading in MCP-023 (#82), where stdio is the default transport.Verification — engine built at
main:Fire (
print(...)in a@tool-decorated handler):CSDK-002, CSDK-019, CSDK-203Silent (
logger.info(...)withbasicConfig(stream=sys.stderr)):CSDK-002, CSDK-203(CSDK-002 and CSDK-203 are pre-existing rules firing on the fixture's untyped
argsparam and missing CLAUDE.md.)has_print_callmatches a bareprintcallee, sopprintand other attribute calls don't false-positive.No new predicates, so no
schema_versionbump.