-
Notifications
You must be signed in to change notification settings - Fork 51
Run cogs in custom working directory #516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
juniper-shopify
merged 1 commit into
main
from
juni/run-cogs-in-custom-working-directory
Nov 3, 2025
Merged
Run cogs in custom working directory #516
juniper-shopify
merged 1 commit into
main
from
juni/run-cogs-in-custom-working-directory
Nov 3, 2025
Conversation
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
This was referenced Nov 3, 2025
dersam
approved these changes
Nov 3, 2025
acd3c07 to
ddf4cdb
Compare
2444a97 to
6ef9696
Compare
e6a8a86 to
560f2bf
Compare
1b1245e to
4773e1d
Compare
d83ca19 to
806a6f5
Compare
4773e1d to
015d9a3
Compare
806a6f5 to
81643b5
Compare
015d9a3 to
5ec72bf
Compare
33f0052 to
de0e881
Compare
81643b5 to
536605a
Compare
efa54ee to
2b544a0
Compare
536605a to
1ac0979
Compare
1ac0979 to
622bada
Compare
2b544a0 to
791b3b6
Compare
Cogs that run external commands, like `cmd` and `agent`, or that access files on disk (like `chat`, when we give it the ability to do thing like handle image input/output) may benefit from being configured with an alternate working directory. Note: Roast does not automatically change into the configured working directory when running a cog for which it is specified, because doing so causes issues for parallelization. (If two cogs are running in parallel and each attempts to change the working directory of the main ruby process, then it gets changed for all parallel cogs, leading to unexpected behaviour). Instead cogs that need to interact with the filesystem should use the `working_directory` config value intentionally to operate within that folder *without* changing the working directory of the ruby process.
622bada to
4b64201
Compare
Merge activity
|
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.

Cogs that run external commands, like
cmdandagent, or that access files on disk (likechat, when we give it the ability to do thing like handle image input/output) may benefit from being configured with an alternate working directory.Note: This PR does not make Roast automatically change into the configured working directory when running a cog for which it is specified, because doing so causes issues for parallelization. (If two cogs are running in parallel and each attempts to change the working directory of
the main ruby process, then it gets changed for all parallel cogs, leading to unexpected behaviour. There's no way to effectively coördinate this.)
Instead cogs that need to interact with the filesystem, or care about their working directory for any reason, should use the
working_directoryconfig value internally to intentionally do whatever they want to do within that folder without changing the working directory of the ruby process.(We'll maybe want to put some guardrails in place, at least a warning, to prevent the user from inadvertently changing the working directory in, say, a cog's input block. Though that's only an issue if they do use async cogs and don't realize/anticipate the side effects. Probably a niche issue.)