Add Droid SDK provider#2689
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
|
Latest Droid follow-up fixes pushed in c72f19b:
Validation: |
|
Addressed the unresolved Droid cleanup review thread in b1dabf8. Added a regression test covering two resumed Droid sessions where one Validation:
Note: the first full-suite run hit a timeout in |
| probe: { | ||
| installed: settings.enabled, | ||
| version: null, | ||
| status: settings.enabled ? "warning" : "warning", |
There was a problem hiding this comment.
Redundant ternary always returns "warning" for disabled status
Medium Severity
In makePendingDroidProvider, the ternary settings.enabled ? "warning" : "warning" always evaluates to "warning" regardless of whether Droid is enabled or disabled. When settings.enabled is false, the status likely needs to be "disabled" (matching the pattern used by other providers like Cursor, which reports status: "disabled" when the provider is turned off in the existing test assertions).
Reviewed by Cursor Bugbot for commit 6c25239. Configure here.
| "auto-accept-edits", | ||
| "medium-access", | ||
| "full-access", | ||
| ]; |
There was a problem hiding this comment.
Runtime mode medium-access persists across provider switches
Medium Severity
If a user selects medium-access on a Droid session and then switches to a non-Droid provider, the stored runtimeMode remains medium-access. The non-Droid getRuntimeModeOptions list excludes medium-access, so the Select component would display a value that doesn't appear in its own dropdown options. The user would see "Medium access" as the active selection but couldn't reselect it or see it in the list, leaving the UI in an inconsistent state until they manually pick a different mode.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 6c25239. Configure here.
ApprovabilityVerdict: Needs human review This PR adds a new Droid SDK provider integration with substantial new logic (~1000+ lines across driver, adapter, and provider files), introduces a new 'medium-access' runtime mode, and has three unresolved medium-severity bugs identified in review comments regarding status handling, UI state consistency, and token usage format. You can customize Macroscope's approvability policy. Learn more. |
|
Split the Droid adapter by responsibility in af7ffb0:
The Droid implementation is now 989 lines total across focused modules instead of one nearly 900-line adapter file. Validation:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit af7ffb0. Configure here.
| type: "turn.completed", | ||
| payload: { | ||
| state: "completed", | ||
| ...(context.activeTokenUsage ? { usage: context.activeTokenUsage } : {}), |
There was a problem hiding this comment.
Raw SDK token usage passed instead of canonical format
Medium Severity
The turn.completed event passes context.activeTokenUsage directly, which is a raw SDK TokenUsageUpdate object (with fields like inputTokens, outputTokens, cacheCreationTokens, cacheReadTokens, thinkingTokens). However, the thread.token-usage.updated event in DroidRuntimeEvents.ts properly converts using toTokenUsageSnapshot(message) to produce the canonical format (with fields like usedTokens, cachedInputTokens, reasoningOutputTokens). This inconsistency means downstream consumers reading usage from turn.completed get a different shape than the rest of the system.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit af7ffb0. Configure here.


Intention
Add Droid as a first-class T3 Code provider using Factory's TypeScript SDK: https://github.com/Factory-AI/droid-sdk-typescript
This is still WIP while we validate more real Droid permission, file, MCP, auth, and long-running streaming flows.
What this adds
droidto the shared provider, model, settings, runtime source, and driver contracts.createSession/resumeSessionfrom@factory/droid-sdkin a T3 provider adapter.gif,jpeg,png,webp) as base64 SDK image sources resolved through the existing attachment store.initResult.availableModels, including user/custom models, while preserving custom model ids so duplicate underlying models remain selectable.Implementation shape
The Droid adapter has been split by responsibility instead of keeping one large file:
DroidAdapter.ts: session lifecycle and adapter orchestration.provider/droid/DroidRuntimeEvents.ts: SDK message to T3 runtime event projection.provider/droid/DroidSdkMappings.ts: SDK model, access, reasoning, usage, approval, and user-input mappings.provider/droid/DroidAttachmentResolver.ts: attachment MIME validation and image loading.provider/droid/DroidAdapterTypes.ts: shared Droid adapter types.Security / safety notes
droid; prompt content is sent through the SDK rather than shell interpolation.Validation
droid exec --model glm-5.1 --cwd /tmp ...returneddroid-pong.HomeLab - GLM-5.1,HomeLab - Trinity-Large-Thinking,Direct - GPT-5.5-Fast-xHigh, andDirect - GPT-5.5-Low.numTurns; streaming, thinking, access-mode mapping, and custom model discovery were updated.bun fmtpassed.bun lintpassed with existing unrelated web warnings.bun typecheckpassed.cd apps/server && bun run test src/provider/Layers/DroidAdapter.test.ts src/provider/Layers/DroidProvider.test.ts.bun run testpreviously passed; after rebasing, one full parallel run hit three unrelated web timeout failures, and rerunning those exact files in isolation passed.Note
Add Droid SDK provider with session management, model discovery, and UI integration
droidprovider driver backed by@factory/droid-sdk, including a CLI health check (--version), model discovery via SDK session, and periodic status refresh emitting aServerProviderDraft.DroidAdaptersupporting session start/resume, turn streaming, permission and user-input routing, model/reasoning updates, spec mode onplaninteraction, interruption, and thread snapshot management.DroidProviderlayer with CLI probing, version parsing, timeout handling, and model list assembly (SDK-discovered + user custom models via settings fallback).droidprovider kind,DroidSettingsschema (enabled, binaryPath, customModels),medium-accessruntime mode, anddroid.sdk.*event source literals.CompactComposerControlsMenuandComposerFooterModeControlsnow render provider-dependent access mode labels and options (Droid uses Off/Low/Medium/High).medium-accessis a new runtime mode that maps toon-requestapproval policy andworkspace-writesandbox — existing clients sending this value will now route differently than the previous default (danger-full-access).Macroscope summarized af7ffb0.