fix(cli-run): avoid infinite wait on missing child status
Treat child sessions missing from session.status as transient so completion polling can proceed while still blocking on explicit non-idle descendants.
This commit is contained in:
@@ -143,7 +143,7 @@ describe("checkCompletionConditions", () => {
|
||||
expect(result).toBe(false)
|
||||
})
|
||||
|
||||
it("returns false when child status is missing", async () => {
|
||||
it("returns true when child status is missing but descendants are idle", async () => {
|
||||
// given
|
||||
spyOn(console, "log").mockImplementation(() => {})
|
||||
const ctx = createMockContext({
|
||||
@@ -158,6 +158,28 @@ describe("checkCompletionConditions", () => {
|
||||
// when
|
||||
const result = await checkCompletionConditions(ctx)
|
||||
|
||||
// then
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
it("returns false when descendant is busy even if parent status is missing", async () => {
|
||||
// given
|
||||
spyOn(console, "log").mockImplementation(() => {})
|
||||
const ctx = createMockContext({
|
||||
childrenBySession: {
|
||||
"test-session": [{ id: "child-1" }],
|
||||
"child-1": [{ id: "grandchild-1" }],
|
||||
"grandchild-1": [],
|
||||
},
|
||||
statuses: {
|
||||
"grandchild-1": { type: "busy" },
|
||||
},
|
||||
})
|
||||
const { checkCompletionConditions } = await import("./completion")
|
||||
|
||||
// when
|
||||
const result = await checkCompletionConditions(ctx)
|
||||
|
||||
// then
|
||||
expect(result).toBe(false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user