Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

Adds comprehensive debug logging to internal/tty/container.go to improve troubleshooting and development visibility when detecting container environments.

Changes

Enhanced the IsRunningInContainer() function with 6 meaningful debug log statements:

  1. Function entry - Logs when container detection starts
  2. Docker detection - Logs when /.dockerenv file is found
  3. cgroup detection - Logs when /proc/1/cgroup contains container indicators
  4. Error handling - Logs when /proc/1/cgroup read fails
  5. Environment variable detection - Logs when RUNNING_IN_CONTAINER=true
  6. Negative case - Logs when not running in a container

Logging Details

  • Logger namespace: tty:container (follows pkg:filename convention)
  • Import added: github.com/githubnext/gh-aw-mcpg/internal/logger
  • No side effects: All log arguments are simple variables or strings
  • Control flow coverage: Logs all detection paths including error cases

Testing

The changes follow the project's logging guidelines from AGENTS.md:

  • ✅ Logger naming convention followed (tty:container)
  • ✅ No side effects in logger arguments
  • ✅ Meaningful messages for debugging
  • ✅ Function entry logged
  • ✅ Control flow decisions logged
  • ✅ Error cases logged

Debug Output

When running with DEBUG=tty:* ./awmg, you'll see:

tty:container Detecting container environment
tty:container Container detected: /.dockerenv file exists

Or in non-container environments:

tty:container Detecting container environment
tty:container Failed to read /proc/1/cgroup: open /proc/1/cgroup: permission denied
tty:container Not running in container

This provides valuable insight into how the container detection logic executes in different environments.

AI generated by Go Logger Enhancement

@github-actions
Copy link
Contributor Author

Smoke Test Results

Last 2 Merged PRs:

Test Results:
✅ GitHub MCP
✅ Serena MCP
✅ Playwright
✅ File Writing
✅ Bash Tool

Overall: PASS

cc: @github-actions

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor Author

Smoke Test Results - Copilot Engine

PRs Tested: #502 (fixed agent prompt), #500 (changed debug env var)

✅ GitHub MCP
✅ Serena MCP
✅ Playwright
✅ File Writing
✅ Bash Tool

Overall Status: PASS

cc @github-actions[bot]

AI generated by Smoke Copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant