You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: capture full session state — replace blanket ~/.copilot mount, add --session-state-dir (#1593)
* fix: replace blanket ~/.copilot chroot mount with targeted session-state and logs mounts
The blanket ~/.copilot bind mount at the chroot path (/host$HOME/.copilot)
shadowed the pre-chroot AWF workDir volume mounts for session-state and logs.
After chroot, Copilot CLI wrote events.jsonl to the host filesystem via the
bind mount, bypassing the AWF workDir entirely. This prevented events.jsonl
from being captured in workflow artifacts.
Replace the single ~/.copilot mount with two targeted mounts that map AWF
workDir subdirectories (agent-session-state, agent-logs) to the chroot paths.
This ensures:
- events.jsonl is captured in AWF workDir (fixable in artifacts)
- Agent logs go through AWF workDir (consistent with non-chroot mode)
- Host ~/.copilot contents (config, auth state) are no longer exposed to the
sandboxed agent — it gets an empty writable ~/.copilot from the empty home
volume instead
Fixes#1592
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add --session-state-dir flag for timeout-safe session export
Add a --session-state-dir option (following the --proxy-logs-dir pattern)
that writes the entire Copilot CLI session directory tree directly to a
predictable, external path. This makes the full session state (events.jsonl,
session.db, plan.md, checkpoints, etc.) available for artifact upload
without relying on post-cleanup /tmp paths.
When specified:
- Session state is written directly to the given path during execution
- Permissions are fixed during cleanup (chmod -R a+rX)
- The path survives AWF workDir deletion (timeout-safe)
When not specified (default):
- Session state goes to workDir/agent-session-state as before
- Moved to /tmp/awf-agent-session-state-<timestamp> during cleanup
Also supports AWF_SESSION_STATE_DIR environment variable.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: pre-create .copilot in empty home volume for package extraction
Copilot CLI needs to create ~/.copilot/pkg/ for package extraction. When
the blanket ~/.copilot bind mount was replaced with targeted sub-mounts
(session-state, logs), Docker auto-created the .copilot directory as
root-owned to serve as a mount point. This caused EACCES when Copilot CLI
tried to mkdir ~/.copilot/pkg as the runner user.
Fix by pre-creating .copilot inside the empty home volume directory with
correct UID/GID ownership, so it's writable after chroot.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: keep ~/.copilot host mount with session-state/logs overlays
Removing the blanket ~/.copilot mount broke MCP config access and package
extraction. Copilot CLI needs:
- ~/.copilot/mcp-config.json (MCP server config, written by gh-aw framework)
- ~/.copilot/pkg/ (package extraction during startup)
Restore the host ~/.copilot bind mount and overlay session-state and logs
from the AWF workDir on top. Docker processes mounts in order, so the
later session-state and logs mounts shadow the corresponding paths under
the parent ~/.copilot mount.
Result:
- MCP config and packages accessible from host (as before)
- session-state → AWF workDir (events.jsonl captured)
- logs → AWF workDir (agent logs captured)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: chown session-state and agent-logs dirs to host user
AWF runs as root but the agent container runs as the host user (e.g., UID
1001). The session-state and agent-logs overlay directories were created
by root and never chowned, so Copilot CLI could not create session
subdirectories or write events.jsonl.
Chown both directories to the host user's UID/GID after creation, matching
how squid-logs are chowned to the proxy user.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: add cleanup tests for sessionStateDir branches
Add tests covering the sessionStateDir conditional cleanup paths to fix
the branch coverage regression (-0.10%):
- Preserve session state to /tmp when sessionStateDir is not specified
- Chmod session state in-place when sessionStateDir is specified
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments