fix(integrations): stop reporting projectless tool discovery as an error - #3557
Conversation
An unlinked local project runs on the credential `veryfront login` stores, which carries no project claim, and has no project slug to send. The project-scoped integration tools API rejects that request with 400, and every agent request logged the rejection at error level - a red failure line for integrations the developer never configured. Classify the rejection instead: a 400 from a runtime that could not name a project is the expected state of an unlinked project and is now logged at debug. Every other discovery failure, including a 400 for a runtime that did send a project slug, stays an error.
|
Warning Review limit reached
Next review available in: 9 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughRemote tool discovery now passes project scope into catalog requests, preserves tool-list response statuses, and handles projectless HTTP 400 responses as unavailable at debug level. Tests verify logging for projectless, project-scoped, and server failures. ChangesRemote tool discovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/integrations/remote-tools.ts`:
- Around line 64-72: Replace the IntegrationToolListResponseError class with a
defineError-based VeryfrontError registry entry that preserves the status
payload and API error message. Update the integration failure handling near the
existing status check to first require instanceof VeryfrontError and the
expected error slug, then inspect status.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2ed03e20-f548-4781-9186-0799065ad037
📒 Files selected for processing (2)
src/integrations/remote-tools.test.tssrc/integrations/remote-tools.ts
…gistry
Replace the ad-hoc IntegrationToolListResponseError class with a
defineError entry, matched by `instanceof VeryfrontError` plus the slug,
so the typed discovery failure follows the repository error contract.
The upstream status rides on `create({ status })`, so the projectless
400 classification is unchanged.
Also regenerate docs/api-reference for the shifted source line pins.
Found by a DX dogfood walk of https://veryfront.com/docs/code/getting-started/quickstart against published CLI 0.1.1228.
Symptom
In a scaffold that declares no integrations at all, with a valid stored login token (
veryfront whoami→ logged in), every agent request emitted an error-level line in the dev server log:A new developer gets a red failure line, once per run, for a feature they never configured.
Root cause
The integration tools endpoint is project scoped.
veryfront devin an unlinked project puts theveryfront loginsession credential intoVERYFRONT_API_TOKEN(cli/shared/runtime-auth.ts) but has no project to put intoVERYFRONT_PROJECT_SLUG. That credential carries no project claim, so the API cannot resolve a project and rejects the request:discoverRemoteIntegrationToolCataloglogged every such failure atlogger.error, so the expected state of an unlinked project was reported as an application error.The request itself is not removed. A credential with no project slug is a supported configuration elsewhere in this module (see
does not inherit host project scope for an explicit projectless credential, andbuildAgentStreamEnvwhich setsVERYFRONT_API_TOKENfrom a proxy token whileVERYFRONT_PROJECT_SLUGis conditional) — a project-scoped token resolves its own project server-side, so the framework cannot know in advance that the call is unusable. What it can do is classify the answer.Fix
fetchToolListnow throws a typedIntegrationToolListResponseErrorcarrying the HTTP status, and discovery classifies it:logger.debug, "Skipped remote integration tools: no project scope for this runtime".logger.error.The returned
{ status: "unavailable", reason: "request_failed" }is unchanged, so no caller behaviour changes.Regression test
src/integrations/remote-tools.test.ts— Deno BDD, colocated with the module. This is reproducible entirely in-process: mock fetch, env-driven token/slug resolution, and log records captured via__subscribeLogRecordEmitter. No browser and no credentials, so it runs in the pre-push gate;veryfront-e2ewould have needed a real dev server and a real 400 from the live API to assert on a log line.Three cases:
reports a projectless integration tools rejection below error leveldebugrecord, noerrorrecordstill reports integration tool discovery failures for a project-scoped runtimeerrorstill reports integration tool discovery server failures at error levelerrorConfirmed failing before the fix for the right reason — the first case produced the exact record from the finding:
End-to-end verification
Driving the worktree's
getRemoteIntegrationToolDiscovery()against the live API with the stored login token and no project slug:git stashof the source change):✖ Failed to fetch remote integration tool definitions error="Integration tools API returned 400 Bad Request"VERYFRONT_DEBUG=1,· Skipped remote integration tools: no project scope for this runtimeFull pre-push suite passed.
Summary by CodeRabbit