mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 19:08:33 +01:00
fix(runtime): preserve sessions through empty connector setup
Keep unchanged skill preferences intact and normalize the empty connector digest. Accept exact prior default-shaped session hashes without exempting real configuration changes. Exercise actual connector preparation for legacy and native session compatibility. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
3e2bb16f5e
commit
bfa0ed6b60
3 files changed
+139
-11
No files matched your search
@@ -148,9 +148,8 @@ export async function applyConnectorSkills(
|
||||
connector.skillName,
|
||||
]),
|
||||
);
|
||||
const desired = readPaperclipSkillSyncPreference(
|
||||
config,
|
||||
).desiredSkillEntries.filter((entry) => !reserved.has(entry.key));
|
||||
const preference = readPaperclipSkillSyncPreference(config);
|
||||
const desired = preference.desiredSkillEntries.filter((entry) => !reserved.has(entry.key));
|
||||
const skills = entries.filter(
|
||||
(entry) => !reserved.has(entry.key) && !reserved.has(entry.runtimeName),
|
||||
);
|
||||
@@ -193,7 +192,11 @@ export async function applyConnectorSkills(
|
||||
.digest("hex")
|
||||
: null;
|
||||
return {
|
||||
...writePaperclipSkillSyncPreference(config, desired),
|
||||
// Empty connector preparation must not rewrite an existing agent's skill
|
||||
// preference: its original representation is part of the saved session.
|
||||
// Assignment changes and stripping unassigned reserved skills still apply.
|
||||
...(assignments.length === 0 && desired.length === preference.desiredSkillEntries.length
|
||||
? config : writePaperclipSkillSyncPreference(config, desired)),
|
||||
paperclipRuntimeSkills: skills,
|
||||
paperclipConnectorSkillDigest: connectorSkillDigest,
|
||||
};
|
||||
|
||||
@@ -6350,12 +6350,19 @@ function buildSessionConfigCategoryValues(input: {
|
||||
// boundary; the reusable row and its evolving generation are state.
|
||||
delete workspaceConfig.existingExecutionWorkspace;
|
||||
delete workspaceConfig.reusableExecutionWorkspaceConfig;
|
||||
const adapterConfig = { ...input.effectiveAdapterConfig };
|
||||
// Connector preparation adds a null digest even without assignments. That
|
||||
// generated absence is not a change to an older agent's execution contract.
|
||||
// Nonempty digests remain fingerprinted, including shared-home delivery.
|
||||
if (adapterConfig.paperclipConnectorSkillDigest == null) {
|
||||
delete adapterConfig.paperclipConnectorSkillDigest;
|
||||
}
|
||||
return {
|
||||
adapter: {
|
||||
adapterType: input.adapterType,
|
||||
agentConfigRevision: input.agentConfigRevision,
|
||||
},
|
||||
adapterConfig: input.effectiveAdapterConfig,
|
||||
adapterConfig,
|
||||
agentRuntimeConfig: input.agentRuntimeConfig,
|
||||
instructions: input.instructions,
|
||||
issueOverrides: input.issueOverrides,
|
||||
@@ -6433,12 +6440,24 @@ export async function buildEffectiveRunSessionConfigMetadata(input: {
|
||||
legacyWorkspaceVariants.push({ ...legacyWorkspace, issueSettings: null });
|
||||
}
|
||||
}
|
||||
const compatibleFingerprints = [...new Set(legacyWorkspaceVariants.map((workspaceConfig) =>
|
||||
createEffectiveRunConfigFingerprints({
|
||||
session: { ...categoryValues, workspaceConfig },
|
||||
secretManifest,
|
||||
}).sessionFingerprint.fingerprint,
|
||||
))];
|
||||
const adapterVariants = [categoryValues.adapterConfig];
|
||||
if (input.effectiveAdapterConfig.paperclipConnectorSkillDigest == null) {
|
||||
// The first connector-aware release always wrote these defaults. Accept
|
||||
// only that exact old representation of today's skill selection; never
|
||||
// excuse a changed assignment digest, credential, permission, or model.
|
||||
adapterVariants.push({
|
||||
...writePaperclipSkillSyncPreference(categoryValues.adapterConfig,
|
||||
readPaperclipSkillSyncPreference(categoryValues.adapterConfig).desiredSkillEntries),
|
||||
paperclipConnectorSkillDigest: null,
|
||||
});
|
||||
}
|
||||
const compatibleFingerprints = [...new Set(
|
||||
[categoryValues.workspaceConfig, ...legacyWorkspaceVariants].flatMap((workspaceConfig) =>
|
||||
adapterVariants.map((adapterConfig) => createEffectiveRunConfigFingerprints({
|
||||
session: { ...categoryValues, workspaceConfig, adapterConfig },
|
||||
secretManifest,
|
||||
}).sessionFingerprint.fingerprint)),
|
||||
)];
|
||||
return {
|
||||
version: EFFECTIVE_RUN_CONFIG_FINGERPRINT_VERSION,
|
||||
fingerprint: fingerprints.sessionFingerprint.fingerprint,
|
||||
|
||||
Reference in new issue
Block a user