Skip to content

Commit 781a278

Browse files
refactor(provider-muse): simplify child approval visibility handling
1 parent d17155d commit 781a278

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

‎packages/provider-muse/src/server/adapter.ts‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ interface PendingRequest {
229229
node: OrchestrationV2ExecutionNode;
230230
item: OrchestrationV2TurnItem;
231231
response?: Pick<OrchestrationV2RuntimeRequest, "decision" | "answers">;
232-
/** False while T3 approves a workflow child's request for the user. */
233232
shown: boolean;
234233
}
235234

@@ -1215,16 +1214,13 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* (
12151214
required: true,
12161215
})),
12171216
};
1218-
// Muse does not give workflow children the session's allowAll mode, so in full
1219-
// access T3 approves for them without showing the request. If Muse rejects that,
1220-
// the request is shown and waits for the user.
1217+
// Muse does not propagate allowAll to workflow children; T3 answers for them.
12211218
const autoApprove = child && input.runtimePolicy.runtimeMode === "full-access";
12221219
const entry: PendingRequest = {
12231220
native,
12241221
request: runtimeRequest,
12251222
node,
12261223
item,
1227-
// A request the user already sees stays visible when Muse updates it.
12281224
shown: !autoApprove || previous?.shown === true,
12291225
};
12301226
pending.set(requestId, entry);
@@ -1233,13 +1229,11 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* (
12331229
yield* decideApproval(entry, "accept").pipe(
12341230
Effect.catch(() =>
12351231
Effect.gen(function* () {
1236-
// Muse may have settled or replaced the request while T3 waited, or the
1237-
// session may be closing. Nothing is left to show then.
1232+
// Native updates may settle or replace this entry while the RPC is in flight.
12381233
if (!closed && !broken && pending.get(requestId) === entry)
12391234
yield* showRequest(entry);
12401235
}).pipe(eventPermit.withPermits(1)),
12411236
),
1242-
Effect.ignore,
12431237
Effect.forkIn(scope),
12441238
);
12451239
});
@@ -1287,8 +1281,6 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* (
12871281
if (!entry.response && native) entry.response = { decision: native };
12881282
yield* resolvePending(entry, "resolved");
12891283
}
1290-
// A request T3 is still approving for the user is hidden and does not keep
1291-
// the session waiting.
12921284
if (![...pending.values()].some((candidate) => candidate.shown))
12931285
yield* updateSession(active ? "running" : "ready");
12941286
}

0 commit comments

Comments
 (0)