Manual host-auth sync in refresh path is unused side-effect and ignores directory scoping
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- authentication, backend
Research direction
Start in src/server/tools.ts at setHostAuth(), clearHostAuth(), and the refresh success and failure paths. Read src/server/index.ts and package.json to confirm the plugin hooks, then compare the referenced OpenCode auth routes. Done means either removing the undocumented host-auth side effects or documenting an intentional, correctly scoped consumer path and verifying the acceptance criteria.
Written by the indexing model from the issue text.
Description
Summary
The plugin currently writes and clears OpenCode host auth from the refresh path even though opencode-supabase itself does not read host auth back anywhere.
That makes setHostAuth() / clearHostAuth() an unused side-effect for this plugin, and the clear path is especially misleading because it passes directory even though the OpenCode host route removes auth by provider ID only.
If plugin-local auth is the source of truth, this should either be removed or made explicitly optional/documented.
Evidence In This Repo
src/server/tools.ts
145-159:setHostAuth(...)callsinput.client.auth.set({ path: { id: "supabase" }, query: { directory: input.directory }, body: ... })161-169:clearHostAuth(...)callsDELETE /auth/supabase?directory=...203-205: refresh success tries tosetHostAuth(...)208-213: refresh failure tries toclearHostAuth(...)
Repo-wide verification:
- No
client.auth.get(...)usage found inopencode-supabase - No plugin code reads host auth back after writing/clearing it
- Plugin exports only
authandtoolhooks, not aproviderhook or loader that consumes host authsrc/server/index.ts:12-15package.json:12-24
Relevant OpenCode Host Behavior
Verified against current OpenCode code:
~/Code/github/opencode/packages/opencode/src/server/routes/control/index.ts:14-49PUT /auth/:providerIDstores host auth by provider ID
~/Code/github/opencode/packages/opencode/src/server/routes/control/index.ts:51-83DELETE /auth/:providerIDremoves host auth by provider ID
- the
directoryquery exists on the route, but the auth set/remove operations themselves are still provider-ID based
So the plugin's manual clear call is not meaningfully scoped by directory.
Why This Is Worth Tracking
Even if the plugin never consumes host auth, these calls still mutate host state when executed.
That means the current code has all of the downside of host sync without a demonstrated benefit inside this plugin.
Reproduction
- Connect Supabase and let the tool refresh path run.
- Observe that the plugin attempts to mirror auth into host auth.
- Trigger a
400/401refresh failure. - Observe that the plugin attempts to delete host auth for provider
supabase.
Expected
If plugin-local auth is authoritative, refresh should only update/clear the local auth store unless host sync is explicitly required.
Actual
Refresh mutates host auth as a side effect.
Suggested Fix
Pick one explicit direction:
Option A: Remove manual host sync from this plugin
- delete
setHostAuth()/clearHostAuth()fromsrc/server/tools.ts - keep plugin-local auth as the only state this plugin manages directly
Option B: Keep host sync, but make it intentional
- document why it exists
- define the expected consumer path
- ensure clear semantics are correctly scoped and not implied to be directory-local if they are not
Acceptance Criteria
opencode-supabaseno longer performs undocumented/unused host-auth side effects, or- host-auth sync is documented as intentional with a verified consumer and correct scoping semantics.
Note
This issue is separate from OpenCode core's own automatic host-auth persistence on successful OAuth callback. This issue is only about the plugin's manual refresh-path sync in src/server/tools.ts.
- Dominant language
- TypeScript
- Stars
- 35
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase-community/opencode-supabase
-
priority:p3 status:blocked status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
enhancement priority:p3 status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 48/100
supabase-community/opencode-supabase#46 · 1 comment ·
-
bug priority:p1 status:triaged
Difficulty 5/5 Over a week Newbie friendliness 35/100
supabase-community/opencode-supabase#37 · 1 comment ·
-
bug priority:p2 status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
bug priority:p1 status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 52/100
All issues in supabase-community/opencode-supabase
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·