[log] Add debug logging to guard session lifecycle in guard_init.go - #13663
github-actions[bot] wants to merge 1 commit into
Conversation
Adds debug-level logging calls (via the existing logGuardInit logger) for the safe-outputs guard validation outcome and the per-session guard instance lifecycle (creation and closure), which previously had no debug tracing despite handling non-trivial multi-agent guard state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The reviewed logging changes introduce no unresolved issues.
Review effort: Balanced
Findings: None
What changed in this PR
Adds debug logging for safe-output validation and per-session guard lifecycle management.
Changes:
- Logs validation skips, failures, and successes.
- Logs isolated guard creation with hashed session IDs.
- Logs session guard cleanup counts.
| File | Description |
|---|---|
internal/server/guard_init.go |
Adds guard validation and lifecycle debug logging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔒 mcpg Read-Only Stress — default AWFSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked through any surface. The
Part A and Part C (all reads) passed cleanly with data returned on every call.
|
🔒 mcpg Read-Only Stress — gvisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE Notes:
|
Summary
Adds meaningful debug-level logging to
internal/server/guard_init.go, reusing the file's existinglogGuardInitlogger (logger.ForFile()), which was declared but underused.Changes
validateSafeOutputsGuards: logs why validation was skipped (DIFC disabled / not strict mode / no non-noop source guard) and whether validation ultimately passed or failed.guardForSession: logs creation of a new isolated per-session guard instance in multi-agent mode, including the (hashed) session ID, server ID, and template guard name.closeSessionGuards: logs how many sessions' isolated guard instances are being closed on shutdown/cleanup.These paths previously had no debug tracing despite managing non-trivial multi-agent guard state (per-session guard instantiation/teardown and a security-relevant validation gate), making them harder to troubleshoot.
Validation
gofmt -l— cleango build -o awmg— succeedsgo vet ./internal/server/...— cleango test ./internal/server/...— passesmake agent-finished— all Go build/vet/gofmt/unit/integration tests pass. The only failing step is the Rust guard unit test stage, which fails solely due to a sandboxed-networkcrates.ioregistry connection error (HTTP 403 on CONNECT tunnel) unrelated to this change.Notes
No side-effecting log arguments were added; all logged values (session ID hash, server ID, guard name, session count) are already computed by the surrounding code for other purposes.
Warning
Firewall blocked 6 domains
The following domains were blocked by the firewall during workflow execution:
api.github.comexample.comindex.crates.iononexistent.localslow.example.comthishostdoesnotexist12345.com[!TIP]
api.github.comis blocked because GitHub API access uses the built-in GitHub tools by default. Instead of addingapi.github.comtonetwork.allowed, usetools.github.mode: gh-proxyfor direct pre-authenticated GitHub CLI access without requiring network access toapi.github.com:See GitHub Tools for more information on
gh-proxymode.To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.