-
Notifications
You must be signed in to change notification settings - Fork 125
fix: use actual agent name instead of defaulting to "Agent" #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…oints
When InitializeSession failed or wasn't called before SaveChanges, the
manual-commit strategy fell back to DefaultAgentType ("Agent") instead
of using the agent type from SaveContext. This caused some checkpoints
to show "Agent" instead of "Claude Code" in metadata.
Three fixes:
- SaveChanges/SaveTaskCheckpoint now use ctx.AgentType via resolveAgentType()
- InitializeSession backfill now also corrects "Agent" default, not just empty
- Consolidated agent type resolution into isSpecificAgentType/resolveAgentType helpers
Fixes ENT-207
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: ada8171575ce
There was a problem hiding this 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 a bug (ENT-207) where checkpoints sometimes displayed a generic "Agent" label instead of the actual agent name (e.g., "Claude Code") in metadata.json and the UI. The root cause was that SaveChanges and SaveTaskCheckpoint in the manual-commit strategy would fall back to DefaultAgentType ("Agent") when InitializeSession failed or wasn't called, even though the correct agent type was available in ctx.AgentType from the hook.
Changes:
- Introduces
resolveAgentType()andisSpecificAgentType()helper functions to prioritize agent types correctly - Updates
SaveChangesandSaveTaskCheckpointto use context agent type instead of blindly defaulting to "Agent" - Fixes
InitializeSessionto backfill sessions with the generic "Agent" value, not just empty values - Adds comprehensive regression tests covering all bug scenarios
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/entire/cli/strategy/common.go | Adds helper functions isSpecificAgentType() and resolveAgentType() to properly handle agent type resolution with correct priority |
| cmd/entire/cli/strategy/manual_commit_git.go | Updates SaveChanges and SaveTaskCheckpoint to use resolveAgentType() instead of manually defaulting to DefaultAgentType |
| cmd/entire/cli/strategy/manual_commit_hooks.go | Fixes InitializeSession backfill to replace both empty and "Agent" default values with correct agent type |
| cmd/entire/cli/strategy/manual_commit_test.go | Adds three regression tests: no session state, partial state, and backfill scenarios |
Resolve conflict in manual_commit_git.go: keep resolveAgentType helper from this branch while adopting the new userPrompt parameter from main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: 966462b9a8e7
Resolve conflict in manual_commit_hooks.go: keep isSpecificAgentType check from this branch while adopting LastInteractionAt tracking from main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: de1b4494d570
Summary
SaveChanges/SaveTaskCheckpointfell back toDefaultAgentType("Agent") whenInitializeSessionfailed or wasn't called, ignoring the correctctx.AgentTypefrom the hook agentInitializeSessionbackfill to correct existing sessions with "Agent" default, not just empty valuesTest plan
mise run test:ci)mise run lint)🤖 Generated with Claude Code
Note
Low Risk
Small, localized logic change to session metadata initialization/backfill with targeted regression tests; low blast radius but affects checkpoint metadata labeling.
Overview
Fixes cases where checkpoints were being labeled with the generic default agent by introducing shared agent-type selection helpers (preferring an existing specific stored type, then the hook-provided context type, then the default fallback).
Updates
ManualCommitStrategysession initialization paths (SaveChanges,SaveTaskCheckpoint, andInitializeSessionbackfill) to treatAgentTypeUnknown/"Agent" as non-specific and replace it when a real agent type is available. Adds regression tests covering no-state, partial-state, and backfill scenarios.Written by Cursor Bugbot for commit af4f21d. This will update automatically on new commits. Configure here.