Bug
cyrus self-auth-linear reports "Saved credentials for workspace: X" but the tokens are never actually persisted to config.json. The command exits 0 and looks successful.
Root cause
SelfAuthCommand checks:
if (!config.linearWorkspaces) {
config.linearWorkspaces = {};
}
config.linearWorkspaces[workspace.id] = { linearToken: ... };
writeFileSync(configPath, JSON.stringify(config, null, "\t"));
When config.json contains \"linearWorkspaces\": [] (an array), !config.linearWorkspaces is false (arrays are truthy), so the initialization to {} is skipped. The assignment arr[uuid] = value sets a named property on the array object, but JSON.stringify silently drops non-numeric properties on arrays. The written file still contains \"linearWorkspaces\": [].
How to reproduce
- Create
~/.cyrus/config.json with {\"repositories\": [], \"linearWorkspaces\": []} (array, not object)
- Run
cyrus self-auth-linear and complete the OAuth flow
- Observe "Saved credentials" success message
- Check
config.json — linearWorkspaces is still [], no tokens saved
- Run
cyrus self-add-repo — fails with "No Linear credentials found"
Fix
Either:
-
Guard against array input in SelfAuthCommand:
if (!config.linearWorkspaces || Array.isArray(config.linearWorkspaces)) {
config.linearWorkspaces = {};
}
-
Or enforce object type in migrateEdgeConfig — if linearWorkspaces is an array with no legacy tokens, reset it to {}.
Workaround
Remove the linearWorkspaces key from config.json entirely (or set it to null) before running self-auth-linear. With the key absent, !config.linearWorkspaces is true and it initializes correctly as {}.
Environment
- cyrus-ai 0.2.57
- Linux (Arch), Node 26.2.0
Bug
cyrus self-auth-linearreports "Saved credentials for workspace: X" but the tokens are never actually persisted toconfig.json. The command exits 0 and looks successful.Root cause
SelfAuthCommandchecks:When
config.jsoncontains\"linearWorkspaces\": [](an array),!config.linearWorkspacesisfalse(arrays are truthy), so the initialization to{}is skipped. The assignmentarr[uuid] = valuesets a named property on the array object, butJSON.stringifysilently drops non-numeric properties on arrays. The written file still contains\"linearWorkspaces\": [].How to reproduce
~/.cyrus/config.jsonwith{\"repositories\": [], \"linearWorkspaces\": []}(array, not object)cyrus self-auth-linearand complete the OAuth flowconfig.json—linearWorkspacesis still[], no tokens savedcyrus self-add-repo— fails with "No Linear credentials found"Fix
Either:
Guard against array input in
SelfAuthCommand:Or enforce object type in
migrateEdgeConfig— iflinearWorkspacesis an array with no legacy tokens, reset it to{}.Workaround
Remove the
linearWorkspaceskey fromconfig.jsonentirely (or set it tonull) before runningself-auth-linear. With the key absent,!config.linearWorkspacesistrueand it initializes correctly as{}.Environment