Repository navigation
fix(tools): correct bash/read failure semantics, clamp model timeouts, repair dependency declaration - #1
Open
javidrazack wants to merge 5 commits into
Open
fix(tools): correct bash/read failure semantics, clamp model timeouts, repair dependency declaration#1javidrazack wants to merge 5 commits into
javidrazack wants to merge 5 commits into
Conversation
The file declared "dependencies" twice; npm's last-wins resolution silently dropped diff@9, which the edit/write/patch tools import at runtime. Keep a single block declaring both ssh2 and diff.
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
Four fixes found while hardening this plugin for daily production use against Ubuntu 24.04 hosts. Each is small, test-backed, and independent of the others.
1.
package.json— duplicatedependenciesblocks droppeddiffat runtimeThe file declared
"dependencies"twice; npm's last-wins resolution silently discardeddiff@9, which theedit/write/patchtools import. Merged into a single block.2.
bash— remote exit code is now the sole failure signalA hardcoded stderr phrase-list (
"permission denied","command not found", …) made the tool throw even when the command exited 0 whenever stderr merely contained those strings — constant false failures when grepping logs that mention them as content. Failure is now determined by exit code only; stdout/stderr pass through unchanged (byte-identical output, pinned by tests).Legacy caveat documented: very old SSH servers that don't propagate exit codes would report failures as successes — noted in README for OpenSSH <5.x-era targets.
3.
bash— model-suppliedtimeoutvalues are now clampedThe tool trusted
args.timeoutverbatim. In real sessions models send seconds-scale or string values, producing failures like:(Session storage from our runs showed three such calls with
"timeout": "10"/"30"/"60".) Values are now clamped to[1_000, 600_000]ms — the ceiling keeps headroom for package upgrades. The separate negative-value throw is superseded by the clamp.4.
read— tolerate zero/negative offsets; harden line slicingModels sometimes send
offset=0; the tool assumed 1-indexed and crashed:Offsets ≤0/NaN are treated as unspecified; slicing logic extracted into an exported pure
sliceLines()helper covered by unit tests (byte-cap boundary, trailing-newline element, truncation markers).Testing
test/bash.test.mjs(14),test/read.test.mjs(12) — includes byte-exact output pins so future refactors can't silently change formatsnpm run lintclean; fullnpm testgreen (54 tests across the complete stacked series)Reviewer notes
README.zh-CN.mdonce overall direction is agreed