Repository navigation
fix(agent): let a read-only cd sit anywhere in a read-only chain - #1327
Merged
Merged
Conversation
The read-only classification required `cd` to be the last segment, so the command that triggered tonight's third incident — `cd …; git worktree list; git status --short` — still fenced the whole session even after interrupted read-only shells stopped counting as unknown effects. `cd` only moves the current process: nothing observable can be waiting on it and repeating it cannot apply anything twice, so its position in the chain no longer matters. Its arguments must still be literal paths: a variable reference, a substitution, a script block or an option flag stays fenced, because such a form can name whatever a hidden command produced. The other segments of a chain are still judged one by one, and redirection, writing pipes, interpreters, `rm`, `git commit` and `cargo` stay fenced.
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.
recovery_safetyonly exempted acdfrom fencing when it was the last segmentof a chain (#1326), so the common
cd <dir>; git statusstill fenced the wholesession after Stop.
cdonly moves the process: nothing observable can bewaiting on it and repeating it cannot apply anything twice, so it is harmless in
any position - as long as its arguments are literal paths. A
$-expansion, asubstitution, or a script block can name another command, so
cd $DIR,cd $(...)and anything with(,),{,}or a backtick stay fenced, and theargument list must not start with
-.Commits
fix(agent): let a read-only cd sit anywhere in a read-only chainVerification
cargo fmt --all -- --check: cleancargo clippy -p future-agent --all-targets -- -D warnings: cleancargo test -p future-agent --lib recovery_safety: 12 passed; the read-onlytable now covers
cdbefore, between and after other read-only segments, andthe expansion cases above still fence.
Notes
The effective diff against
mainisagent/src/rpc/recovery_safety.rsonly:39 insertions, 9 deletions. This is the follow-up to #1326 and it reached
dev-huichenafter that PR had been frozen, so it travels in its own PR.