Skip to content

Remove backward-compatibility fallbacks for unknown agent types#515

Merged
squishykid merged 2 commits intomainfrom
gtrrz-victor/delete-concept-agent-not-defined
Feb 26, 2026
Merged

Remove backward-compatibility fallbacks for unknown agent types#515
squishykid merged 2 commits intomainfrom
gtrrz-victor/delete-concept-agent-not-defined

Conversation

@gtrrz-victor
Copy link
Contributor

@gtrrz-victor gtrrz-victor commented Feb 26, 2026

Summary

  • Remove DefaultAgentType constant and isSpecificAgentType() helper from strategy/common.go
  • Simplify resolveAgentType() to use state or context agent type directly (no fallback to "Agent")
  • Simplify ResolveAgentForRewind() to call agent.GetByAgentType directly (no default-agent fallback)
  • Remove backfill logic in manual_commit_hooks.go that replaced "Agent" with the real type
  • Remove TestInitializeSession_BackfillsUnknownAgentType test and update ResolveAgentForRewind tests

Agent type tracking was added 6 days after repo creation (Jan 9, 2026) and shipped in v0.3.5 (Jan 15). There are no realistic production sessions without agent type info, so these backward-compat patterns just add complexity.

AgentTypeUnknown itself is kept — it's used in switch cases for format-detection (treating unknown transcripts as JSONL), which is correct behavior for old checkpoints.

🤖 Generated with Claude Code

Agent type tracking was added 6 days after repo creation and shipped in
v0.3.5. Remove DefaultAgentType, isSpecificAgentType, and the
ResolveAgentForRewind fallback-to-default logic since no production
sessions lack agent type info.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 175ab37325b5
@gtrrz-victor gtrrz-victor requested a review from a team as a code owner February 26, 2026 03:39
Copilot AI review requested due to automatic review settings February 26, 2026 03:39
@cursor
Copy link

cursor bot commented Feb 26, 2026

PR Summary

Medium Risk
Behavior changes in checkpoint rewind and session initialization may cause previously tolerated missing/unknown agent metadata to error instead of falling back, potentially breaking edge-case/legacy checkpoints.

Overview
Removes the DefaultAgentType/isSpecificAgentType backward-compat layer so agent type is no longer silently coerced to the generic "Agent" value.

resolveAgentType now prefers a non-empty SessionState.AgentType and otherwise uses the hook/context agent type, and session initialization only sets AgentType when currently unset (no more replacing "Agent" with a later value). ResolveAgentForRewind no longer falls back to a default agent; missing/unknown agent types now surface as errors, with tests updated accordingly and the legacy backfill test removed.

Written by Cursor Bugbot for commit 74fcb66. Configure here.

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 removes backward-compatibility fallbacks for sessions without agent type information, simplifying the codebase by eliminating dead code paths that were only needed for sessions created before agent type tracking was added (Jan 9, 2026 - 6 days after repo creation).

Changes:

  • Removes DefaultAgentType constant and isSpecificAgentType() helper function that supported backward compatibility
  • Simplifies agent type resolution to fail fast instead of falling back to defaults
  • Removes backfill logic that replaced unknown agent types with specific types
  • Updates tests to expect errors for empty/unknown agent types instead of silent fallback behavior

Reviewed changes

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

Show a summary per file
File Description
cmd/entire/cli/strategy/common.go Removes DefaultAgentType constant and isSpecificAgentType() helper; simplifies resolveAgentType() to return context value directly without fallback
cmd/entire/cli/strategy/manual_commit_rewind.go Simplifies ResolveAgentForRewind() to call agent.GetByAgentType() directly, removing default agent fallback logic
cmd/entire/cli/strategy/manual_commit_hooks.go Removes backfill logic that replaced "Agent" with real agent type; simplifies InitializeSession to only set agent type when empty (not when "Agent")
cmd/entire/cli/strategy/manual_commit_test.go Removes TestInitializeSession_BackfillsUnknownAgentType test and updates comments to remove outdated bug reference
cmd/entire/cli/strategy/rewind_test.go Updates TestResolveAgentForRewind to expect errors for empty agent types instead of defaulting to Claude

khaong
khaong previously approved these changes Feb 26, 2026
…te-concept-agent-not-defined

# Conflicts:
#	cmd/entire/cli/strategy/manual_commit_test.go
@squishykid squishykid enabled auto-merge February 26, 2026 09:54
@squishykid squishykid merged commit 0c27a9c into main Feb 26, 2026
3 checks passed
@squishykid squishykid deleted the gtrrz-victor/delete-concept-agent-not-defined branch February 26, 2026 09:57
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.

4 participants