fix(agents): harden shell adapter bridge and address double-check review feedback
- create_session.sh: add explicit case fallback for delegate_agent (R1) - lib_py.agents: add spawn-spec, resume-spec, exit-key argv CLI subcommands (R2) - resume_session.sh, stop_session.sh: replace python string interpolation with safe argv subcommands (R2) - stop_session.sh: dynamically iterate adapter.identity_cache_fields (R3) - verify_session.py, workspace_uuid.py: remove dead imports (R9/N4) - tests/test_a4_adapter_contract.py: add CLI bridge subcommand, clean-env PYTHONPATH safety, and fallback contract tests (R12/N1) - SKILL.md, docs, logs: synchronize IMPROVEMENTS.md, LOG.md, and resolve_session_id wording (R8/R10/R11) - promote verified peer review reports for cline (e7b9812b) and claude (31730364)
This commit is contained in:
@@ -173,7 +173,7 @@ delegate_publish_event "$DELEGATE_JOB_ID" progress "terminating"
|
||||
graceful_stop() {
|
||||
local pane_pid exitkey
|
||||
pane_pid=$(herdr list-panes -t "$SESSION_NAME" -F '#{pane_pid}' 2>/dev/null | head -1 || true)
|
||||
exitkey="$("$(_delegate_py_bin)" -c "from lib_py.agents.registry import get_adapter; a = get_adapter('$AGENT'); print(a.exit_key if a else '/exit')" 2>/dev/null || echo "/exit")"
|
||||
exitkey="$("$(_delegate_py_bin)" -m lib_py.agents exit-key "$AGENT" 2>/dev/null || echo "/exit")"
|
||||
echo "graceful: send-keys '$exitkey' to $SESSION_NAME"
|
||||
send_keys_safe "$SESSION_NAME" "$exitkey" "stop$$" || echo "graceful: safe delivery failed (rc=$?) — falling back to kill chain"
|
||||
_wait_session_gone "$SESSION_NAME" 5 || true
|
||||
@@ -280,14 +280,7 @@ if purge and purge_uuid:
|
||||
if ai.get('project_cwd') == ws:
|
||||
if adapter and (ai.get('session_id') == purge_uuid or ai.get('conversation_id') == purge_uuid):
|
||||
for field in adapter.identity_cache_fields:
|
||||
ai.pop(field, None)
|
||||
if 'session_id' in adapter.identity_cache_fields or 'session_jsonl' in adapter.identity_cache_fields:
|
||||
ai['session_id'] = None
|
||||
ai['session_jsonl'] = None
|
||||
if 'conversation_id' in adapter.identity_cache_fields:
|
||||
ai['conversation_id'] = None
|
||||
ai['conversation_db'] = None
|
||||
ai['conversation_brain_dir'] = None
|
||||
ai[field] = None
|
||||
elif purge and not purge_uuid:
|
||||
print("WARN: --purge-conversation requested but no workspace-scoped UUID resolved; nothing purged", flush=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user