Skip to content

feat(oauth): surface validated Cloud Code Assist appeal links on paused accounts - #8936

Merged
lidge-jun merged 1 commit into
devfrom
lane3/8752-appeal-url
Nov 19, 2026
Merged

lidge-jun merged 1 commit into
devfrom
lane3/8752-appeal-url

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

When Google suspends a Cloud Code Assist account for a Terms of Service violation, its 403 response includes an appeal_url. #8826 now pauses the account on the first conclusive ban, and #8751 stores the sanitized refusal as pauseEvidence, but the appeal link was still dropped, so operators never learned an appeal was possible.

This PR keeps that link and shows it on the paused account in the Accounts view.

  • Where the link can come from. It is only taken from the same conclusive ban that triggers the pause: a google.rpc.ErrorInfo with reason TOS_VIOLATION and domain cloudcode-pa.googleapis.com, on a first-party OAuth send made with the expected credential.
  • Which links are accepted. https only, with no user info, no port, and a length cap. The host must be exactly forms.gle, support.google.com, or docs.google.com under /forms/. Query strings are kept only on the two Forms hosts, and fragments are removed. Anything else is dropped.
  • Where it appears. The link is stored as pauseEvidence.appealUrl, returned by GET /api/oauth/accounts, and cleared on resume along with the rest of the evidence. Older builds ignore the extra field.
  • How it renders. The dashboard shows it as an external link (target="_blank", rel="noopener noreferrer"). It uses Google's short plain-text label when one is present and a localized "Submit appeal" otherwise.
  • Logging. A fixed notice is logged once per account per process saying that an appeal link is available. It never includes the URL or the account ID.

Paused Cloud Code Assist account with a Submit appeal link

Closes #8752

Verification

  • Wrote the regressions first: 6 backend and 12 GUI tests failed on the feat(accounts): keep the upstream message and status on an auto-paused account #8751 base and pass here.
  • bun test tests/oauth/oauth-account-auto-pause.test.ts tests/server/management-account-auto-pause.test.ts, the file-size ratchet, test layout, and Spanish localization: 149 passed, 0 failed on this rebased head (independently rerun by the reviewer).
  • cd gui && bun test tests/account-pause-display.test.tsx: 29 passed.
  • Before the rebase, all 4,626 GUI tests passed, along with GUI lint, i18n lint, and the GUI and docs builds.
  • bun run typecheck, bun run structure:check, and bun run privacy:scan passed.
  • A gpt-6.2-sol maintainer security review (APPROVE, SECURITY APPROVE) tried to get past the allowlist with lookalike, IDN and punycode hosts, trailing dots, ambiguous authorities, user info, ports, javascript: and data: URLs, google.com/url redirects, and overlong values. It also checked where links can come from, that no URL or account ID is logged, the rendered link attributes, clearing on resume, and that the previous build still reads the stored record.
  • Not run: the full suite, a live Cloud Code Assist ban, or following the redirect behind an allowed short link.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 19, 2026 03:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T03:43:42.811463Z e1c5dbe PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change extracts validated appeal details from qualifying first-party Cloud Code Assist bans and adds them to account pause evidence. The dashboard displays a localized appeal link for paused accounts. Resuming an account clears its pause details and evidence.

Changes: Cloud Code Assist appeal evidence

