Skip to content

[log] Add debug logging to server session handling - #16678

Merged
lpcox merged 5 commits into
mainfrom
log/session-debug-logging-20261116-ea090ab8819a992d
Nov 18, 2026
Merged

lpcox merged 5 commits into
mainfrom
log/session-debug-logging-20261116-ea090ab8819a992d

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds four debug log calls to internal/server/session.go, reusing the existing logSession logger (server:session).

  • SessionIDFromContext: logs when it falls back to the default session.
  • ensureSessionDirectory: logs stat and MkdirAll failures, including the directory path and error.
  • requireSession: logs when an existing session is reused.

No log argument computes anything or has side effects. Session IDs go through the existing util.FormatSessionIDForLog helper.

Validation: go vet ./internal/server, go test ./internal/server and go build -o awmg all pass. I did not run the full make agent-finished.

Generated by Go Logger Enhancement · copilot · routed: sonnet55 high · ~45 AIC · ⊞ 5.9K · ◷

@github-actions github-actions Bot added automation enhancement New feature or request labels Nov 16, 2026
@lpcox
lpcox marked this pull request as ready for review November 18, 2026 15:32
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 15:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change still has active moderate findings because session IDs can appear unredacted in failure logs on lines 94 and 100, violating the logging redaction contract.

1 open issue
What changed in this PR

Adds debug-level observability to server session handling without changing session behavior.

Changes:

  • Logs fallback to the default session when no session ID is available.
  • Logs session-directory stat and creation failures.
  • Logs reuse of existing sessions through the existing session logger.
File Description
internal/​server/​session.go Adds debug logging for default-session fallback, session-directory failures, and reuse of existing sessions.

Review effort: Lite (adaptive)

Comment thread internal/server/session.go Resolved
@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Comment thread internal/server/session.go Resolved
@github-actions

This comment has been minimized.

@lpcox

lpcox commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

@copilot fix all failing ci checks

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot fix all failing ci checks

Fixed the shared CI compile error in df00fa6 by switching to the session ID hash helper on main. The fix also keeps session paths out of logs. The merged tree passed the Go build, vet, unit and integration tests, targeted race tests, and all 728 Rust guard tests locally. golangci-lint was unavailable locally. GitHub marked the new CI run action_required before any jobs started, so it still needs approval to verify the fix.

Copilot AI requested a review from lpcox November 18, 2026 16:50
@github-actions

This comment has been minimized.

@lpcox

lpcox commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot fix this failing ci lint check https://github.com/github/gh-aw-mcpg/actions/runs/44351151626/job/134970610742?pr=16678

Fixed in 5e58881 by changing the error assertion to require.ErrorIs. The full pinned golangci-lint run and make agent-finished pass locally; the new GitHub CI run is currently action_required before jobs start.

@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) all target tools absent from 23-tool catalog (unknown tool -32602); zero leaks BLOCKED ⚠️ INCONCLUSIVE
C CLI reads (same 4 ops via proxied github CLI) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh not authenticated (gh auth status failed) BLOCKED ⚠️ INCONCLUSIVE
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh not authenticated, not attempted BLOCKED ⚠️ INCONCLUSIVE

Overall: INCONCLUSIVE

No write succeeded on any surface (zero leaks). Part B gap: the backend GitHub MCP server is launched with GITHUB_READ_ONLY=1 by gh-aw's tools.github wrapper, so write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) are never registered — refusals are "tool not found", which proves backend config, not mcpg's own gateway-level DIFC enforcement. Part D/E could not be exercised because gh is unauthenticated in this environment, so the token-scope boundary was not independently confirmed this run. This is not a FAIL — all reads succeeded and nothing leaked — but gateway-level write enforcement on the MCP surface and REST/GraphQL token-scope enforcement remain unconfirmed by this probe. See internal/guard and internal/difc unit tests for independent evidence of mcpg's own write-blocking layer.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit 6a9a46b into main Nov 18, 2026
30 checks passed
@lpcox
lpcox deleted the log/session-debug-logging-20261116-ea090ab8819a992d branch November 18, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants