Skip to content

fix: use Unknown instead of Claude Code for unidentified agent fallback#838

Merged
peyton-alt merged 5 commits intomainfrom
fix/unknown-agent-fallback
Apr 3, 2026
Merged

fix: use Unknown instead of Claude Code for unidentified agent fallback#838
peyton-alt merged 5 commits intomainfrom
fix/unknown-agent-fallback

Conversation

@peyton-alt
Copy link
Copy Markdown
Contributor

@peyton-alt peyton-alt commented Apr 2, 2026

Summary

  • Changes AgentTypeUnknown from "Agent" to "Unknown" so unidentified agents display correctly
  • Fixes ReadAgentTypeFromTree to return Unknown when multiple agent config dirs exist (e.g., .claude/ + .codex/ from entire configure)
  • Adds clarifying comment that DefaultAgentName (Claude Code) is for setup UX, not attribution fallback
  • Related 1350

Context

Users reported seeing "Claude Code" in entire status and commit messages when using other agents (Codex, Cursor). The root cause: when the CLI can't determine which agent created a checkpoint, it was falling back to Claude Code instead of Unknown. This happened in ReadAgentTypeFromTree which checked for .claude/ directory presence — but entire configure installs config dirs for all selected agents, so .claude/ existing doesn't mean Claude Code was the agent.

Test plan

  • New tests for ReadAgentTypeFromTree covering single-agent, multi-agent, and metadata.json scenarios
  • mise run fmt && mise run lint && mise run test:ci all pass

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com


Note

Medium Risk
Changes the canonical unknown agent type value (from "Agent" to "Unknown") and adjusts detection logic, which could affect display/lookup of older stored metadata and attribution in status/commit messages.

Overview
Stops misattributing checkpoints/commit messages to a default agent by standardizing the fallback agent type to "Unknown".

Updates ReadAgentTypeFromTree to only return a specific agent based on config directories when exactly one agent config is present (and adds Codex/Cursor detection); otherwise it now returns Unknown. Adds focused tests for single-agent, multi-agent, and metadata.json-override scenarios, and updates commit-message/registry tests and comments to clarify that DefaultAgentName (Claude Code) is setup UX only, not an attribution fallback.

Written by Cursor Bugbot for commit 75a41a3. Configure here.

Copilot AI review requested due to automatic review settings April 2, 2026 22:30
@peyton-alt peyton-alt requested a review from a team as a code owner April 2, 2026 22:30
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes agent attribution fallbacks so sessions/checkpoints that can’t be confidently attributed to a single agent display as Unknown (instead of incorrectly showing Claude Code), and improves fallback detection when multiple agent config directories coexist.

Changes:

  • Update AgentTypeUnknown display string from "Agent" to "Unknown" and adjust commit message fallback expectation.
  • Adjust ReadAgentTypeFromTree fallback logic to return a specific agent only when exactly one agent marker is detected; otherwise return Unknown.
  • Add unit tests for ReadAgentTypeFromTree covering single-agent, multi-agent, and metadata.json override scenarios.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/entire/cli/strategy/read_agent_from_tree_test.go Adds targeted unit tests for tree-based agent type detection and metadata override behavior.
cmd/entire/cli/strategy/common.go Updates fallback detection to avoid misattribution when multiple agent config markers exist.
cmd/entire/cli/commit_message_test.go Updates expected commit message fallback text to “Unknown session updates”.
cmd/entire/cli/agent/registry.go Changes the unknown agent type label to “Unknown”.
cmd/entire/cli/agent/registry_test.go Clarifies the intent of DefaultAgentName (setup UX, not attribution fallback).

@peyton-alt peyton-alt force-pushed the fix/unknown-agent-fallback branch 2 times, most recently from acca87c to 22b5950 Compare April 3, 2026 00:17
peyton-alt and others added 5 commits April 3, 2026 09:27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f2e246b13aa1
…xist

Previously, .claude/ directory presence always returned AgentTypeClaudeCode,
even when other agent config dirs (e.g., .codex/) coexisted from
'entire configure'. Now counts detected agent dirs and returns Unknown
when ambiguous.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 45a6a07753e8
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: fe6c491e7122
Addresses PR review feedback:
- Add .factory dir detection for Factory AI Droid (Cursor Bugbot)
- Add single-agent tests for Codex, Cursor, Factory (Copilot)
- Update comment to say "config markers" not "config dir" (Copilot)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 0372b92d6beb
No need for a standalone test file — these tests belong with the
function they test in common.go.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 751884f8707a
@peyton-alt peyton-alt force-pushed the fix/unknown-agent-fallback branch from 22b5950 to f168d06 Compare April 3, 2026 16:27
@peyton-alt peyton-alt enabled auto-merge (squash) April 3, 2026 16:31
@peyton-alt peyton-alt merged commit 952d2ad into main Apr 3, 2026
3 checks passed
@peyton-alt peyton-alt deleted the fix/unknown-agent-fallback branch April 3, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants