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
{{ message }}
Repository navigation
[awf] docker-manager: implement --diagnostic-logs flag for container failure diagnostics #1895
When AWF containers fail to start (e.g., Squid crashes at startup in DinD environments), application-level logs (access.log, audit.jsonl) are never written because the container never reached steady state. Engineers must ask customers to manually instrument their workflow to gather basic diagnostic information such as docker logs output.
This was triggered by a customer running ARC runners with DinD sidecars where a Squid container crash (exit code 1) was completely invisible — the Squid access logs were empty and the root cause required multiple rounds of manual debug steps to identify (see github/gh-aw#18385).
A comment on the issue requests this be implemented as a workflow frontmatter feature flag:
features:
awf-diagnostic-logs: true
Root Cause
src/docker-manager.ts collects Squid access logs and agent logs only from running containers via volume mounts. There is no mechanism to collect docker logs (container stdout/stderr) or container exit metadata when a container crashes before reaching its ready state.
The cleanup path in src/docker-manager.ts (performCleanup) runs docker compose down -v without first capturing container logs.
Proposed Solution
Add diagnosticLogs?: boolean to WrapperConfig in src/types.ts and a --diagnostic-logs CLI flag in src/cli.ts.
Also expose as a workflow frontmatter feature flag (features.awf-diagnostic-logs: true) — the gh-aw compiler must map this to the --diagnostic-logs AWF flag.
In src/docker-manager.ts, add a collectDiagnosticLogs(workDir) function that runs after a non-zero exit code is detected. It should collect:
docker logs <container> for each of: awf-squid, awf-agent, awf-api-proxy, awf-iptables-init
docker inspect --format '\{\{.State.ExitCode}} \{\{.State.Error}}' for each container
docker inspect --format '\{\{json .Mounts}}' for volume mount verification (critical for DinD debugging)
A sanitized docker-compose.yml with env vars containing TOKEN, KEY, or SECRET redacted
Output written to \$\{workDir}/diagnostics/ (or \$\{auditDir}/diagnostics/ when the audit dir is configured)
What NOT to collect: Raw env vars, full docker inspect output (contains env vars), host filesystem contents.
Behavior: Off by default. When enabled and AWF exits non-zero, collect diagnostics before docker compose down -v. When disabled, current behavior is preserved exactly.
Activity