fix(core): resolve workspace for cron prompt-mode jobs in multi-workspace mode#556
Merged
chenhg5 merged 1 commit intochenhg5:mainfrom Apr 15, 2026
Merged
Conversation
…pace mode In multi-workspace mode, ExecuteCronJob() for prompt (non-shell) jobs always used the global e.agent and passed an empty workspaceDir to processInteractiveMessageWith(). This caused the Claude Code agent to start with the wrong working directory (often ~/.cc-connect) instead of the workspace bound to the cron job's channel. The fix mirrors handleMessage()'s workspace resolution logic: 1. Extract channelID from the cron job's sessionKey 2. Resolve the workspace binding via resolveWorkspace() 3. Get a workspace-specific agent via workspaceContext() 4. Pass the resolved workspace agent and dir to processInteractiveMessageWith() job.WorkDir, when explicitly set, takes highest priority as an override. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In multi-workspace mode,
ExecuteCronJob()for prompt (non-shell) jobs always used the globale.agentand passed an emptyworkspaceDirtoprocessInteractiveMessageWith(). This caused the Claude Code agent to start with the wrong working directory (typically~/.cc-connect) instead of the workspace bound to the cron job's channel.The fix mirrors
handleMessage()'s workspace resolution logic:channelIDfrom the cron job'ssessionKeyresolveWorkspace()workspaceContext()workspaceDirtoprocessInteractiveMessageWith()job.WorkDir, when explicitly set, takes highest priority as an override.Priority chain:
job.WorkDir(explicit) → workspace binding resolution → global agent fallbackCloses #555
Related
ExecuteCronJob(), but did not add workspace agent resolutionresolveChannelWorkDir()andworkspaceContext()which provide the infrastructure this fix wires intoTest plan
go test ./core/ -count=1— all tests passgo build ./...— clean buildgitStatusin agent context)job.WorkDiroverride takes precedence when explicitly set🤖 Generated with Claude Code