Remote Trigger: initial working directory is non-deterministic with multiple source repositories
Description
When a Remote Trigger (scheduled agent) is configured with multiple sources repositories, the initial working directory of the remote session is non-deterministic. The agent may start in any of the cloned repositories, not necessarily the first one listed.
Steps to Reproduce
- Create a Remote Trigger with multiple source repositories:
``json``
"sources": [
{"git_repository": {"url": "https://github.com/user/repo-a"}},
{"git_repository": {"url": "https://github.com/user/repo-b"}}
]
- Set a prompt that reads a file from repo-a (e.g.,
.claude/schedules/daily.md) - Run the trigger multiple times
Expected Behavior
The initial working directory should be deterministic — either:
- Always the first repository listed in
sources, or - Documented behavior specifying which repository is used
Actual Behavior
The agent sometimes starts in repo-a and sometimes in repo-b. This causes the prompt to fail with "file not found" errors when it happens to start in the wrong repository.
In our case:
- A trigger with
sources: [000-partner, zenn-content]worked correctly for several days, then suddenly failed because the agent started inzenn-contentinstead of000-partner - A separate trigger with only one source repository has never had this issue
Workaround
Added an initialization step in the prompt to detect the current directory and navigate to the correct repository before proceeding:
1. Check current directory with `ls`
2. If target file not found, use `find` to locate the correct repository
3. `cd` to the correct repository root before executing tasks
Environment
- Platform: Remote Trigger (claude.ai/code/scheduled)
- Model: claude-sonnet-4-6
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