|
|
@@ -797,6 +797,33 @@ it.instance("failed subtask preserves metadata on error tool state", () =>
|
|
|
}),
|
|
|
)
|
|
|
|
|
|
+it.instance("subtask child inherits parent session external_directory allow", () =>
|
|
|
+ Effect.gen(function* () {
|
|
|
+ const { llm } = yield* useServerConfig(providerCfg)
|
|
|
+ const prompt = yield* SessionPrompt.Service
|
|
|
+ const sessions = yield* Session.Service
|
|
|
+ const chat = yield* sessions.create({
|
|
|
+ title: "Parent",
|
|
|
+ permission: [{ permission: "external_directory", pattern: "/tmp/allowed/*", action: "allow" }],
|
|
|
+ })
|
|
|
+ yield* llm.text("done")
|
|
|
+ const msg = yield* user(chat.id, "hello")
|
|
|
+ yield* addSubtask(chat.id, msg.id)
|
|
|
+
|
|
|
+ yield* prompt.loop({ sessionID: chat.id })
|
|
|
+
|
|
|
+ const kids = yield* sessions.children(chat.id)
|
|
|
+ expect(kids).toHaveLength(1)
|
|
|
+ const child = kids[0]!
|
|
|
+ const rules = child.permission ?? []
|
|
|
+ expect(rules).toEqual(
|
|
|
+ expect.arrayContaining([{ permission: "external_directory", pattern: "/tmp/allowed/*", action: "allow" }]),
|
|
|
+ )
|
|
|
+ expect(Permission.evaluate("external_directory", "/tmp/allowed/file", rules).action).toBe("allow")
|
|
|
+ expect(Permission.evaluate("task", "anything", rules).action).toBe("deny")
|
|
|
+ }),
|
|
|
+)
|
|
|
+
|
|
|
it.instance(
|
|
|
"running subtask preserves metadata after tool-call transition",
|
|
|
() =>
|