Skip to content

Conversation

@khaong
Copy link
Contributor

@khaong khaong commented Feb 6, 2026

Summary

  • Fixes ENT-207: checkpoints sometimes showed generic "Agent" label instead of the actual agent name (e.g., "Claude Code") in metadata.json and the UI
  • Root cause: SaveChanges/SaveTaskCheckpoint fell back to DefaultAgentType ("Agent") when InitializeSession failed or wasn't called, ignoring the correct ctx.AgentType from the hook agent
  • Also fixes InitializeSession backfill to correct existing sessions with "Agent" default, not just empty values

Test plan

  • Added 3 regression tests that fail before fix and pass after
  • Full CI test suite passes (mise run test:ci)
  • Lint clean (mise run lint)
  • Verify on staging that new checkpoints show correct agent name

🤖 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 ManualCommitStrategy session initialization paths (SaveChanges, SaveTaskCheckpoint, and InitializeSession backfill) to treat AgentTypeUnknown/"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.

…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
Copilot AI review requested due to automatic review settings February 6, 2026 04:18
Copy link
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 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() and isSpecificAgentType() helper functions to prioritize agent types correctly
  • Updates SaveChanges and SaveTaskCheckpoint to use context agent type instead of blindly defaulting to "Agent"
  • Fixes InitializeSession to 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

@khaong khaong marked this pull request as ready for review February 6, 2026 04:37
@khaong khaong requested a review from a team as a code owner February 6, 2026 04:37
@khaong khaong enabled auto-merge February 6, 2026 04:38
georg
georg previously approved these changes Feb 8, 2026
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
@khaong khaong merged commit 7183afd into main Feb 8, 2026
4 checks passed
@khaong khaong deleted the alex/ent-207-fix-agent-name-misattribution branch February 8, 2026 03:28
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.

2 participants