feat(gateway): grant scopes by verified identity (#121531)

* feat(gateway): grant scopes by verified identity

* chore(plugin-sdk): refresh API baseline

* test(agents): isolate transcript repair mocks
This commit is contained in:
Peter Steinberger
2026-08-10 03:19:45 -07:00
committed by GitHub
parent e97c3450a2
commit c6edd3e80f
17 changed files with 660 additions and 137 deletions
@@ -247,6 +247,15 @@ beforeAll(async () => {
beforeEach(async () => {
vi.clearAllMocks();
state.runAgentAttemptMock.mockReset();
state.loadManifestModelCatalogMock.mockReset();
state.normalizeProviderModelIdWithRuntimeMock.mockReset();
state.runCliTurnCompactionLifecycleMock.mockReset();
state.deliverAgentCommandResultMock.mockReset();
state.emitAgentEventMock.mockReset();
state.persistCliTurnTranscriptMock.mockReset();
state.appendExactAssistantMessageMock.mockReset();
state.persistSessionEntryMock.mockReset();
state.loadManifestModelCatalogMock.mockReturnValue([]);
state.normalizeProviderModelIdWithRuntimeMock.mockImplementation(() => undefined);
state.runCliTurnCompactionLifecycleMock.mockImplementation(
@@ -474,11 +483,24 @@ describe("assistant transcript repair", () => {
);
await agentCommand({ message: "user one", sessionId, sessionKey, cwd: state.workspaceDir });
state.persistSessionEntryMock.mockRejectedValueOnce(new Error("simulated cleanup failure"));
let cleanupFailureInjected = false;
state.persistSessionEntryMock.mockImplementation(async (...args) => {
const [params] = args;
if (
!cleanupFailureInjected &&
params.initialEntry.pendingTranscriptRepair?.length &&
params.entry.pendingTranscriptRepair === undefined
) {
cleanupFailureInjected = true;
throw new Error("simulated cleanup failure");
}
return state.persistSessionEntryReal?.(...args);
});
state.runAgentAttemptMock.mockResolvedValueOnce(
makeResult({ sessionId, text: "assistant two", runner: "cli" }),
);
await agentCommand({ message: "user two", sessionId, sessionKey, cwd: state.workspaceDir });
expect(cleanupFailureInjected).toBe(true);
expect(findStoredSessionEntry(sessionKey)?.pendingTranscriptRepair).toHaveLength(1);
state.runAgentAttemptMock.mockResolvedValueOnce(