Layer / File(s) Summary
Evidence contract and extraction
src/types/account-auto-pause.ts, src/lib/cloud-code-appeal-link.ts, src/oauth/account-auto-pause-policy.ts, src/config/schema/account-auto-pause.ts, tests/oauth/oauth-account-auto-pause.test.ts, structure/account-auto-pause.md
The evidence type adds optional appeal URL and text fields. Normalizers restrict accepted URLs and labels. The refusal policy extracts normalized appeal details from matching Google ErrorInfo on a conclusive first-party ban, and the schema revalidates them.
First-party capture and logging
src/oauth/account-auto-pause.ts, tests/oauth/oauth-account-auto-pause.test.ts, docs-site/src/content/docs/reference/configuration/account-auto-pause.md, docs-site/src/content/docs/es/reference/configuration/account-auto-pause.md
The observer checks provider, destination, send ownership, and API-key headers before treating a send as first-party. It passes that status to the refusal policy and logs appeal-link availability once per account without logging the URL.
Dashboard display and pause lifecycle
gui/src/components/provider-workspace/*, gui/src/hooks/useProviderAccountPools.ts, gui/src/i18n/*, gui/tests/account-pause-display.test.tsx, tests/server/management-account-auto-pause.test.ts, docs-site/src/content/docs/reference/management-api.md, docs-site/src/content/docs/es/reference/management-api.md, structure/account-auto-pause.md
OAuth account types carry pause evidence. For paused accounts with a valid URL, the dashboard renders a new-tab link with safe rel attributes and a localized fallback label. Resuming clears pause details and evidence. Tests and API documentation cover the evidence and resume behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant CloudCodeAssist
  participant AccountPauseObserver
  participant RefusalPolicy
  participant ManagementAPI
  participant ProviderAuthPanel
  CloudCodeAssist->>AccountPauseObserver: Return first-party ban response
  AccountPauseObserver->>RefusalPolicy: Classify response and extract appeal evidence
  RefusalPolicy-->>AccountPauseObserver: Return normalized pause evidence
  AccountPauseObserver->>ManagementAPI: Make pause evidence available for account data
  ManagementAPI-->>ProviderAuthPanel: Return account pause evidence
  ProviderAuthPanel->>ProviderAuthPanel: Validate URL and render localized appeal link
Loading

Possibly related issues

  • lidge-jun/opencodex#8760 — The issue concerns a Cloud Code Assist ToS refusal and appeal link. This change covers appeal-link extraction and display, but not its requests for distinct error handling or preventing repeated sends.

Possibly related PRs

  • lidge-jun/opencodex#8751 — Defines the pauseEvidence field that this change extends with appeal details.
  • lidge-jun/opencodex#8826 — Defines the implicit first-ban auto-pause behavior that this change uses when determining whether to record appeal evidence.
  • lidge-jun/opencodex#7819 — Adds the Cloud Code Assist ToS-ban classification that this change uses to identify qualifying responses.
Merge Risk: Minimal · up to e1c5d

This change adds a validated Google appeal link to paused Cloud Code Assist accounts and clears it on resume. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(oauth): surface validated Cloud Code Assist appeal links on paused accounts" matches the main change. The changeset validates and normalizes appeal URLs and text, stores them in pauseE…
Linked Issues check Passed Directly linked issue #8752 has four coding requirements. (1) Pause a conclusive Cloud Code Assist ToS ban on first occurrence without opt-in: head src/oauth/account-auto-pause.ts calls `effectiveAc…
Out of Scope Changes check Passed All changed areas support the appeal-link objective. Backend changes: the link normalizer src/lib/cloud-code-appeal-link.ts, the policy and schema changes, the type fields, and the `captureAccountAu…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "feat(oauth): surface validated Cloud Code Assist appeal links on paused accounts" matches the main change. The changeset validates and normalizes appeal URLs and text, stores them in pauseEvidence, exposes them through the management API, renders a Submit appeal link in ProviderAuthPanel, adds i18n keys, and clears evidence on resume. The title is a single sentence, specific, and free of file lists or vague terms. It does not mention the logging change or docs updates, which is expected.

Full details: Linked Issues check

Explanation

Directly linked issue #8752 has four coding requirements. (1) Pause a conclusive Cloud Code Assist ToS ban on first occurrence without opt-in: head src/oauth/account-auto-pause.ts calls effectiveAccountAutoPause(config.providers[name]), which applies conclusiveOnly when no policy is configured, and passes conclusiveOnly into permanentAccountRefusalEvidence. The PR description attributes this to #8826, and this PR does not change that gate. I could not read the merge-base copy of this file (the base read failed), so the pre-existing status is inferred from the PR text and the unchanged gate logic. (2) Surface appeal_url through the management API: AccountPauseEvidence gains appealUrl/appealText (src/types/account-auto-pause.ts), accountPauseEvidenceSchema normalizes them (src/config/schema/account-auto-pause.ts), and permanentAccountRefusalEvidence extracts them from matching ErrorInfo (src/oauth/account-auto-pause-policy.ts). (3) Show the link in the dashboard: ProviderAuthPanel.tsx renders it for paused OAuth rows with target="_blank" and rel="noopener noreferrer", and GUI tests in gui/tests/account-pause-display.test.tsx cover it. (4) Log once per account: appealNotices in src/oauth/account-auto-pause.ts gates a fixed appeal link available message per config path and account key, with no URL or account ID. The issue does not specify URL validation. The allowlist (forms.gle, support.google.com, docs.google.com under /forms/) is a PR-specific hardening choice and does not conflict with the issue example https://forms.gle/.... The requirements are met, subject to the base-attribution uncertainty noted above.

Full details: Out of Scope Changes check

Explanation

All changed areas support the appeal-link objective. Backend changes: the link normalizer src/lib/cloud-code-appeal-link.ts, the policy and schema changes, the type fields, and the captureAccountAutoPauseAttempt notice. GUI changes: the OAuthAccountRow and OAuthAccount type fields, the ProviderAuthPanel render, and the accountPause.submitAppeal label in the i18n catalogs. Tests and docs cover the same behavior. The firstPartyCloudCodeSend flag is required to limit appeal extraction to first-party sends, which the appeal objective needs. No unrelated change was identified in the summary.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 780803b and e1c5dbe.

Files selected for processing: 27

  • docs-site/src/content/docs/es/reference/configuration/account-auto-pause.md
  • docs-site/src/content/docs/es/reference/management-api.md
  • docs-site/src/content/docs/reference/configuration/account-auto-pause.md
  • docs-site/src/content/docs/reference/management-api.md
  • gui/src/components/provider-workspace/ProviderAuthPanel.tsx
  • gui/src/components/provider-workspace/types.ts
  • gui/src/hooks/useProviderAccountPools.ts
  • gui/src/i18n/de.ts
  • gui/src/i18n/en.ts
  • gui/src/i18n/fr.ts
  • gui/src/i18n/ja.ts
  • gui/src/i18n/ko.ts
  • gui/src/i18n/pt.ts
  • gui/src/i18n/ru.ts
  • gui/src/i18n/tr.ts
  • gui/src/i18n/vi.ts
  • gui/src/i18n/zh-TW.ts
  • gui/src/i18n/zh.ts
  • gui/tests/account-pause-display.test.tsx
  • src/config/schema/account-auto-pause.ts
  • src/lib/cloud-code-appeal-link.ts
  • src/oauth/account-auto-pause-policy.ts
  • src/oauth/account-auto-pause.ts
  • src/types/account-auto-pause.ts
  • structure/account-auto-pause.md
  • tests/oauth/oauth-account-auto-pause.test.ts
  • tests/server/management-account-auto-pause.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Nov 19, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration record (lane L3, 2026-11-19).

Integrating exact head e1c5dbe4ff2f09acdfa8071fca888a3bb5f3b82e under the maintainer-integration path. This is the second half of #8752; #8826 and #8751 delivered the first. Closes #8752.

  • Review. The gpt-6.2-sol reviewer who reviewed feat(accounts): keep the upstream message and status on an auto-paused account #8751 also reviewed this change, both before and after the rebase, and gave APPROVE and SECURITY APPROVE. All 27 path patches match the approved commit.

  • Security scope. The URL is accepted only from the conclusive first-party OAuth TOS_VIOLATION envelope. It must be https with no user info or port, and the host must be exactly forms.gle, support.google.com, or docs.google.com/forms/. 24 attack inputs were rejected. A fixed notice is logged once per account with no URL or account ID. The link renders with noopener noreferrer, is cleared on resume, and older builds still read the record. The redirect target behind an allowed short link is not verified.

  • CI. Exact-head PR CI is green.

  • Union guards on the merge with current dev: file-size ratchet, test layout, Spanish localization, preset counts, typecheck, and structure:check all passed.

  • Files also changed on dev since the branch base: gui/src/components/provider-workspace/ProviderAuthPanel.tsx gui/src/components/provider-workspace/types.ts gui/src/i18n/de.ts gui/src/i18n/en.ts gui/src/i18n/fr.ts gui/src/i18n/ja.ts gui/src/i18n/ko.ts gui/src/i18n/pt.ts gui/src/i18n/ru.ts gui/src/i18n/tr.ts gui/src/i18n/vi.ts gui/src/i18n/zh-TW.ts gui/src/i18n/zh.ts

@lidge-jun
lidge-jun merged commit 5aaf8fa into dev Nov 19, 2026
36 of 38 checks passed
@lidge-jun
lidge-jun deleted the lane3/8752-appeal-url branch November 19, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cloud Code Assist ToS account ban is detected but never pauses the account, and the appeal_url is discarded

1 participant