fix(team): clear permission state after approval
This commit is contained in:
parent
80beb3c877
commit
15f7219997
2 changed files with 34 additions and 0 deletions
|
|
@ -536,6 +536,14 @@ export class RuntimePermissionAnswerService {
|
|||
.map((pendingRecord) => pendingRecord.appRequestId);
|
||||
await this.launchStateStore.updateMember(record.teamName, record.memberName, (member) => ({
|
||||
...member,
|
||||
launchState:
|
||||
remainingMemberPendingIds.length > 0
|
||||
? 'runtime_pending_permission'
|
||||
: member.launchState === 'confirmed_alive'
|
||||
? member.launchState
|
||||
: member.bootstrapConfirmed
|
||||
? 'confirmed_alive'
|
||||
: 'runtime_pending_bootstrap',
|
||||
pendingPermissionRequestIds: remainingMemberPendingIds,
|
||||
lastRuntimeEventAt: answeredAt,
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -203,6 +203,32 @@ describe('RuntimePermissionRequestStore and services', () => {
|
|||
answerOrigin: 'provider_side_effect_projection',
|
||||
});
|
||||
expect(launchState.members.get('alice')).toMatchObject({
|
||||
launchState: 'runtime_pending_bootstrap',
|
||||
pendingPermissionRequestIds: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps confirmed_alive after answering the last pending permission', async () => {
|
||||
await store.upsertPending(permissionRecord());
|
||||
launchState.members.set('alice', {
|
||||
launchState: 'confirmed_alive',
|
||||
bootstrapConfirmed: true,
|
||||
pendingPermissionRequestIds: ['opencode:run-1:perm_1'],
|
||||
});
|
||||
|
||||
await expect(
|
||||
answerService().answer({
|
||||
appRequestId: 'opencode:run-1:perm_1',
|
||||
runId: 'run-1',
|
||||
decision: 'once',
|
||||
})
|
||||
).resolves.toMatchObject({
|
||||
ok: true,
|
||||
diagnostics: [],
|
||||
});
|
||||
|
||||
expect(launchState.members.get('alice')).toMatchObject({
|
||||
launchState: 'confirmed_alive',
|
||||
pendingPermissionRequestIds: [],
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue