fixed abort trigger persisting across sessions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: researcher
|
||||
description: Web researcher — searches the web and synthesizes findings
|
||||
tools: web_search, web_fetch
|
||||
tools: web_search, web_fetch, safe_bash
|
||||
model: openrouter/z-ai/glm-5.2
|
||||
thinking: medium
|
||||
system-prompt: append
|
||||
|
||||
@@ -6,6 +6,7 @@ subagent_agents: scout, researcher
|
||||
model: openrouter/z-ai/glm-5.2
|
||||
thinking: medium
|
||||
system-prompt: append
|
||||
auto-exit: true
|
||||
---
|
||||
|
||||
You are a worker agent. You operate in an isolated context — you have no knowledge of any prior conversation. All necessary context will be provided in the task description.
|
||||
|
||||
@@ -1500,6 +1500,14 @@ export default function subagentsExtension(pi: ExtensionAPI) {
|
||||
// Capture the UI context for widget updates
|
||||
pi.on("session_start", (_event, ctx) => {
|
||||
latestCtx = ctx;
|
||||
// pi runs multiple sessions in one process. A prior session's shutdown
|
||||
// aborts the shared module poll-abort controller; install a fresh one so
|
||||
// subagents spawned in this session aren't watched against a dead signal.
|
||||
// See https://github.com/HazAT/pi-interactive-subagents/issues/5
|
||||
const prevAbort = (globalThis as any)[POLL_ABORT_KEY] as AbortController | undefined;
|
||||
if (!prevAbort || prevAbort.signal.aborted) {
|
||||
(globalThis as any)[POLL_ABORT_KEY] = new AbortController();
|
||||
}
|
||||
});
|
||||
|
||||
// Clean up on session shutdown
|
||||
|
||||
+2
-10
@@ -1076,8 +1076,8 @@ describe("subagent discovery", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("bundled scout/researcher resolve as non-interactive; worker resolves as interactive", () => {
|
||||
for (const name of ["scout", "researcher"]) {
|
||||
it("bundled scout/researcher/worker all resolve as non-interactive (auto-exit)", () => {
|
||||
for (const name of ["scout", "researcher", "worker"]) {
|
||||
const defs = testApi.loadAgentDefaults(name);
|
||||
assert.ok(defs, `expected bundled agent ${name} to be discoverable`);
|
||||
assert.equal(
|
||||
@@ -1086,14 +1086,6 @@ describe("subagent discovery", () => {
|
||||
`${name} should resolve as non-interactive (autonomous, auto-exit)`,
|
||||
);
|
||||
}
|
||||
|
||||
const worker = testApi.loadAgentDefaults("worker");
|
||||
assert.ok(worker, "expected bundled worker to be discoverable");
|
||||
assert.equal(
|
||||
testApi.resolveEffectiveInteractive({ name: "worker", task: "" }, worker),
|
||||
true,
|
||||
"worker should resolve as interactive (no auto-exit)",
|
||||
);
|
||||
});
|
||||
|
||||
it("worker is granted the spawning toolset restricted to scout and researcher", () => {
|
||||
|
||||
Reference in New Issue
Block a user