Skip to content

fix: define original_cwd before use in launch_command finally block#2965

Merged
rysweet merged 2 commits intomainfrom
fix/original-cwd-nameError
Mar 9, 2026
Merged

fix: define original_cwd before use in launch_command finally block#2965
rysweet merged 2 commits intomainfrom
fix/original-cwd-nameError

Conversation

@rysweet
Copy link
Owner

@rysweet rysweet commented Mar 9, 2026

Problem

launch_command() in cli.py has a finally block that references original_cwd to restore the working directory after staging, but the variable was never defined in that function's scope. This causes a NameError on every session shutdown:

NameError: name 'original_cwd' is not defined

Fix

Capture os.getcwd() at the top of launch_command(), before _common_launcher_startup() runs (which may change the CWD during auto-staging).

Testing

  • Verified syntax passes
  • One-line fix with obvious correctness — the variable was simply missing its definition

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Repo Guardian - Passed

No ephemeral content detected. All changed files are durable project code.

AI generated by Repo Guardian

@rysweet rysweet force-pushed the fix/original-cwd-nameError branch from e664e4e to 97583c4 Compare March 9, 2026 03:04
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

The finally block in launch_command() referenced original_cwd to restore
the working directory after staging, but the variable was never defined
in that function's scope, causing a NameError on session shutdown.

Capture os.getcwd() before _common_launcher_startup() runs, since that
function may change the CWD during auto-staging.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rysweet rysweet force-pushed the fix/original-cwd-nameError branch from 1941624 to 4cc544e Compare March 9, 2026 03:21
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

🤖 Auto-fixed version bump

The version in pyproject.toml has been automatically bumped to the next patch version.

If you need a minor or major version bump instead, please update pyproject.toml manually and push the change.

@rysweet rysweet merged commit 792c5ec into main Mar 9, 2026
1 check passed
@rysweet rysweet deleted the fix/original-cwd-nameError branch March 9, 2026 03:23
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.

1 participant