Repository navigation
fix: truthful failure claims, non-relative glob refusal, and a session-eviction notice - #241
Merged
Merged
Conversation
…e checker-limit docs The RLM system prompt promised that a refused import "raises ModuleNotFoundError". On 0.0.23 it is a static `unresolved-import` typing error before execution — and `ModuleNotFoundError`/`ImportError` are themselves rejected by the checker, so `except ModuleNotFoundError` cannot even be written. A model told otherwise writes code that cannot work. The same pass closes the doc gaps the two review lenses found against the live run: - I/O is print()-only: sys.stdout.write/sys.stderr.write, os.environ and os.getenv pass the checker and raise at runtime. - yield and del join the parser refusals, and a refusal discards the whole snippet — nothing in it runs. - Lambda parameters infer as object: reduce/max/min need an annotated def, and the rejection is position-dependent (sorted/list.sort are exempt). - Only class objects carry __name__; functions, builtins and instances expose no dunder methods. - SKILL.md's checker lists now name every measured absent/rejected builtin and stdlib member, keeping the runtime-absent vs runtime-present split. Tests: the rules test now measures the refusal it describes (D156), and a new test measures the runtime-present names with the checker off, one fresh session per name — an absent name comes back as a NameLookupSnapshot rather than throwing, which is why the probe cannot share a session. Also fixes the "all six" comment left stale by 391282f.
The jail resolves `path`; `pattern` is a glob and never reaches it, so
find('/etc/*') was answered with pi's own "No files found matching pattern"
— an empty result the model reads as fact, where read/ls/grep raise
PermissionError naming the root. Refuse an absolute pattern (or a `..`
segment) in the find spec's prepareArgs, before pi runs fd. No data ever
left the root; the difference is that the refusal now says so.
The escape matrix gains both shapes, so the soft answer cannot come back.
Eviction reads as state loss with no explanation: the pool silently drops the least-recently-used session at the cap, and the next call on that id starts over. docs/ship-59.md recorded this as a residual — "observe in practice before adding a tombstone" — and the live e2e run is that observation (three of ~74 sessions vanished, including the default). insert() now records the evicted id in a bounded, insertion-ordered set (EVICTION_TOMBSTONES = 64), and the next run or resume on it carries a one-shot `[evicted]` notice: what dropped it, what is gone, and the knob that keeps more. Resume gets the resume-shaped sentence, including the D3-parity path where the eviction lands inside the trust check. The model-facing docs catch up: the `repl` description names the 32-session cap, and SKILL.md/README describe the notice. The limit parameters also say that a non-positive or non-finite value is treated as omitted — the clamp that test/extension.test.ts already pinned, now visible to the model that sets it.
Two fresh-context adversarial reviewers (attack + hostile quality/mutation) went over 79204cf..HEAD. Their real findings, and the fixes: - The repo's own coverage gate was red: rememberEviction's bound loop was the only uncovered code in src/repl.ts (99.74% < 100% floor), so the "bounded" claim in the previous commit was untested. A test now drives 65 evictions and asserts the newest tombstone still explains the eviction while the oldest is forgotten — it kills both the unbounded and the disabled-bound mutants. - The eviction notice said "least-recently-used", which is false when the true LRU is suspended: insert() skips suspended and busy entries. It now says "the oldest session the pool could drop" and names the cap, so the singular case reads correctly too. - The run and resume sentences were unpinned (a purpose-swap mutant survived), as was resume's one-shot consumption; both are asserted now, and the extension description's notice clause is pinned. - The find guard was over-broad in wording and under-broad in reach: it claimed an in-root absolute pattern was "outside the search root", and it only knew '/'. It now refuses "not project-relative" (true for absolute and '..' patterns alike), checks both separators and drive letters, and the same guard covers grep's glob — the same silent-empty class, one tool over. A positive test keeps 'a..b.txt' and 'a..b/*.md' working, which kills the over-eager mutant. - The lambda bullet was wrong in both channels: it warned about a failure that does not happen (bare reduce/max/min callbacks pass) and missed the one that does (the same call inside print(...) fails to type-check). Measured and reworded, with a test pinning both halves. - SKILL.md's absent-vs-present builtin split is now read back and measured against the interpreter, so the list cannot drift; the discard-sentence claim the test comment promised is actually asserted. - docs/path-jail.md gains the find-pattern refusal; ship-59's residual 3 and review-59's "no notice" note record that the observation arrived and the tombstone followed. Ambiguous (F7)/(#F8) markers dropped. Gate: check, lint, build, npm test (1831 tests, 0 fail, 11 todo) and npm run coverage (all per-file floors met, src/repl.ts 100%) all green.
Resolve the renderPythonToolRules prompt-rule conflict: main's P1/P2 accuracy pass and this branch's adversarial review edited the same sentences. The merged prompt keeps only claims that are true against the interpreter: - "these modules are available" (main) instead of "ONLY these modules exist" — the probe checks a curated candidate list, not an exhaustive enumeration. - "yield/generators" (main) instead of "yield and del" — `del` actually works (test/shadowing.test.ts "del unbinds the name"), so the "del not supported" claim was false and is dropped from the prompt and SKILL.md. - Keeps both passes' measured truths: the stdout cap/no-stderr, the approval-denied PermissionError cause, the print()-only I/O rule, the lambda-callback and __name__ rules, and the discard-the-snippet rule. Tests: the two prompt-rules suites are merged; the `\bdel\b` assertion is removed and the lambda/SKILL measured tests are kept. tsc --noEmit and npm test (1837 pass, 0 fail, 11 todo) are green.
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
Closes out nine findings from a live end-to-end run of the extension, after two independent adversarial review passes over the fixes.
Commits
b138ac1— the RLM prompt claimed a refused import "raisesModuleNotFoundError". It does not: on Monty 0.0.23 the refusal is a staticunresolved-importtyping error before execution, andModuleNotFoundError/ImportErrorare themselves rejected by the checker — so a model told otherwise writesexcept ModuleNotFoundError, code that cannot work. The same pass completes the checker-limit docs (print()-only I/O,yield/deland whole-snippet discard, lambda callbacks,__name__/dunders) and names every measured absent/rejected builtin and stdlib member.d907e48—find'spatternis a glob, not apath, so it never reached the jail:find("/etc/*")was answered with fd's "No files found matching pattern" — an empty result the model reads as fact. The bridge now refuses a non-project-relative glob by name (both separators and drive letters) before fd runs, and the same guard coversgrep'sglob.925a0c5— eviction at the pool cap was silent: the next call on a dropped id started over with no explanation.insert()now keeps a bounded tombstone, and the nextrun/resumeon that id carries a one-shot[evicted]notice naming the cap.resetand trust rebuilds delete directly and leave no tombstone.8faed1f— the adversarial pass found the coverage gate red (the new bound loop was the only uncovered code insrc/repl.ts), an eviction message that said "least-recently-used" when suspended entries are skipped, an over-broad and under-broad find guard, the same silent-empty class ingrep'sglob, and a lambda bullet that was wrong in both directions. All closed.Verification
npm run check,npm run lint,npm run build: cleannpm test: 1831 tests, 1820 pass, 0 fail, 11 pre-existing todosnpm run coverage: all per-file floors met (src/repl.ts100.00)..guard, ignored message purpose, and aSKILL.mddrift edit each fail the suiteSKILL.md, and both halves of the lambda-callback ruleNotes
391282f(dropbytearrayfrom the type-checker gap list) and79204cf(split runtime-absent from checker-blocked builtins).