Problem
The "Copy Copilot session state files to logs" step in compiled agentic workflow lock files uses a flat glob pattern that never matches events.jsonl, because Copilot CLI writes to a session subdirectory, not the top level.
What the lock file does (current)
SESSION_STATE_DIR="$HOME/.copilot/session-state"
cp -v "$SESSION_STATE_DIR"/*.jsonl /tmp/gh-aw/sandbox/agent/logs/
What Copilot CLI actually writes
~/.copilot/session-state/
<session-uuid>/
events.jsonl ← actual location
session.db
plan.md
checkpoints/
files/
The glob $SESSION_STATE_DIR/*.jsonl only matches files at the top level of session-state/. Since Copilot CLI writes events.jsonl inside a <session-uuid>/ subdirectory, the glob never matches and the copy silently succeeds with zero files.
Evidence
Multiple workflow runs show the agent step logging "Flushed N events to session <uuid>" but the resulting artifacts contain no events.jsonl:
Locally, ~/.copilot/session-state/ confirms the subdirectory structure:
$ ls ~/.copilot/session-state/
<session-uuid-1>/
<session-uuid-2>/
$ ls ~/.copilot/session-state/<session-uuid-1>/
events.jsonl session.db plan.md checkpoints/ files/
Proposed Fix
Replace the flat glob with a recursive find in the lock file template:
- cp -v "$SESSION_STATE_DIR"/*.jsonl /tmp/gh-aw/sandbox/agent/logs/ 2>/dev/null || true
+ find "$SESSION_STATE_DIR" -name "events.jsonl" -exec cp -v {} /tmp/gh-aw/sandbox/agent/logs/ \; 2>/dev/null || true
Or, to preserve session context in the filename (avoids collisions if multiple sessions ran):
find "$SESSION_STATE_DIR" -name "events.jsonl" | while read -r f; do
session_id=$(basename "$(dirname "$f")")
cp -v "$f" "/tmp/gh-aw/sandbox/agent/logs/events-${session_id}.jsonl"
done
Where to change
This fix should be applied in the gh-aw template/action that generates the "Copy Copilot session state files to logs" step in compiled .lock.yml files. After fixing, all recompiled workflows will pick up the new recursive copy logic.
Related
Problem
The "Copy Copilot session state files to logs" step in compiled agentic workflow lock files uses a flat glob pattern that never matches
events.jsonl, because Copilot CLI writes to a session subdirectory, not the top level.What the lock file does (current)
What Copilot CLI actually writes
The glob
$SESSION_STATE_DIR/*.jsonlonly matches files at the top level ofsession-state/. Since Copilot CLI writesevents.jsonlinside a<session-uuid>/subdirectory, the glob never matches and the copy silently succeeds with zero files.Evidence
Multiple workflow runs show the agent step logging "Flushed N events to session <uuid>" but the resulting artifacts contain no
events.jsonl:Locally,
~/.copilot/session-state/confirms the subdirectory structure:Proposed Fix
Replace the flat glob with a recursive find in the lock file template:
Or, to preserve session context in the filename (avoids collisions if multiple sessions ran):
Where to change
This fix should be applied in the gh-aw template/action that generates the "Copy Copilot session state files to logs" step in compiled
.lock.ymlfiles. After fixing, all recompiled workflows will pick up the new recursive copy logic.Related