Skip to content

fix: keep the assistant.read scope for existing OAuth2 clients - #14200

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/retain-assistant-scope
Oct 7, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/retain-assistant-scope

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Removing the Assistant in #14167 also removed the assistant.read scope. OAuth2 clients registered while it existed, such as the ChatGPT app, still request project:assistant.read, and Cloud now rejects their authorization with invalid_scope - Scope 'project:assistant.read' is not supported.

This brings the scope back as deprecated, with a comment saying why. Deprecated scopes stay known (keys and OAuth2 requests carrying them stay valid) but are left out of defaults and grant nothing; the endpoint stays removed. V25 still strips it from stored keys, functions and sites.

Cloud needs a matching allowlist entry in app/config/scopes/oauth2.php once this lands.

Part of #14203

Removing the Assistant (#14167) also removed the assistant.read scope. OAuth2 clients registered while it existed, such as the ChatGPT app, still request project:assistant.read, and Cloud now rejects their authorization with invalid_scope. Bring the scope back as deprecated so it stays a known scope without granting anything.
@luxor-code-review

luxor-code-review Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 1 nitpick below.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Re-added assistant.read scope is again assignable to new keys (project.php:428) — The PR re-adds assistant.read to the projectScopes whitelist to keep legacy OAuth2 clients (e.g. ChatGPT) working, but that same whitelist validates the scopes parameter of API key creation and updates (Project/Keys/Create.php:73, Project/Keys/Update.php:68, plus Functions and Sites key creation).

This is a one-file change restoring the retired assistant.read scope to app/config/scopes/project.php so existing OAuth2 client registrations (e.g. ChatGPT integrations) that request it continue to validate. The scope maps to no live route, so it grants no capability; the one concern below concerns its side-effect on the API-key scope whitelist.

Files Change
app/config/scopes/project.php Re-adds the deprecated assistant.read entry (with a deprecated marker) to the projectScopes whitelist.

Reviewed commit: d655fd9

@ghost

ghost commented Oct 7, 2026

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The compatibility change needs regression coverage in the existing API test suites.

Restores assistant.read to the known project scopes and marks it deprecated for compatibility with existing OAuth2 clients. The Assistant endpoint remains removed, and V25 continues stripping the scope from stored keys, functions, and sites.

Verdict New comments Fixed Still open
✅ Approved 1 0 0
Finding Where
🟡 Add a regression test for accepting the restored scope app/config/scopes/project.php:428
Fix with agent prompt
### Issue 1
app/config/scopes/project.php:428-432
**Add a regression test for accepting the restored scope**

Existing scope-list and project-key E2E tests never assert that `assistant.read` is known, so removing this entry again would leave them passing. Please add a real-API regression that accepts a key carrying this scope and verifies its deprecated status in the scope listing.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 1
File Change
app/config/scopes/project.php Adds the deprecated Assistant scope with a compatibility explanation.

Reviewed d655fd9 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost 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.

🔵 Tier A · Looks good to merge. Summary

Comment on lines +428 to +432
'assistant.read' => [
'description' => 'Access to use Assistant service. This scope is deprecated, the Assistant service has been removed.',
'category' => 'Other',
'deprecated' => true,
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add a regression test for accepting the restored scope

Existing scope-list and project-key E2E tests never assert that assistant.read is known, so removing this entry again would leave them passing. Please add a real-API regression that accepts a key carrying this scope and verifies its deprecated status in the scope listing.

Prompt To Fix With AI
This is a comment left during a code review.
Path: app/config/scopes/project.php
Line: 428-432

Comment:
**Add a regression test for accepting the restored scope**

Existing scope-list and project-key E2E tests never assert that `assistant.read` is known, so removing this entry again would leave them passing. Please add a real-API regression that accepts a key carrying this scope and verifies its deprecated status in the scope listing.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

🟡 Minor · testing · Reply if this doesn't apply.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

32 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (17)
  • php.appwrite.permissive-write-permission (8)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 7, 2026
@ChiragAgg5k
ChiragAgg5k merged commit ed898a8 into main Oct 7, 2026
55 checks passed
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/retain-assistant-scope (after).

Metric Before After Change
🚀 Requests/sec 211.17 212.56 ⚪ +0.7%
⏱️ Latency P50 83.26 ms 82.09 ms ⚪ -1.4%
⏱️ Latency P95 187.84 ms 189.72 ms ⚪ +1%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 82.09 189.72 13,452 212.56 +1.88
Account 154.56 287.5 708 11.76 -12.17
TablesDB 79.89 147.09 7,316 117.91 -2.91
Storage 75.18 171.97 3,540 58.66 +8.51
Functions 111.72 231.32 1,888 32.01 +5.59

Top API waits (after)

API request Max wait (ms)
account.name.update 430.95
account.prefs.update 411.69
storage.buckets.create 379.9
functions.variables.update 352.41
functions.variables.create 345.08

@ChiragAgg5k
ChiragAgg5k deleted the fix/retain-assistant-scope branch October 7, 2026 08:31
Naz-Ovh pushed a commit to 0x-fork/appwrite that referenced this pull request Oct 7, 2026
Keys, functions, sites and OAuth2 clients store scopes, and MCP hosts such as ChatGPT keep requesting the list they registered with. Removing assistant.read (appwrite#14167) broke those clients with invalid_scope until appwrite#14200 restored it. Record every shipped scope in app/config/scopes/lock.json and fail the unit suite when one disappears from the catalogs or a new one is not locked, so retiring a scope means deprecating it.
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.

1 participant