You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Setup re-run after an empty migration overwrites a newly added OpenCode Anthropic login with the placeholder without importing it #335
If local setup first runs while OpenCode has no Anthropic login, and the user signs in to Anthropic in OpenCode later and runs setup again, setup replaces that new login with the inert placeholder and imports nothing. It still exits 0 with Setup complete!, and Claude requests then refuse until setup --login --no-claustrum.
Repro (2.0.2, OpenCode profile in an isolated HOME/XDG, --yes --no-claustrum, placeholder OAuth tokens)
auth.json without an anthropic entry. Run setup: exit 0, journal phase retired, pool 0 accounts.
Add an OAuth login to auth.json ({"anthropic":{"type":"oauth","access":"sk-ant-oat01-…","refresh":"sk-ant-ort01-…","expires":…}}). Run setup again: exit 0, Setup complete!, phase still retired, pool still 0 accounts, no anthropic-auth-pool-state.json, and auth.json's anthropic entry is now {"type":"oauth","access":"","refresh":"claustrum-tombstone:v1:anthropic","expires":0}. The login is gone.
Control: the same login present at the first setup is imported (pool 1 account, both tokens in pool state).
Other providers' entries in auth.json are preserved in all three runs.
Where (tag v2.0.2)
packages/core/src/native-migration.ts:690-694: for a retired journal with activation === null, setup calls repair() and returns, so the import at :781-783 is never reached.
:603-611: repair() rewrites the host auth through expectedAuth() (:507-518).
packages/core/src/native-host-auth-write.ts:151-153: any OpenCode entry that is not an API key or the activation marker becomes custodyTombstoneOAuth('anthropic').
Expected
Import the login (as the first run would have), or refuse without writing and point the user to setup --login --no-claustrum. Silently replacing it destroys a credential the user just created.
Activity