feat: add query_logs tool for custom log queries (CI mirror of #333) - #341
feat: add query_logs tool for custom log queries (CI mirror of #333)#341jordienr wants to merge 12 commits into
Conversation
Adds a query_logs debugging tool that runs a custom read-only ClickHouse SQL query against a project's unified logs stream, for cases where the get_logs service presets are too coarse. Reuses the existing analytics logs endpoint and validates that queries are SELECT/WITH only.
- add function_edge_logs to the sql source-hint list so models can reach edge function invocation logs - require a non-empty sql query (.min(1)), matching execute_sql - add execution tests for query_logs: sql passthrough + timestamp defaulting, custom window forwarding, and empty-query rejection
- mark get_logs as deprecated on hosted projects in favour of query_logs, while keeping it as the path for CLI/self-hosted - document that query_logs (ClickHouse) is hosted-only and will not work on CLI/self-hosted yet
The permissive mention of iso_timestamp_start/iso_timestamp_end wasn't steering model behaviour, so narrow time-range questions silently inherited the 24h default and over-counted. Make it a directive instruction in both get_logs and query_logs, matching the mechanism that flipped tool selection.
The description promises iso_timestamp_start defaults to 24h before the end, but the handler always computed start from now(), so supplying only iso_timestamp_end produced an inverted/empty window. Derive the end first (supplied or now), then default start to end - 24h, shared by get_logs and query_logs.
Coverage Report for CI Build 29903778647Coverage increased (+0.1%) to 96.432%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Structured review done against this head (c1bdc7f, same SHA as #333, so everything transfers). CI green here confirms the #333 failures were fork-secrets only. The One blocker before the checkmark: the types regen drops fields that exist on main. Optional while you're in there: |
Same changes as #333, pushed to a branch on the repo (not a fork) so the e2e tests run with CI secrets — #333's
testcheck can't pass from the fork because forks don't receive secrets.Do not merge this in place of #333 unless we decide to; it exists to verify the e2e suite goes green with secrets available. #333 remains the review PR.
Identical head commit as #333 (
c1bdc7f).