Skip to content

Conversation

@DevelopmentCats
Copy link
Contributor

@DevelopmentCats DevelopmentCats commented Dec 3, 2025

Description

Brings session resumption up to speed with current claude-code capabilities, and should make session resumption less prone to errors across the board.

I am still testing this further to ensure that all logic path's are verified.

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/coder/modules/claude-code
New version: v4.2.5
Breaking change: [ ] Yes [ ] No

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun fmt)
  • Changes tested locally

Related Issues

Copilot AI review requested due to automatic review settings December 3, 2025 20:37
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 refactors the session resumption logic for the claude-code module to simplify and improve reliability across both standalone and task modes. The changes remove the problematic remove-last-session-id.sh script that attempted to manage stale session data, replacing it with more robust session validation and detection functions directly in the start script.

Key changes:

  • Introduces three new helper functions (task_session_exists, is_valid_session, has_any_sessions) to improve session state detection
  • Simplifies the session resumption decision tree by consolidating conditional logic and removing external script dependencies
  • Adds comprehensive test coverage for edge cases like partial initialization, session validation, and mode-specific behavior

Reviewed changes

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

Show a summary per file
File Description
registry/coder/modules/claude-code/scripts/start.sh Refactored session resumption logic with new validation functions; removed dependency on external session cleanup script; simplified conditional branches for task vs standalone modes
registry/coder/modules/claude-code/scripts/remove-last-session-id.sh Removed entirely - session cleanup logic no longer needed with improved validation approach
registry/coder/modules/claude-code/main.tf Removed references to remove-last-session-id.sh script; updated local variables to remove unused script encoding
registry/coder/modules/claude-code/main.test.ts Added four new test cases for partial initialization detection, first build scenarios, session continuation, and task mode isolation; updated existing test to create valid JSONL session files with proper content
registry/coder/modules/claude-code/README.md Updated module version to 4.2.3 across all examples; updated version pins in examples (claude_code_version, agentapi_version, boundary_version); removed cli_app from standalone mode example

@DevelopmentCats
Copy link
Contributor Author

@matifali @35C4n0r this should solve all of the session resumption issues, if you guys can test this too that would be cool 😸

Copy link
Collaborator

@35C4n0r 35C4n0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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 6 out of 6 changed files in this pull request and generated 2 comments.

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 6 out of 6 changed files in this pull request and generated 3 comments.

Copy link
Contributor

@david-fraley david-fraley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lending a 👍 based on other's approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants