You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/23 11:23:09 UTC
(maka) branch main updated: fix(storage): clear obsolete onboarding intent (#3571)
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/main by this push:
new fe0ed2269 fix(storage): clear obsolete onboarding intent (#3571)
fe0ed2269 is described below
commit fe0ed2269dd43c8ca7d48b2d87f2cfff63df0b38
Author: mikemikimike <13...@163.com>
AuthorDate: Sun Aug 23 19:23:04 2026 +0800
fix(storage): clear obsolete onboarding intent (#3571)
* fix(storage): clear obsolete onboarding intent
Generated-by: Codex
* test(storage): verify stale onboarding cleanup persists
Generated-by: Codex
---
.../src/__tests__/runtime-policy-stores.test.ts | 54 ++++++++++++++++++++++
packages/storage/src/runtime-policy/coordinator.ts | 13 ++++++
2 files changed, 67 insertions(+)
diff --git a/packages/storage/src/__tests__/runtime-policy-stores.test.ts b/packages/storage/src/__tests__/runtime-policy-stores.test.ts
index b643c36fa..2cc00c131 100644
--- a/packages/storage/src/__tests__/runtime-policy-stores.test.ts
+++ b/packages/storage/src/__tests__/runtime-policy-stores.test.ts
@@ -3332,6 +3332,60 @@ describe('runtime policy stores', () => {
});
});
+ test('clears a stale onboarding intent when its connection id conflicts with the catalog', async () => {
+ await withInteractiveRoot(async ({ root, capability }) => {
+ const owner = await tryAcquireInteractiveRootOwner(capability);
+ assert.ok(owner);
+ if (!owner) return;
+ try {
+ const stores = await openInteractiveRuntimePolicyStoresForWrite(owner.lease);
+ const connection = await createConnection(
+ stores,
+ 0,
+ connectionDraft('openai', 'openai', 'Stale onboarding'),
+ );
+ await writeFile(
+ join(root, 'runtime-policy-onboarding.json'),
+ `${JSON.stringify({
+ schemaVersion: 1,
+ connectionId: '11111111-1111-4111-8111-111111111111',
+ providerType: connection.providerType,
+ suppliedSecret: null,
+ enabledModelIds: connection.enabledModelIds,
+ discovery: {
+ models: [{ id: 'gpt-5' }],
+ source: 'fetched',
+ fetchedAt: 1_800_000_000_000,
+ },
+ invalidateLastTest: false,
+ })}\n`,
+ );
+ } finally {
+ await owner.close();
+ }
+
+ const successor = await tryAcquireInteractiveRootOwner(capability);
+ assert.ok(successor);
+ if (!successor) return;
+ try {
+ await openInteractiveRuntimePolicyStoresForWrite(successor.lease);
+ assert.equal(existsSync(join(root, 'runtime-policy-onboarding.json')), false);
+ } finally {
+ await successor.close();
+ }
+
+ const reopened = await tryAcquireInteractiveRootOwner(capability);
+ assert.ok(reopened);
+ if (!reopened) return;
+ try {
+ await openInteractiveRuntimePolicyStoresForWrite(reopened.lease);
+ assert.equal(existsSync(join(root, 'runtime-policy-onboarding.json')), false);
+ } finally {
+ await reopened.close();
+ }
+ });
+ });
+
test('interactive OAuth login commits only against its frozen connection and credential basis', async () => {
await withInteractiveOwner(async ({ root, stores }) => {
const claude = await createConnection(
diff --git a/packages/storage/src/runtime-policy/coordinator.ts b/packages/storage/src/runtime-policy/coordinator.ts
index e3b541c73..f0be29e37 100644
--- a/packages/storage/src/runtime-policy/coordinator.ts
+++ b/packages/storage/src/runtime-policy/coordinator.ts
@@ -1326,6 +1326,11 @@ export class RuntimePolicyCoordinator {
await clearConnectionOnboardingIntent(root);
this.onboardingRecoveryRequired = false;
} catch (error) {
+ if (isObsoleteConnectionOnboardingIntent(error)) {
+ await clearConnectionOnboardingIntent(root);
+ this.onboardingRecoveryRequired = false;
+ return;
+ }
if (isCommitOutcomeUnknown(error)) throw error;
throw commitOutcomeUnknown('Connection onboarding recovery did not converge', error);
}
@@ -1391,6 +1396,14 @@ function isCommitOutcomeUnknown(error: unknown): error is RuntimePolicyStoreErro
return error instanceof RuntimePolicyStoreError && error.code === 'commit_outcome_unknown';
}
+function isObsoleteConnectionOnboardingIntent(error: unknown): boolean {
+ return (
+ error instanceof RuntimePolicyStoreError &&
+ error.code === 'invalid_document' &&
+ error.message === 'Onboarding intent conflicts with the connection id'
+ );
+}
+
function commonSemanticConnectionBasis(
prepared: PreparedConnectionMaterial,
): CommonSemanticConnectionBasis {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org