Skip to content

Add GitHub sign-in, AI Gateway choices, and code push - #2

Merged
implemented.stream (thanabartbb) merged 1 commit into
mainfrom
cursor/github-login-vercel-gateway-c0d8
Oct 14, 2026
Merged

implemented.stream (thanabartbb) merged 1 commit into
mainfrom
cursor/github-login-vercel-gateway-c0d8

Conversation

@thanabartbb

@thanabartbb implemented.stream (thanabartbb) commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Chat history can follow a GitHub account, the model picker can use Vercel AI Gateway, and a reply's code block can be committed through the GitHub API. The server still does not run that code.


Note

High Risk
Introduces OAuth, encrypted token storage, and GitHub repo write via the Contents API—security-sensitive paths that need correct secrets, migration order, and CSRF/origin enforcement in production.

Overview
Adds GitHub OAuth on /chat so history can follow a signed-in account instead of only the anonymous cookie. OAuth stores an AES-GCM–encrypted access token in D1 (github_credentials, migration 0006_github_auth) and uses a signed nvx_auth session cookie; first sign-in promotes or moves anonymous conversations. Sign-out clears the credential row; chats stay on the user.

Extends User Chat with Vercel AI Gateway as a new gateway mode and six allowlisted models in the picker (enabled when AI_GATEWAY_API_KEY is set). Turns stream through a new gateway client with fallback to Workers AI / HF.

Adds push one fenced code block to GitHub via POST /api/github/contents (and repo listing), with UI GithubPublish, path/repo validation, same-origin checks, and rate limits—the server does not run committed code.

Chat APIs switch from cookie-only identity to resolveActor (GitHub session preferred). Docs, env examples, CSP (GitHub avatars), i18n, and tests/github-auth.test.ts are updated. Remote D1 must apply 0006 before production sign-in works.

Reviewed by Cursor Bugbot for commit 559497b. Bugbot is set up for automated code reviews on this repo. Configure here.

Chat history can follow a GitHub account, the model picker can use Vercel AI Gateway, and a reply's code block can be committed through the GitHub API. The server still does not run that code.

Co-authored-by: thanabartbb <thanabartbb@users.noreply.github.com>
@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 3e632787-4baf-4a35-8f35-52891a259971)

@thanabartbb
implemented.stream (thanabartbb) merged commit 60458a6 into main Oct 14, 2026
5 of 6 checks passed
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.

2 participants