Persist the agent workspace on a volume and fix DM tool approval#24
Merged
Conversation
Set WORKSPACE_ROOT to /data/workspace in the image and create the directory, so a volume mounted at /data -- a Railway volume, or a docker run -v mount -- keeps the files.* and shell.run workspace across redeploys. With nothing mounted the path is an ordinary directory and the workspace is ephemeral, exactly as before. Documents the /data mount path in railway.toml, .env.example and the README.
_collect_tool_approval resolved the channel with bot.get_channel, which returns None for an uncached DM channel, so every gated tool call in a DM was denied without a prompt ever appearing. Take the channel from the placeholder message instead: it is always the real channel the turn is replying in, whether a guild channel, a thread or a DM.
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
files.*andshell.runtools) now lives at/data/workspace, set viaWORKSPACE_ROOTin the Docker image, with the directory created at build time. A volume mounted at/data-- a Railway volume, or adocker run -vmount -- keeps the workspace across redeploys. With nothing mounted,/datais an ordinary directory and the workspace is ephemeral, exactly as before. The/datamount path is documented inrailway.toml,.env.exampleand the README._collect_tool_approvalresolved the channel withbot.get_channel(), which returnsNonefor an uncached DM channel -- so in a DM every gated tool call was denied without an Approve/Reject prompt ever appearing. The channel is now taken from the placeholder message, which is always the real channel the turn is replying in (guild channel, thread or DM alike).Deploying on Railway
Attach a volume to the service with the mount path
/data. Nothing else is needed -- the image already pointsWORKSPACE_ROOTat/data/workspace.Test plan
python -m pytest tests/-- 157 passing.python -m compileall config.py main.py framework ai cogs./data, files written byfiles.writesurvive a redeploy.Generated by Claude Code