fix(core): keep execute tool cache stable (#38783)

This commit is contained in:
Aiden Cline 2026-07-25 13:01:05 -05:00 committed by GitHub
commit 33390cc457
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 163 additions and 45 deletions

View file

@ -113,7 +113,9 @@ describe("CodeModeInstructions.render", () => {
})
test("renders only the no-tools notice for an empty catalog", () => {
expect(render([])).toBe("No tools are currently available.")
expect(render([])).toBe(
"No Code Mode tools are currently available. Do not call `execute` until a later system update announces available tools.",
)
})
})

View file

@ -21,6 +21,25 @@ const lookup: CodeModeCatalog.Entry = {
}
describe("CodeModeInstructions", () => {
it.effect("instructs the model not to call execute while the catalog is empty", () =>
Effect.gen(function* () {
const initialized = yield* readInitial(CodeModeInstructions.make([]))
expect(initialized.text).toBe(
"No Code Mode tools are currently available. Do not call `execute` until a later system update announces available tools.",
)
const added = yield* readUpdate(CodeModeInstructions.make([echo]), initialized)
expect(added.text).toContain("New tools are available in addition to those previously listed:")
expect(added.text).toContain(echo.signature)
expect(yield* readUpdate(CodeModeInstructions.make([]), { values: added.values })).toMatchObject({
text:
"The Code Mode tool catalog has changed. This catalog supersedes the previous Code Mode tool catalog.\n\n" +
"No Code Mode tools are currently available. Do not call `execute` until a later system update announces available tools.",
})
}),
)
it.effect("renders the initial catalog, semantic deltas, and removal", () =>
Effect.gen(function* () {
const initialized = yield* readInitial(CodeModeInstructions.make([echo]))