Skip to content

[log] Add debug logging to jq middleware filter functions#6715

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
log/jqschema-middleware-logging-33108b076c2771bf
Draft

[log] Add debug logging to jq middleware filter functions#6715
github-actions[bot] wants to merge 1 commit into
mainfrom
log/jqschema-middleware-logging-33108b076c2771bf

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Adds logMiddleware.Printf calls to three functions in internal/middleware/jqschema.go that previously had no debug instrumentation:

Changes

  • CompileToolResponseFilter: logs filter expression length on entry, and confirms successful compilation on exit — useful for diagnosing filter parse/compile failures
  • tryApplyToolResponseFilter: logs the tool name, query ID, and whether a filter is active — helps distinguish between filtered and unfiltered tool call paths
  • rewriteFilteredTextPayload: logs the length of the filtered text being written back — provides visibility into the rewrite step when a tool response filter is applied

Why these functions?

These are key entry points in the tool response filter pipeline. The surrounding code (wrapToolHandler, savePayload, applyJqSchema) already has thorough logging, but these intermediate helpers were opaque when tracing filter-related issues under DEBUG=middleware:*.

Validation

  • make format build lint test-unit test-integration — all pass ✓
  • (Rust guard test skipped: network access to crates.io blocked in CI environment)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • index.crates.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "index.crates.io"

See Network Configuration for more information.

Generated by Go Logger Enhancement · sonnet46 14.2M ·

Add logMiddleware.Printf calls to CompileToolResponseFilter,
tryApplyToolResponseFilter, and rewriteFilteredTextPayload in
internal/middleware/jqschema.go. These functions previously had no
debug instrumentation despite being key entry points in the tool
response filter pipeline.

The new logs help trace:
- When a filter expression is compiled and its length (compile entry/exit)
- Whether a response filter is active per tool call (filter present/absent)
- Text payload rewrite size when filtered content is applied

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants