-
Notifications
You must be signed in to change notification settings - Fork 125
Deletes date prefix from. entire session id, so it is just the agent session id #113
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
Entire-Checkpoint: e36b79a63a3a
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 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:
EntireSessionIDis now an identity function that returns the agent session ID unchangedModelSessionIDstrips legacy date prefixes (YYYY-MM-DD-) when present for backwards compatibility- Removed
GetOrCreateEntireSessionIDfunction 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 |
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
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
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
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.
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
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.
ClaudeCodeAgentandGeminiCLIAgent:TransformSessionIDnow identity;ExtractAgentSessionIDusessessionid.ModelSessionIDto strip legacy prefixessessionidpackage:EntireSessionIDis identity;ModelSessionIDstripsYYYY-MM-DD-when presentsession.FindLegacyEntireSessionIDand sharedhandleSessionStartCommon()to preserve existing legacy sessions when starting and to writecurrent_sessionsession.GetOrCreateEntireSessionIDwithcurrentSessionIDWithFallback()across hooks; adjusts Gemini/Claude handlers and hook registry namesWritten by Cursor Bugbot for commit 845ffb8. This will update automatically on new commits. Configure here.