Skip to content

Conversation

@rushilpatel0
Copy link
Contributor

Motivation

Content

Testing

Please check the following before marking your PR as ready for review

  • I have added tests for my changes
  • I have updated the documentation or added new documentation as needed

@rushilpatel0 rushilpatel0 requested review from a team and codegen-team as code owners August 19, 2025 18:31
@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

try:
from codegen.cli.commands.claude.claude_session_api import create_claude_session
except ImportError:
create_claude_session = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Logic error: Potential NoneType call if import fails

If the import of create_claude_session fails, it’s set to None, but later it’s called unconditionally when org_id is present. That will raise TypeError: 'NoneType' object is not callable, causing the function to fall into the broad exception handler and return an error payload instead of cleanly proceeding.

Suggested change
create_claude_session = None
# Create session via API if available
agent_run_id = None
if org_id and callable(create_claude_session):
agent_run_id = create_claude_session(session_id, org_id)

This preserves the intended "safe import" behavior and avoids unintended exceptions while still recording session data.

@rushilpatel0 rushilpatel0 merged commit 1ff7eda into develop Aug 19, 2025
17 of 18 checks passed
@rushilpatel0 rushilpatel0 deleted the rpatel/safe-import branch August 19, 2025 18:33
@codegen-sh
Copy link
Contributor

codegen-sh bot commented Aug 19, 2025

Found 0 critical and 1 important issues. Please review my inline comment above.

🔍 View my analysis

@github-actions
Copy link
Contributor

🎉 This PR is included in version 0.56.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants