mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 04:29:01 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - When a normal agent fails with a provider authentication error, `connectionIntentService.requestForRunAuthFailure` infers the AI provider from the agent's model and attaches a pending `"Connect <Provider>"` interaction card on the issue thread. > - Cloud starter-inference agents (`runtimeConfig.cloudTrialInference: true`, no saved `aiConnection`) run OpenCode with `openrouter/openai/gpt-6-luna` through Paperclip Cloud's server-side proxy instead of a user-saved OpenRouter connection. > - If a starter-inference run ever encounters an OpenRouter 401 failure, `requestForRunAuthFailure` attached a pending `"Connect OpenRouter"` card, causing the agent to keep nagging the user to respond to that card on subsequent turns even after succeeding. > - This pull request skips `requestForRunAuthFailure` for agents using Cloud starter inference without a saved `aiConnection`, leaving `CloudTrialGate` as the single owner of prompting users to connect a model provider. > - The benefit is that starter-inference chats never accumulate stale `"Connect OpenRouter"` cards. ## Linked Issues or Issue Description Refs #23401, #23616 **Summary** Skip creating a `"Connect OpenRouter"` `connection_intent` card in `requestForRunAuthFailure` when the agent runs on Cloud starter inference (`runtimeConfig.cloudTrialInference: true` without a saved `aiConnection`). **Steps to Reproduce** 1. Run an OpenCode agent configured with `runtimeConfig.cloudTrialInference: true` and `adapterConfig.model: "openrouter/openai/gpt-6-luna"` (no `runtimeConfig.aiConnection`). 2. Trigger an OpenRouter HTTP 401 authentication failure on a run. 3. Observe `requestForRunAuthFailure` creating a pending `"Connect OpenRouter"` `issue_thread_interactions` row on the chat issue. **Expected Behavior** `requestForRunAuthFailure` returns `null` and creates no pending `"Connect OpenRouter"` interaction for Cloud starter-inference agents. ## What Changed - `server/src/services/connection-intents.ts`: Returned `null` in `requestForRunAuthFailure` when `!saved && !router && isAgentUsingCloudTrialInference(agent.runtimeConfig)`. - `server/src/__tests__/connection-intents-service.test.ts`: Added a regression test proving that an OpenRouter 401 failure on a Cloud starter-trial agent returns `null` and creates zero `issue_thread_interactions` rows. ## Verification - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/connection-intents-service.test.ts -t "does not create a Connect OpenRouter card|adopts a Copilot account"` — passed (2/2 tests). - `pnpm --filter @paperclipai/server typecheck` — passed (0 errors). ## Risks - Low risk. Narrow 1-line guard scoped strictly to agents with `runtimeConfig.cloudTrialInference === true` and no saved `aiConnection`. Normal agents with or without saved AI connections keep their exact existing auth-repair behavior. ## Model Used - Google Gemini (Antigravity agentic runtime, thinking mode with tool use and local code execution). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [ ] I will address all Greptile and reviewer comments before requesting merge