feat(tui): allow backgrounding synchronous subagents (#30488)

This commit is contained in:
Kit Langton
2026-06-04 23:40:52 -04:00
committed by GitHub
parent 8c0edca175
commit 3003867c25
26 changed files with 527 additions and 35 deletions
@@ -568,6 +568,17 @@ const scenarios: Scenario[] = [
.get("/experimental/session", "experimental.session.list")
.at((ctx) => ({ path: "/experimental/session?roots=false&archived=false", headers: ctx.headers() }))
.json(200, array),
http.protected
.post("/experimental/session/{sessionID}/background", "experimental.session.background")
.mutating()
.seeded((ctx) => ctx.session({ title: "Background route owner" }))
.at((ctx) => ({
path: route("/experimental/session/{sessionID}/background", { sessionID: ctx.state.id }),
headers: ctx.headers(),
}))
.json(200, (body) => {
check(body === false, "background route should be a no-op without running subagents")
}),
http.protected.get("/experimental/resource", "experimental.resource.list").json(),
http.protected
.post("/sync/history", "sync.history.list")
@@ -90,4 +90,23 @@ describe("session action routes", () => {
}),
{ git: true },
)
it.instance(
"experimental background route is a no-op without synchronous subagents",
() =>
Effect.gen(function* () {
const test = yield* TestInstance
const session = yield* Effect.acquireRelease(SessionNs.use.create({}), (created) =>
SessionNs.use.remove(created.id).pipe(Effect.ignore),
)
const res = yield* requestInDirectory(`/experimental/session/${session.id}/background`, test.directory, {
method: "POST",
})
expect(res.status).toBe(200)
expect(yield* res.json).toBe(false)
}),
{ git: true },
)
})
@@ -41,6 +41,11 @@ describe("getWorkspaceRouteSessionID", () => {
expect(getWorkspaceRouteSessionID(url)).toBe(SessionID.make("ses_xyz"))
})
test("extracts session ID from experimental background path", () => {
const url = new URL("http://localhost/experimental/session/ses_bg/background")
expect(getWorkspaceRouteSessionID(url)).toBe(SessionID.make("ses_bg"))
})
test("returns null for /session/status", () => {
const url = new URL("http://localhost/session/status")
expect(getWorkspaceRouteSessionID(url)).toBeNull()