Skip to content

feat(den): add provider contract and managed sync#1939

Closed
pascalandr wants to merge 26 commits into
different-ai:devfrom
Pagecran:pr/credential-contract-managed-sync
Closed

feat(den): add provider contract and managed sync#1939
pascalandr wants to merge 26 commits into
different-ai:devfrom
Pagecran:pr/credential-contract-managed-sync

Conversation

@pascalandr

@pascalandr pascalandr commented May 24, 2026

Copy link
Copy Markdown
Contributor

Dependency map

Pagecran/dev
`-- stack/provider-credential-contract-base          (A)
    |-- pr/den-managed-provider-sync                 (B)
    `-- stack/den-api-oauth-credential-handling      (C)
        |-- stack/oauth-device-flow-and-ui           (D)
        `-- stack/desktop-import-oauth-providers     (E)

Scope

  • Includes map parts: A + B.
  • Adds the LLM provider credential contract base for OAuth-backed OpenCode credentials.
  • Adds Den to worker managed-provider sync through a host-token-only runtime endpoint.
  • Includes Den API and server managed-provider sync behavior.

Tests

  • pnpm --filter @openwork-ee/den-db build - PASS.
  • From ee/apps/den-api: pnpm exec tsc -p tsconfig.json --noEmit - PASS.
  • From ee/apps/den-api: pnpm exec bun test test/managed-provider-sync.test.ts - PASS, 6 tests.
  • From apps/server: pnpm exec bun test src/managed-provider-sync.e2e.test.ts - PASS, 3 tests.

Linked issues

Add the LLM provider credential kind/opencode auth storage contract, migration, and passive credential redaction/flags needed by follow-up provider credential and worker sync PRs.
Include organization context variables in worker route typing so managed provider sync typechecks without changing runtime behavior.
@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

@pascalandr is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 10, 2026 4:54pm

Translate Den catalog model metadata through an explicit OpenCode-compatible allowlist before writing managed provider runtime config. Preserve boolean experimental values while dropping incompatible catalog metadata covered by focused regression tests.
Filter Den-managed provider-list responses to configured model IDs so OAuth providers keep native auth IDs without exposing the full OpenCode catalog. Adds focused regression coverage for OpenAI OAuth and NVIDIA API-key managed providers.
Apply only product code from the mixed integration commit for the managed provider sync PR branch, excluding workflow and evidence artifacts.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 10 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread ee/apps/den-api/src/routes/workers/managed-providers.ts
Comment thread ee/apps/den-api/src/routes/org/llm-providers.ts Outdated
Comment thread apps/server/src/server.ts Outdated
Merge upstream/dev into pr/credential-contract-managed-sync and resolve managed-provider sync route plus Den DB migration numbering conflicts.
Ensure Den-managed providers remain visible to the desktop model picker when OpenCode returns an empty connected provider list, and cover the static Den regression.
Use OpenCode's PUT /auth/{providerID} contract with the auth object as the request body so Den-managed API key and OAuth credentials are applied before runtime model invocation.
Add the managed-provider sync 502 OpenAPI response, correct OAuth credential presence reporting, and roll back opencode config writes when runtime auth application fails.
…ct-managed-sync

# Conflicts:
#	ee/packages/den-db/drizzle/meta/_journal.json
Import the JSONC path updater used by managed provider sync so runtime config writes succeed before auth is applied and rollback tests remain meaningful.
Remove stale managed providers and auth during authoritative Den sync, roll back auth writes on failed sync attempts, and filter revoked providers from runtime provider lists.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/server/src/server.ts Outdated
Update managed-provider sync proxy assertions to use the normal bearer token path so the tests remain valid after host tokens are limited to host-only routes.
Move stale managed-provider auth deletion after config commit so rollback never restores config that references already-deleted stale auth, with regression coverage for deletion failure.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/server/src/server.ts
Keep stale managed provider IDs in metadata until auth deletion succeeds so failed stale cleanup remains retryable without restoring config that references deleted auth.
Sync only to healthy current worker runtimes and restore prior provider auth on failed runtime credential updates.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/server/src/server.ts
Validate managed provider runtime id uniqueness before mutating config or auth state so rollback snapshots cannot be overwritten by duplicate payload entries. Adds a regression proving duplicate ids fail without touching existing auth.
Add an explicit array guard around provider-list model filtering and cover array-shaped provider model lists so managed allowlists do not collapse them through numeric Object.entries keys.
Filter array-shaped provider-list models by Den managed-provider allowlists while preserving array shape. Adds regression coverage so allowed model ids remain visible and disallowed ids are removed.
@cubic-dev-ai

cubic-dev-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown

You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment @cubic-dev-ai review.

@pascalandr

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@pascalandr I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Re-trigger cubic

@pascalandr

Copy link
Copy Markdown
Contributor Author

Superseded by the clean consolidated managed providers PR #2175.

@pascalandr pascalandr closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant