Skip to content

fix: events.jsonl not collected — copy step uses flat glob, misses session subdirectories #23990

Closed

Description

@lpcox

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

Activity

  1. added
    bug
    on Apr 2, 2026
  2. added a commit that references this issue on Apr 2, 2026
    ec2bed3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcliworkflows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions