Skip to content

auth re-triggers repeatedly with a healthy sync (no failures logged) #850

Description

@qadsawee79

Bug: ok auth re-triggers repeatedly with a healthy sync (no failures logged)

Summary

While the OpenKnowledge server was running for a project (Documents\Second Brain, git-backed, GitHub remote), a GitHub login/device-flow window kept reappearing every 5–30 minutes despite already having valid, correctly-stored GitHub credentials (confirmed via git-credential-manager diagnose — all 7 checks passed — and Windows Credential Manager holding a valid git:https://github.com entry).

The underlying git sync itself is not failing:

// .ok/local/sync-state.json
{
  "version": 1,
  "lastSyncUtc": "2026-07-28T15:56:54.446Z",
  "lastFetchUtc": "2026-07-28T15:52:38.944Z",
  "lastPushedSha": "32dd238e72fdf1de3c1c0c65e642a973202012cc",
  "consecutiveFailures": 0,
  "inflightConflicts": []
}

consecutiveFailures: 0 and a recent successful push/fetch, at the same time the CLI logs show repeated auth command invocations that never log completion.

Evidence — repeated auth starts, no completion logged

From ~/.ok/logs/cli.2026-07-28.log, filtered to "command":"auth":

13:55:36.688Z  pid=53048   command=auth  cwd=Documents\Second Brain  project=<no-project>
15:13:40.056Z  pid=120288  command=auth  cwd=Documents\Second Brain  project=<no-project>
15:45:16.513Z  pid=70508   command=auth  cwd=Documents\Second Brain  project=<no-project>
15:45:22.791Z  pid=84508   command=auth  cwd=Documents\Second Brain  project=<no-project>
15:49:33.287Z  pid=59248   command=auth  cwd=Documents\Second Brain  project=<no-project>
15:49:34.120Z  pid=129124  command=auth  cwd=Documents\Second Brain  project=<no-project>
15:51:54.194Z  pid=103736  command=auth  cwd=Documents\Second Brain  project=<no-project>

Every entry logs "msg":"cli command started" — none is followed by a corresponding success/error/completion log line for that PID, in a project (Documents\Second Brain) that does have a valid .ok/config.yml on disk (i.e. it should not be <no-project>).

Reproduction

  1. .ok project already initialized in a folder with a GitHub remote configured (git credentials valid and confirmed working via git-credential-manager diagnose).
  2. Run ok start (or open via OK Desktop) so the collab server + auto-sync runs in the background.
  3. Leave it running for an extended session (~2h in this case).
  4. Observe: a GitHub device-flow / login window reopens every 5–30 min, even though sync-state.json shows zero consecutive failures and successful pushes throughout.

Suspected cause

One of:

  • The auth re-validation is tagged project:<no-project> even when run from an initialized project directory — possible project-detection bug in the CLI's logging/dispatch layer.
  • A short session TTL causes periodic re-validation by design, but the refreshed session/token isn't being persisted, so the next tick treats it as unauthenticated again.

Workaround used

Stopped the OK server for the project (ok stop <dir>) — no config-level toggle exists for this (sync.* config keys were deprecated/silently dropped per ok config migrate's own description), so stopping the server is the only way to halt the auto-sync/re-auth cycle short of this bug being fixed.

Environment

  • OS: Windows 11 Pro
  • Git: 2.55.0.windows.3
  • Git Credential Manager: 2.9.0
  • ok CLI version: (see attached diagnostic bundle)
  • Diagnostic bundle: generated via ok bug-report, auto-redacted (46 lines across 4 files)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions