feat(tui): allow backgrounding synchronous subagents (#30488)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user