Skip to content

🐛 Copilot: an agent's config.json silently stops following the shared login, and restarts never re-link it #18443

Closed

Description

@clubanderson

What happened

On the Bluefin hosted hive, the scanner agent was stuck at a Copilot login prompt while every other agent worked. The device-flow login from the dashboard succeeded and wrote the new login to the shared file, but scanner never picked it up. The hive restarted scanner three times, then gave up.

Root cause

  1. The link breaks silently. Each agent's ~/.copilot/config.json is meant to be a symlink to the shared /data/home/.copilot/config.json (src/crux/agent/interactive_home.go ~125, 142-144). The Copilot CLI saves its config by writing a temp file and renaming it over the original. That replaces the symlink with a private regular file. A leftover config.json.tmp.* in the shared folder is consistent with this. On Bluefin, scanner's CLI saved a private copy with no login in it, and the agent was stranded.
  2. Restarts never repair it. bridgeHomeEntry never replaces a real file (interactive_home.go ~315-317). Claude credentials have a re-link step first (rebridgeClaudeCredential, ~428-433), but Copilot has none. Token sync only writes the shared file (manager_tokens.go ~618, 689).
  3. The health check looks at the wrong file. The "has a valid credential" check passes on the shared file or the in-memory token (authprobe.go ~352-362), not on the file the agent actually reads. So the hive kept restarting (manager_poll.go ~219) and gave up (manager_poll.go ~201) while the agent was still logged out.
  4. The other agents are at risk. On the same hive, every other agent also holds a private regular file, not a link. They only work because those copies still carry an older token. They will all fail the same way when it expires.

Fix

  • Before launching an agent, and on restart, if ~/.copilot/config.json is a regular file rather than a link to the shared file:
    • move it aside to config.json.bak-<timestamp>, keeping only the newest backup;
    • re-link it to the shared file, mirroring rebridgeClaudeCredential.
  • After the CLI rewrites the file mid-run, the next restart repairs it. Optionally, a watchdog re-links on change.
  • Make the Copilot credential check evaluate the file the agent actually reads, so a broken per-agent copy is detected and repaired rather than restarted endlessly.
  • Never log file contents. Tests use fixtures without real tokens.
  • Tests: a regular-file copy with an empty login gets re-linked on restart. A valid symlink is left alone. The backup is created. The health check fails when the per-agent file differs from the shared one. Repeated restarts converge.

Manual workaround until fixed

Move the agent's ~/.copilot/config.json aside, then restart only that agent with POST /api/restart/<agent>.

Activity

  1. self-assigned this
    on Nov 16, 2026
  2. added
    triage/acceptedIndicates an issue or PR is ready to be actively worked on.
    kind/bugCategorizes issue or PR as related to a bug.
    on Nov 16, 2026
  3. clubanderson commented on Nov 16, 2026

    @clubanderson
    MemberAuthor

    working this in a PR now

  4. added
    stage/020-claimedClaimed by the scanner or a relay contributor
    and removed
    stage/020-claimedClaimed by the scanner or a relay contributor
    on Nov 16, 2026
  5. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    @clubanderson this issue was closed by @kubestellar-prow[bot] as completed.

    If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it — check your running version against the fix before concluding the fix failed.

    If you are still seeing the problem, comment /reopen and it will be reopened for you — you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.

  6. clubanderson commented on Nov 16, 2026

    @clubanderson
    MemberAuthor

    Fixed by #18445 (merged as 4db377b). Agent launch and restart now move a private Copilot config.json aside to config.json.bak- (newest backup kept) and relink it to the shared login; the Copilot credential probe evaluates the file the agent actually reads, and the pane poller relinks a diverged copy before the token-triggered restart. Stale config.json.tmp.* files older than HIVE_COPILOT_CONFIG_TMP_MAX_AGE (default 1h) are swept at launch. Existing hives pick this up on the next agent restart after upgrading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions