Skip to content

Conversation

@juniper-shopify
Copy link
Contributor

@juniper-shopify juniper-shopify commented Nov 3, 2025

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: 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_directory config 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.)

@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch from acd3c07 to ddf4cdb Compare November 3, 2025 16:05
@juniper-shopify juniper-shopify force-pushed the juni/alphabetize-functional-tests branch 2 times, most recently from 2444a97 to 6ef9696 Compare November 3, 2025 16:13
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch 2 times, most recently from e6a8a86 to 560f2bf Compare November 3, 2025 16:19
@juniper-shopify juniper-shopify force-pushed the juni/alphabetize-functional-tests branch 2 times, most recently from 1b1245e to 4773e1d Compare November 3, 2025 16:22
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch 2 times, most recently from d83ca19 to 806a6f5 Compare November 3, 2025 16:27
@juniper-shopify juniper-shopify force-pushed the juni/alphabetize-functional-tests branch from 4773e1d to 015d9a3 Compare November 3, 2025 16:27
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch from 806a6f5 to 81643b5 Compare November 3, 2025 16:30
@juniper-shopify juniper-shopify force-pushed the juni/alphabetize-functional-tests branch from 015d9a3 to 5ec72bf Compare November 3, 2025 16:30
@juniper-shopify juniper-shopify force-pushed the juni/alphabetize-functional-tests branch 2 times, most recently from 33f0052 to de0e881 Compare November 3, 2025 16:38
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch from 81643b5 to 536605a Compare November 3, 2025 16:38
@juniper-shopify juniper-shopify force-pushed the juni/alphabetize-functional-tests branch 2 times, most recently from efa54ee to 2b544a0 Compare November 3, 2025 16:41
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch from 536605a to 1ac0979 Compare November 3, 2025 16:41
@juniper-shopify juniper-shopify changed the base branch from juni/alphabetize-functional-tests to graphite-base/516 November 3, 2025 16:47
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch from 1ac0979 to 622bada Compare November 3, 2025 16:47
@graphite-app graphite-app bot changed the base branch from graphite-base/516 to main November 3, 2025 16:47
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.
@juniper-shopify juniper-shopify force-pushed the juni/run-cogs-in-custom-working-directory branch from 622bada to 4b64201 Compare November 3, 2025 16:47
@juniper-shopify juniper-shopify merged commit 58150d7 into main Nov 3, 2025
8 checks passed
Copy link
Contributor Author

Merge activity

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants