Skip to content

Workspace isolation not initialized for Slack socket mode and snapshot resumes #278

@buger

Description

@buger

Summary

Workspace isolation is not being properly initialized when running in Slack socket mode, even when workspace.enabled: true is configured. This causes:

  1. Git checkouts to happen in .visor/worktrees/ but NOT be added to the workspace
  2. AI provider (ProbeAgent) to only have access to the Visor repo directory, not the checkout paths
  3. AI searches to fail finding code in checked-out repositories

Root Cause

There are two issues:

1. resumeFromSnapshot() doesn't call initializeWorkspace()

In src/state-machine-execution-engine.ts, the resumeFromSnapshot() function (line ~1049) creates a new context via buildEngineContextForRun() but never calls initializeWorkspace(context).

When Slack socket runner resumes from a snapshot (src/slack/socket-runner.ts line 320-336), it uses resumeFromSnapshot() which skips workspace initialization entirely.

2. Potential issue with cold runs

Even for cold runs where executeChecks()executeGroupedChecks()initializeWorkspace() should be called, workspace is not being initialized. This needs further investigation.

Evidence from logs

[GitCheckout]   _parentContext exists: true
[GitCheckout]   workspace exists: false
[GitCheckout] Workspace not enabled, skipping addProject

And from AI provider:

[DEBUG] 🗂 ProbeAgent workspace config:
[DEBUG]    path (cwd): /home/buger/projects/visor2
[DEBUG]    allowedFolders[0]: /home/buger/projects/visor2

The workspace is clearly not initialized despite workspace.enabled: true in config:

workspace:
  enabled: true
  cleanup_on_exit: true

Impact

  • Git checkouts succeed (to .visor/worktrees/worktrees/TykTechnologies-tyk-HEAD-...)
  • But workspace.addProject() is never called
  • AI provider falls back to using only the Visor repo directory
  • AI cannot search/find code in the checked-out repositories

Proposed Fix

  1. Add initializeWorkspace(context) call to resumeFromSnapshot() after context creation
  2. Investigate why cold runs also don't initialize workspace
  3. Add workspace initialization to any code path that creates a new EngineContext

Related Files

  • src/state-machine-execution-engine.ts: executeGroupedChecks() (line ~276-278), resumeFromSnapshot() (line ~1049)
  • src/state-machine/context/build-engine-context.ts: initializeWorkspace()
  • src/slack/socket-runner.ts: Slack message handling
  • src/providers/git-checkout-provider.ts: Workspace integration
  • src/providers/ai-check-provider.ts: Workspace detection for ProbeAgent

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions