Repository navigation
fix(files): a read-only run reads a stored file's text with files download - #406
Merged
Merged
Conversation
…nload files download without --output writes nothing on this computer, but drive counted it as a write, so DRIVE_READ_ONLY=1 and --read-only refused it and a scheduled agent could not read a Drive file's text at all. As in ydisk-cli, --output and --overwrite are now owner-only options and the command is marked with cli-core's writesFileOnlyWith(command, "output"): cli-core routes it to drive_read over MCP, and drive's policy check lets the lock and --read-only through when no --output is given. Saving with --output stays refused under the lock. A readonly permission level still refuses the read, as cli-core's MCP check does. The untrusted marks from #395 stay on the answer. files export always writes a file and is unchanged. An agent over MCP can no longer save a download into the profile's export folder; it reads the text instead. Closes #402 Co-Authored-By: Claude Opus 5.5 <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.
Task
A scheduled agent runs locked (
DRIVE_READ_ONLY=1). It could not read a Drive file's text, because drive countedfiles downloadas a write even without--output. The ruling is that a download answered on stdout is a read. Saving it to a local path stays a local write, refused under the lock. drive should match ydisk-cli.Closes #402
What
files downloadis declared as ydisk'sfiles downloadis:effects: FETCH,--outputand--overwriteasownerOnlyOption, and cli-core'swritesFileOnlyWith(command, "output"). cli-core then runs it throughdrive_readover MCP.checkPolicy) getswritesNothingfor a download without--output. The lock and--read-onlylet it read. Areadonlypermission level still refuses it, the same as cli-core's MCP check. With--output, the lock still refuses it.<cache>/exports/<profile>/). It reads the text instead, as in ydisk.files exportis unchanged. It always writes a file (--outputis required), so it has no stdout case. For text, an agent hasdocuments getandsheets show.docs/usage.md,docs/recipes.md,docs/dev/CLI_ALIGNMENT.md) and a changelog fragment.Not covered here: cli-core does not export
fileOptionOf, so drive namesfiles downloaditself inprogram.ts, as it already did for the MCP export folder.Testing
--output <path>with theDRIVE_READ_ONLYpermission error without downloading or writing, and refuses the read atfiles.download=readonly(src/untrusted-marks.test.ts).drive_read files downloadanswers the text.outputis not accepted, and nothing lands in the export folder (src/mcp-parity.test.ts).pnpm ci:quick,pnpm lint,pnpm docs:check,pnpm generate:checkandpnpm contracts:checkpass.extended-program.test.ts, knowledge store). CI decides.readonlylevel now matches MCP, a false changelog claim was removed, and the MCP tests no longer pass for the wrong reason.🤖 Generated with Claude Code