fix(lib): prevent set -u unbound variable error for final_cmd in kind detection and harden test fixtures
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
||||
import subprocess
|
||||
import json
|
||||
import sqlite3
|
||||
import fcntl
|
||||
import pytest
|
||||
import shutil
|
||||
import yaml
|
||||
@@ -117,19 +118,23 @@ def test_integration_stop_purge_combination(mam_sandbox, mock_herdr, mock_agents
|
||||
assert jsonl_file.exists()
|
||||
|
||||
# Update mock herdr's state to match the running agent so the stop kill-chain works gracefully
|
||||
with open(mock_herdr, 'r') as f:
|
||||
state = json.load(f)
|
||||
state["agents"][session_name] = {
|
||||
"status": "running",
|
||||
"agent": "claude",
|
||||
"cwd": str(tmp_path),
|
||||
"pid": 12345,
|
||||
"pane_id": "w1:p1",
|
||||
"command": "claude",
|
||||
"buffer": "Anthropic Claude Ready"
|
||||
}
|
||||
with open(mock_herdr, 'w') as f:
|
||||
json.dump(state, f, indent=2)
|
||||
lock_path = str(mock_herdr) + ".lock"
|
||||
with open(lock_path, 'a') as lock_f:
|
||||
fcntl.flock(lock_f, fcntl.LOCK_EX)
|
||||
with open(mock_herdr, 'r') as f:
|
||||
state = json.load(f)
|
||||
state["agents"][session_name] = {
|
||||
"status": "running",
|
||||
"agent": "claude",
|
||||
"cwd": str(tmp_path),
|
||||
"pid": 12345,
|
||||
"pane_id": f"w1:p_{session_name}",
|
||||
"command": "claude",
|
||||
"buffer": "Anthropic Claude Ready"
|
||||
}
|
||||
with open(mock_herdr, 'w') as f:
|
||||
json.dump(state, f, indent=2)
|
||||
fcntl.flock(lock_f, fcntl.LOCK_UN)
|
||||
|
||||
# 2. Calling stop_session without --yes fails for --purge-conversation
|
||||
stop_script = tmp_path / "skills" / "multi-agent-mux-stop" / "scripts" / "stop_session.sh"
|
||||
|
||||
Reference in New Issue
Block a user