fix(team): intercept permission_request in native stdout delivery path

relayLeadInboxMessages only runs after provisioningComplete, but
teammate permission_request messages arrive during bootstrap (before
provisioning finishes). Claude Code delivers them natively via stdout
type:"user" messages, bypassing the relay entirely.

Add permission_request interception in handleNativeTeammateUserMessage
which processes stdout user messages at all times, including during
provisioning. This ensures ToolApprovalSheet appears immediately when
teammates need tool permission.
This commit is contained in:
iliya 2026-03-27 18:44:58 +02:00
parent 8ea470b1ae
commit ed1726c298

View file

@ -1749,6 +1749,17 @@ export class TeamProvisioningService {
const blocks = parseAllTeammateMessages(rawText);
if (blocks.length === 0) return;
// Intercept teammate permission_request messages delivered natively via stdout.
// This runs even during provisioning (unlike relayLeadInboxMessages which waits
// for provisioningComplete). The lead already received the message — we can't
// prevent that — but we create a ToolApprovalRequest so the user sees the dialog.
for (const block of blocks) {
const perm = parsePermissionRequest(block.content);
if (perm) {
this.handleTeammatePermissionRequest(run, perm, new Date().toISOString());
}
}
const crossTeamBlocks = blocks.flatMap((block) => {
const origin = parseCrossTeamPrefix(block.content);
const sourceTeam = origin?.from.includes('.') ? origin.from.split('.', 1)[0] : null;