fix: keep cwd at repo root through entire restart, revert try/except

The stack path in spec.yml is relative — both create_operation and
up_operation need cwd at the repo root for stack_is_external() to
resolve it. Move os.chdir(prev_cwd) to after up_operation completes
instead of between the two operations.

Reverts the SystemExit catch in call_stack_deploy_start — the root
cause was cwd, not the hook.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
A. F. DudleyandClaude Opus 4.6 committed 2026-03-20 15:54:46 +00:00
1 parent 32f6e57b70
commit 61afeb255c
2 files changed
+5 -15

No files matched your search

+1 -13
View File
@@ -272,19 +272,7 @@ def call_stack_deploy_start(deployment_context):
create additional k8s resources (Services, etc.) in the deployment namespace.
The namespace can be derived as f"laconic-{deployment_context.id}".
"""
try:
python_file_paths = _commands_plugin_paths(deployment_context.stack.name)
except SystemExit:
# Stack path may not resolve from current cwd (e.g. during restart
# when cwd isn't the repo root). get_parsed_stack_config calls
# error_exit (sys.exit) when the stack directory doesn't exist.
# Most stacks don't have deploy hooks, so this is non-fatal.
if opts.o.debug:
print(
f"Could not resolve plugin paths for stack"
f" {deployment_context.stack.name}, skipping hooks"
)
return
python_file_paths = _commands_plugin_paths(deployment_context.stack.name)
for python_file_path in python_file_paths:
if python_file_path.exists():
spec = util.spec_from_file_location("commands", python_file_path)