fix(team): skip stale permission_request messages from previous runs
Inbox files persist across team runs. Permission_request messages from a previous run (e.g. when team was launched without auto-approve) were being reprocessed on the next launch, showing false ToolApprovalSheet popups even when the new run has bypassPermissions enabled. Filter by timestamp: skip permission_request messages older than run.startedAt.
This commit is contained in:
parent
098aa234b2
commit
1c5ba3041c
1 changed files with 10 additions and 0 deletions
|
|
@ -4087,10 +4087,20 @@ export class TeamProvisioningService {
|
|||
try {
|
||||
const leadInboxMessages = await this.inboxReader.getMessagesFor(teamName, leadName);
|
||||
const permMsgsToMarkRead: { messageId: string }[] = [];
|
||||
const runStartedAtMs = Date.parse(run.startedAt);
|
||||
for (const msg of leadInboxMessages) {
|
||||
if (typeof msg.text !== 'string') continue;
|
||||
const perm = parsePermissionRequest(msg.text);
|
||||
if (!perm) continue;
|
||||
// Skip permission_requests from previous runs — they're stale
|
||||
const msgTs = Date.parse(msg.timestamp);
|
||||
if (
|
||||
Number.isFinite(msgTs) &&
|
||||
Number.isFinite(runStartedAtMs) &&
|
||||
msgTs < runStartedAtMs
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
// Dedup is handled inside handleTeammatePermissionRequest via processedPermissionRequestIds
|
||||
this.handleTeammatePermissionRequest(run, perm, msg.timestamp);
|
||||
// Mark unread permission_request messages as read to prevent stale unread indicators
|
||||
|
|
|
|||
Loading…
Reference in a new issue