Skip to content

Conversation

@gtrrz-victor
Copy link
Contributor

@gtrrz-victor gtrrz-victor commented Jan 28, 2026

It doesn't create new Entire session IDs with a creation date prefix, but if a session ID was already created in entire/sessions with that prefix, it should still work.


Note

Unifies session ID format: Entire session IDs are now identical to agent session IDs (no date prefix), with backward compatibility for old date-prefixed IDs.

  • Updates ClaudeCodeAgent and GeminiCLIAgent: TransformSessionID now identity; ExtractAgentSessionID uses sessionid.ModelSessionID to strip legacy prefixes
  • Reworks sessionid package: EntireSessionID is identity; ModelSessionID strips YYYY-MM-DD- when present
  • Adds session.FindLegacyEntireSessionID and shared handleSessionStartCommon() to preserve existing legacy sessions when starting and to write current_session
  • Replaces uses of session.GetOrCreateEntireSessionID with currentSessionIDWithFallback() across hooks; adjusts Gemini/Claude handlers and hook registry names
  • Broad test updates to reflect new ID behavior and legacy handling

Written by Cursor Bugbot for commit 845ffb8. This will update automatically on new commits. Configure here.

Entire-Checkpoint: e36b79a63a3a
@gtrrz-victor gtrrz-victor requested a review from a team as a code owner January 28, 2026 04:26
Copilot AI review requested due to automatic review settings January 28, 2026 04:26
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 pull request removes the date prefix from Entire session IDs, simplifying session ID management by making the agent session ID and Entire session ID identical (identity function). Previously, session IDs had a non-deterministic date prefix (YYYY-MM-DD-UUID), which made it impossible to derive the Entire session ID from just the agent session ID. The change maintains backwards compatibility for legacy date-prefixed session IDs.

Changes:

  • EntireSessionID is now an identity function that returns the agent session ID unchanged
  • ModelSessionID strips legacy date prefixes (YYYY-MM-DD-) when present for backwards compatibility
  • Removed GetOrCreateEntireSessionID function and related session state management logic
  • Updated all hook handlers and agent implementations to use agent session IDs directly

Reviewed changes

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

Show a summary per file
File Description
cmd/entire/cli/sessionid/sessionid.go Made EntireSessionID an identity function; added backwards compatibility logic to ModelSessionID to strip legacy date prefixes
cmd/entire/cli/sessionid/sessionid_test.go Updated tests to cover both new format (identity) and legacy format (date-prefixed) with comprehensive edge cases
cmd/entire/cli/session/state.go Removed GetOrCreateEntireSessionID function and cleaned up unused imports (log/slog, sort, sessionid, logging)
cmd/entire/cli/session/session_test.go Removed tests for the deleted GetOrCreateEntireSessionID function
cmd/entire/cli/paths/paths_test.go Updated tests to verify EntireSessionID is now an identity function
cmd/entire/cli/integration_test/setup_gemini_hooks_test.go Updated test assertions to expect agent session IDs directly without date prefixes
cmd/entire/cli/integration_test/concurrent_session_warning_test.go Updated test to use agent session ID directly instead of constructing with date prefix
cmd/entire/cli/integration_test/agent_test.go Updated tests to verify identity function behavior and legacy format handling
cmd/entire/cli/hooks_handlers_test.go Updated test assertions to expect model ID directly instead of date-prefixed format
cmd/entire/cli/hooks_geminicli_handlers.go Changed to use agent session ID directly; removed GetOrCreateEntireSessionID call
cmd/entire/cli/hooks_claudecode_handlers.go Changed currentSessionIDWithFallback to use model session ID directly; removed GetOrCreateEntireSessionID call
cmd/entire/cli/agent/geminicli/gemini_test.go Updated test to verify TransformSessionID is now an identity function
cmd/entire/cli/agent/geminicli/gemini.go Made TransformSessionID an identity function; delegated backwards compatibility to sessionid.ModelSessionID
cmd/entire/cli/agent/claudecode/claude.go Made TransformSessionID an identity function; delegated backwards compatibility to sessionid.ModelSessionID

Soph and others added 2 commits January 28, 2026 14:15
When resuming a session that was created before the session ID format
change (when EntireSessionID added a date prefix), the CLI now checks
for existing legacy-format state files and preserves the original
session ID to avoid orphaning state files.

- Add FindLegacyEntireSessionID() to scan for legacy state files
- Update handleSessionStart and handleGeminiSessionStart to use it
- Add comprehensive tests for the new function

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: f4c22585e449
Add consistent naming across all hook handlers:
- handleSessionStart -> handleClaudeCodeSessionStart
- handlePostTodo -> handleClaudeCodePostTodo
- handlePreTask -> handleClaudeCodePreTask
- handlePostTask -> handleClaudeCodePostTask

Extract handleSessionStartCommon() as shared implementation for both
Claude and Gemini session start handlers to avoid code duplication.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: f4c22585e449
handleGeminiBeforeAgent was using input.SessionID directly while
handleGeminiAfterAgent used currentSessionIDWithFallback. For legacy
sessions with date-prefixed IDs, this caused a mismatch: BeforeAgent
captured state with "abc123" while AfterAgent tried to load it with
"2026-01-20-abc123", breaking token usage calculation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: 9cac7b4abb41
Copilot AI review requested due to automatic review settings January 28, 2026 13:39
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Copy link

@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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Validate agentSessionID input before using it in file system operations
to prevent path traversal attacks. The function now returns empty string
for invalid inputs, matching the behavior of the old GetOrCreateEntireSessionID.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: 1c127425ed32
@Soph Soph merged commit 7d83d89 into main Jan 28, 2026
4 checks passed
@Soph Soph deleted the gtrrz-victor/alt-date-prefix-session-id branch January 28, 2026 15:00
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