Skip to content

fix(ai): align conversation execution and query tool contracts - #782

Draft
izadoesdev wants to merge 1 commit into
stagingfrom
codex/conversation-policy-discovery
Draft

fix(ai): align conversation execution and query tool contracts#782
izadoesdev wants to merge 1 commit into
stagingfrom
codex/conversation-policy-discovery

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 10, 2026

Copy link
Copy Markdown
Member

Conversational requests such as “Thanks, what is our retention?” could lose every tool through keyword filtering. MCP data calls also repeatedly supplied a preset and explicit dates together, while dashboard Balanced reasoning sent Anthropic options to the configured OpenAI model.

Use one native ToolLoopAgent setup for dashboard and shared MCP/Slack execution, derive provider options from the selected model, attribute billing to the actual model, and expose the existing analytics discovery/schema tools without keyword gating. Make optional internal MCP data inputs nullable on the wire and normalize them with Zod before the unchanged query planner. Keep strict generation; disabling it alone did not fix the observed failures. The dashboard default reasoning label now reflects provider defaults. Production/config code is reduced by 203 lines.

Validation:

  • Root lint, all 33 workspace typecheck tasks and the full 27-task test suite pass. AI package: 728 passed, 229 integration/environment skips, zero failed.
  • Six regression tests fail against clean staging and pass with the changes. Native SDK tests cover retries without repeating a completed mutation, cancellation, scope/callback/stopping preservation, nullable input normalization and conflicting-date rejection. Actual dashboard HTTP tests verify billing failures stop model execution and usage uses the executed model ID.
  • 48 live native-config MCP attempts: six frozen synthetic cases, two repeats, baseline plus three candidates, same configured Terra model and 45-second limits. Baseline and the first two candidates answer 0/10 data tasks; the final schema repair answers 6/10, with 2/2 greeting controls passing. Native date conflicts fall from 26 to zero. All four retention attempts still fail at discovery. Input tokens rise from 246,238 to 560,614 (includes cached inputs); sample median latency falls from 19.35s to 12.87s. These are diagnostic measurements, not a general efficiency claim. SQL/schema/profile alternatives were deliberately unavailable in the synthetic backend, so this measures supported builder workflows rather than all production strategies. Failed variants, timeouts, fixtures and raw traces remain in the task’s local evidence archive.
  • Four isolated live provider probes accept both old and corrected settings with correct arithmetic. Wire capture verifies the OpenAI option namespace; responses do not confirm effective reasoning effort or prove a quality gain.

Review limits: broader tool exposure increases context cost; retention discovery remains unreliable. Dashboard billing-provider errors now fail the request, matching MCP, instead of allowing execution. No database-schema, history, delivery or investigation-loop migration; no dependency on #751. Kept as a draft for review; no deployment or merge performed. AI-assisted, maintainer-directed implementation with independent read-only review.


Summary by cubic

Aligns conversation execution and query tool contracts so casual requests like “what is our retention?” keep all tools, provider options match the selected model, and MCP data inputs accept the same wire format across clients.

Changes

  • Replaces keyword-based tool filtering with a single native ToolLoopAgent setup for dashboard, MCP, and Slack.
  • Derives provider options and temperature from the actual model ID, not the UI tier, and attributes billing to the executed model.
  • Makes optional MCP data inputs nullable on the wire and normalizes them with Zod before the query planner; strict generation stays on.
  • Exposes the existing analytics discovery and schema tools without keyword gating.
  • Dashboard “Off” thinking label now reads “Default” to reflect provider defaults.

Side effects

  • Dashboard billing and credit failures now stop the request instead of allowing execution.
  • Broader tool exposure increases context cost; retention discovery remains unreliable.
  • No migration steps required; production and config code are reduced by 203 lines.

Written for commit f612504. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dashboard Ready Ready Preview Sep 10, 2026 10:03am UTC
databuddy-status Ready Ready Preview Sep 10, 2026 10:03am UTC
1 Skipped Deployment
Project Deployment Actions Updated
documentation Skipped Skipped Sep 10, 2026 10:03am UTC

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4fab908f-f127-4593-8d87-2788101dc12d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant