fix(session): avoid sticky prompt tool overrides (#31394)
This commit is contained in:
parent
b34d9242d1
commit
f43209bb8c
4 changed files with 58 additions and 27 deletions
|
|
@ -824,6 +824,33 @@ it.instance("subtask child inherits parent session external_directory allow", ()
|
|||
}),
|
||||
)
|
||||
|
||||
noLLMServer.instance("prompt tools replace previous prompt tool rules", () =>
|
||||
Effect.gen(function* () {
|
||||
const prompt = yield* SessionPrompt.Service
|
||||
const sessions = yield* Session.Service
|
||||
const session = yield* sessions.create({ title: "Prompt tools" })
|
||||
|
||||
yield* prompt.prompt({
|
||||
sessionID: session.id,
|
||||
agent: "build",
|
||||
noReply: true,
|
||||
tools: { bash: false },
|
||||
parts: [{ type: "text", text: "first" }],
|
||||
})
|
||||
yield* prompt.prompt({
|
||||
sessionID: session.id,
|
||||
agent: "build",
|
||||
noReply: true,
|
||||
tools: { read: true },
|
||||
parts: [{ type: "text", text: "second" }],
|
||||
})
|
||||
|
||||
const reloaded = yield* sessions.get(session.id)
|
||||
expect(reloaded.permission).toEqual([{ permission: "read", pattern: "*", action: "allow" }])
|
||||
expect(Permission.evaluate("bash", "anything", reloaded.permission ?? []).action).toBe("ask")
|
||||
}),
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"running subtask preserves metadata after tool-call transition",
|
||||
() =>
|
||||
|
|
|
|||
|
|
@ -421,19 +421,15 @@ describe("tool.task", () => {
|
|||
{
|
||||
permission: "bash",
|
||||
pattern: "*",
|
||||
action: "allow",
|
||||
action: "deny",
|
||||
},
|
||||
{
|
||||
permission: "read",
|
||||
pattern: "*",
|
||||
action: "allow",
|
||||
action: "deny",
|
||||
},
|
||||
])
|
||||
expect(seen?.tools).toEqual({
|
||||
todowrite: false,
|
||||
bash: false,
|
||||
read: false,
|
||||
})
|
||||
expect(seen?.tools).toBeUndefined()
|
||||
}),
|
||||
{
|
||||
config: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue