Repository navigation
fix(ptc): teach only the tool surface a scope publishes - #930
Open
Nicholas023 wants to merge 1 commit into
Open
Nicholas023 wants to merge 1 commit into
Nicholas023 wants to merge 1 commit into
Conversation
A scope without the loader was still taught to call `tools.ops_load_sdk`, so every such session spent a round trip on a call that cannot succeed and failed with "is not a function". The guidance and the `bypass` notice now render from the surface the scope actually publishes: - a loader-less scope gets a direct-call step in place of the load step, its table row, and any fenced example that teaches loading, and says so when nothing is published at all; - the file-work line names only the file APIs that are loadable or resident, never the shell it just accused, and a read-only policy drops the mutating APIs from that list; - the surface is resolved per agent at delivery time, so a narrow pool or a read-only session is never told to load what it cannot reach. The loader-present path is byte-identical for a full pool. Two limits are documented in the reference: the shipped lesson itself is substituted only when the loader is absent, and the lists follow the configured pool and the read-only policy without the per-agent ownership narrowing. Closes T-Auto#922
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.
Closes #922
What was wrong
batchingGuidanceshipped one lesson for every scope: step 3 told the model toops_load_sdkthe names it was missing, and thebypassnotice repeated thesame instruction. With
dynamicTools: falsethe loader is never published, sothat step named a tool the scope cannot call.
Minimum reproduction: run
ops-ptcwithdynamicTools: false, send anynon-empty user message, and the first accepted batch carries a lesson whose
step 3 and table row both point at
tools.ops_load_sdk. A model that followsit spends one round trip and gets
tools.ops_load_sdk is not a function—the failure reported in #922. The same text reached the
bypassnotice, whichnamed five OPS APIs even in scopes that publish none of them.
The change
src/ptc/batching-guidance.ts: the renderer and the notice take aGuidanceSurface(loader,resident,loadable) and render from it.A loader-less scope gets a direct-call step in place of the load step, its
table row, and any fenced example that teaches loading; the file-work line
names only file APIs that are loadable or resident, never the shell it just
accused. Section scanning tracks fences, and headings are matched by word so
Payload budgetis not mistaken for a load step.src/publication/ptc.ts: builds the surface per agent at delivery time, soa narrow pool or a read-only policy cannot be told to load what it cannot
reach; the read-only predicate is shared with tool registration.
test/: four suites cover the loader-less path end to end (liverun_coderow), the notice wording, the fence/anchor edges, and aread-only agent.
Deliberate non-goals, and why:
prompts/batching-guidance.mdis untouched. The loader-present path staysbyte-identical for a full pool (a test asserts equality), which keeps the
shipped lesson and its cache intact.
allowedToolsdoes not rewrite the shipped trajectories: thelesson is substituted only when the loader is absent. This is stated in
docs/configuration-reference.md.per-agent ownership narrowing. Also stated in the reference.
dynamicToolsandsandbox policy.
Validation
Behaviour-level red/green, not a structural check: with the built
lib/ptc/batching-guidance.jspatched back toif (true) return text(thepre-fix behaviour), the live suite fails:
Restoring the file and rebuilding brings it back to 26/26.
docs/CHANGELOG.mdhas## [Unreleased]entries in both languages; thebilingual configuration reference documents the two limits above.
package.jsonversion andoptionalDependenciesunchanged.
loader-present guidance is byte-identical; only the loader-less path and the
notice text differ. No tool schema changed.
Environment
mainat88ecc72993e9e5c78597e63124b3bbcdf08b83dd(branch base88ecc729)npm ci --ignore-scripts