Skip to content

fix: Remove sys___init requirement - sessions always auto-created#831

Merged
lpcox merged 1 commit intomainfrom
lpcox/remove-sys-init-requirement
Feb 7, 2026
Merged

fix: Remove sys___init requirement - sessions always auto-created#831
lpcox merged 1 commit intomainfrom
lpcox/remove-sys-init-requirement

Conversation

@lpcox
Copy link
Collaborator

@lpcox lpcox commented Feb 7, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 7, 2026 23:03
@lpcox lpcox merged commit 0ee4bf3 into main Feb 7, 2026
9 checks passed
@lpcox lpcox deleted the lpcox/remove-sys-init-requirement branch February 7, 2026 23:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the requirement to call sys___init before other tool calls by making session creation automatic regardless of the DIFC setting, aligning behavior with standard MCP client expectations.

Changes:

  • Update UnifiedServer.requireSession() to always auto-create missing sessions (including when DIFC is enabled).
  • Adjust unit tests and documentation/flag help text to reflect the new session behavior.
  • Pin ghcr.io/github/gh-aw-mcpg image in select locked workflows to v0.0.103 instead of latest.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/server/unified.go Always auto-creates sessions in requireSession() and creates per-session payload directories.
internal/server/unified_test.go Updates session-requirement tests to assert auto-creation behavior under DIFC.
internal/cmd/flags_difc.go Updates --enable-difc flag description to remove sys init requirement language.
config.example.toml Updates DIFC configuration comment to reflect policy enforcement behavior.
README.md Updates CLI flag documentation to match new DIFC/session semantics.
.github/workflows/nightly-mcp-stress-test.lock.yml Pins gh-aw-mcpg image to v0.0.103.
.github/workflows/large-payload-tester.lock.yml Pins gh-aw-mcpg image to v0.0.103.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 859 to +875
if session == nil {
log.Printf("Session not found for ID: %s. Available sessions: %v", sessionID, us.getSessionKeys())
return fmt.Errorf("sys___init must be called before any other tool calls")
// Need to create session - acquire write lock
us.sessionMu.Lock()
// Double-check after acquiring write lock to avoid race condition
if us.sessions[sessionID] == nil {
log.Printf("Auto-creating session for ID: %s", sessionID)
us.sessions[sessionID] = NewSession(sessionID, "")
log.Printf("Session auto-created for ID: %s", sessionID)

// Ensure session directory exists in payload mount point
// This is done after releasing the lock to avoid holding it during I/O
us.sessionMu.Unlock()
if err := us.ensureSessionDirectory(sessionID); err != nil {
logger.LogWarn("client", "Failed to create session directory for session=%s: %v", sessionID, err)
// Don't fail - payloads will attempt to create the directory when needed
}
return nil
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

requireSession() now auto-creates sessions and calls ensureSessionDirectory(sessionID) based on the session ID from context. Since ensureSessionDirectory() uses filepath.Join(us.payloadDir, sessionID) without validating/sanitizing sessionID, a malicious or malformed session ID containing path separators, .., or an absolute path could cause directory creation outside the intended payload directory. Please validate the session ID before using it in filesystem paths (e.g., reject absolute paths, clean and ensure the result stays within us.payloadDir, and/or restrict to a safe character set).

Copilot uses AI. Check for mistakes.
Comment on lines 859 to +875
if session == nil {
log.Printf("Session not found for ID: %s. Available sessions: %v", sessionID, us.getSessionKeys())
return fmt.Errorf("sys___init must be called before any other tool calls")
// Need to create session - acquire write lock
us.sessionMu.Lock()
// Double-check after acquiring write lock to avoid race condition
if us.sessions[sessionID] == nil {
log.Printf("Auto-creating session for ID: %s", sessionID)
us.sessions[sessionID] = NewSession(sessionID, "")
log.Printf("Session auto-created for ID: %s", sessionID)

// Ensure session directory exists in payload mount point
// This is done after releasing the lock to avoid holding it during I/O
us.sessionMu.Unlock()
if err := us.ensureSessionDirectory(sessionID); err != nil {
logger.LogWarn("client", "Failed to create session directory for session=%s: %v", sessionID, err)
// Don't fail - payloads will attempt to create the directory when needed
}
return nil
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

With sessions now always auto-created, any client that can influence the session ID can force unbounded growth of us.sessions and corresponding directories under the payload mount (disk usage / inode exhaustion). Consider adding a cap/TTL cleanup for us.sessions, or deferring directory creation until a payload actually needs to be written, to reduce DoS risk.

Copilot uses AI. Check for mistakes.
await determineAutomaticLockdown(github, context, core);
- name: Download container images
run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.13.12 ghcr.io/github/gh-aw-firewall/squid:0.13.12 ghcr.io/github/gh-aw-mcpg:latest ghcr.io/github/github-mcp-server:v0.30.2 ghcr.io/github/github-mcp-server:v0.30.3 mcp/brave-search mcp/duckduckgo mcp/everart mcp/fetch mcp/filesystem mcp/gdrive mcp/git mcp/google-maps mcp/hackernews-mcp mcp/kubernetes mcp/memory mcp/puppeteer mcp/sentry mcp/sequentialthinking mcp/slack mcp/sqlite mcp/time mcp/wikipedia-mcp mcp/youtube-transcript mcr.microsoft.com/playwright/mcp mcr.microsoft.com/playwright:v1.49.1-noble node:lts-alpine
run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.13.12 ghcr.io/github/gh-aw-firewall/squid:0.13.12 ghcr.io/github/gh-aw-mcpg:v0.0.103 ghcr.io/github/github-mcp-server:v0.30.2 ghcr.io/github/github-mcp-server:v0.30.3 mcp/brave-search mcp/duckduckgo mcp/everart mcp/fetch mcp/filesystem mcp/gdrive mcp/git mcp/google-maps mcp/hackernews-mcp mcp/kubernetes mcp/memory mcp/puppeteer mcp/sentry mcp/sequentialthinking mcp/slack mcp/sqlite mcp/time mcp/wikipedia-mcp mcp/youtube-transcript mcr.microsoft.com/playwright/mcp mcr.microsoft.com/playwright:v1.49.1-noble node:lts-alpine
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

This workflow pins ghcr.io/github/gh-aw-mcpg to v0.0.103, but other locked workflows in the repo still reference ghcr.io/github/gh-aw-mcpg:latest (e.g. smoke-copilot.lock.yml). This inconsistency can make CI behavior drift across workflows; consider updating the remaining workflows to the same pinned version (or centralizing the version in one place) so tests run against the same gateway image.

Copilot uses AI. Check for mistakes.
await determineAutomaticLockdown(github, context, core);
- name: Download container images
run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.13.12 ghcr.io/github/gh-aw-firewall/squid:0.13.12 ghcr.io/github/gh-aw-mcpg:latest ghcr.io/github/github-mcp-server:v0.30.2 ghcr.io/github/github-mcp-server:v0.30.3 mcp/filesystem node:lts-alpine
run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.13.12 ghcr.io/github/gh-aw-firewall/squid:0.13.12 ghcr.io/github/gh-aw-mcpg:v0.0.103 ghcr.io/github/github-mcp-server:v0.30.2 ghcr.io/github/github-mcp-server:v0.30.3 mcp/filesystem node:lts-alpine
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

This workflow pins ghcr.io/github/gh-aw-mcpg to v0.0.103, but other locked workflows in the repo still reference ghcr.io/github/gh-aw-mcpg:latest (e.g. smoke-copilot.lock.yml). This inconsistency can make CI behavior drift across workflows; consider updating the remaining workflows to the same pinned version (or centralizing the version in one place) so tests run against the same gateway image.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

fix: Remove sys___init requirement - sessions always auto-created ✅
upated aws ✅
Serena activate ✅
Playwright title contains GitHub ✅
File write + cat ✅
Overall: PASS

AI generated by Smoke Codex

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant