fix: use Muse transaction owners for feature checks

Read current feature flags through the existing transaction in public signal and mailbox admission. This preserves authorization while avoiding a nested acquisition from an already-held single-connection pool.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-11-10 14:58:24 -06:00
1 parent a84fed5ca6
commit 61663c0059
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -434,7 +434,7 @@ function createMuseBroker(db:Db, publicOrigin?:string) {
const [current]=await tx.select().from(bindings).where(and(eq(bindings.id,b.id),eq(bindings.generation,b.generation),isNull(bindings.revokedAt))).for("update");if(!current)throw forbidden("Binding changed.");
await assertMuseSubjectCredential(tx,s,s.credentialSource==="oauth"?connectionResource():undefined);
await assertMuseCurrentAuthority(tx,current,true,true);
const disabled=!await identity.enabled();
const disabled=!await identity.enabled(tx);
if(disabled)await assertMuseDisabledStopControlCredential(tx,s,s.credentialSource==="oauth"?connectionResource():undefined);
const boundaries=tx.select({boundary:holds.stopBoundary}).from(holds).where(inArray(holds.id,museStopControlBoundaryIds(tx,current)));
const rows=await tx.select().from(mailbox).where(and(eq(mailbox.bindingId,b.id),eq(mailbox.bindingGeneration,b.generation),gt(mailbox.id,q.after),
+1 -1
View File
@@ -96,7 +96,7 @@ function createReceiver(db:Db) {
contacted = current;
// Pausing suppresses ordinary work, while the worker still needs its
// exact stop boundary to quiesce and report through authenticated control.
const disabled=!await museIdentity(db).enabled();
const disabled=!await museIdentity(db).enabled(tx);
if(disabled&&!await hasMuseStopControlAccess(tx,current))return idle;
const stopOnly = disabled || (agent.status === "paused" && !canConfigureAgentConnection(agent));
const boundaries=tx.select({boundary:holds.stopBoundary}).from(holds).where(inArray(holds.id,museStopControlBoundaryIds(tx,current)));