-
Notifications
You must be signed in to change notification settings - Fork 0
[WRONG BRANCH] fix(sync): persist Claude Desktop ownership marker #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import { | |
| hasOwnProvider, | ||
| isValidProviderName, | ||
| multiAgentGuidanceEnabled, | ||
| mutatePersistedConfig, | ||
| providerBaseUrlConfigError, | ||
| providerHeadersConfigError, | ||
| saveConfigPreservingClaudeCode, | ||
|
|
@@ -175,9 +176,28 @@ async function syncEnabledClientIntegrations( | |
| config.claudeCode?.desktopProfile, | ||
| nativeContextLimits(config), | ||
| ); | ||
| out.push(r.written | ||
| ? { client: "claude-desktop", ok: true, changed: true } | ||
| : { client: "claude-desktop", ok: false, reason: r.reason ?? "Claude Desktop write failed" }); | ||
| if (!r.written || !r.fingerprint) { | ||
| out.push({ client: "claude-desktop", ok: false, reason: r.reason ?? "Claude Desktop write failed" }); | ||
| } else { | ||
| const { emptyDesktopProfile } = await import("../../claude/desktop-profile"); | ||
| const marked = mutatePersistedConfig(persisted => { | ||
| const profile = persisted.claudeCode?.desktopProfile | ||
| ?? config.claudeCode?.desktopProfile | ||
| ?? emptyDesktopProfile(); | ||
|
Comment on lines
+184
to
+186
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the operator removes Useful? React with 👍 / 👎. |
||
| persisted.claudeCode = { | ||
| ...(persisted.claudeCode ?? {}), | ||
| desktopProfile: { | ||
| ...profile, | ||
| appliedFingerprint: r.fingerprint, | ||
| appliedAt: new Date().toISOString(), | ||
| }, | ||
| }; | ||
| return { changed: true, value: true }; | ||
| }); | ||
| out.push(marked.status === "unavailable" | ||
| ? { client: "claude-desktop", ok: false, reason: `Claude Desktop applied marker was not saved (${marked.reason})` } | ||
| : { client: "claude-desktop", ok: true, changed: true }); | ||
| } | ||
| } catch (error) { | ||
| out.push({ client: "claude-desktop", ok: false, reason: error instanceof Error ? error.message : String(error) }); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,11 +51,12 @@ describe("ocx sync fans out to the client integrations that are switched on", () | |
| // One catch per client: a broken Grok file is a warning, not a 500 on a command whose | ||
| // main job (the Codex catalog) succeeded. | ||
| expect(fn.match(/catch \(error\)/g)?.length).toBe(2); | ||
| // The Desktop write gets the native context limits, same as every other Desktop | ||
| // call site. 8b672205e threaded `nativeContextLimits` through those writers and | ||
| // left this assertion naming the retired `providerContextCap` spelling, so the | ||
| // source-shape check failed against the very change it is meant to pin. | ||
| expect(fn).toContain("nativeContextLimits(config)"); | ||
| // Cleanup accepts only the fingerprint of the exact credential-bearing profile we wrote. | ||
| // Sync must durably advance that ownership marker rather than leaving the old value behind. | ||
| expect(fn).toContain("mutatePersistedConfig(persisted =>"); | ||
| expect(fn).toContain("appliedFingerprint: r.fingerprint"); | ||
| expect(fn.indexOf("writeDesktop3pConfig(")).toBeLessThan(fn.indexOf("appliedFingerprint: r.fingerprint")); | ||
|
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These assertions only prove that three strings occur in the function in the expected textual order; they remain green if the mutation is never committed, updates the wrong profile, or loses unrelated persisted fields. Exercise AGENTS.md reference: AGENTS.md:L276-L278 Useful? React with 👍 / 👎.
Comment on lines
+55
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Exercise the synchronization behavior instead of scanning source text. These assertions only search As per path instructions, behavior changes in 🤖 Prompt for AI AgentsSource: Path instructions |
||
| // A client that is off is omitted rather than reported: the caller has to be able to | ||
| // tell "left alone" from "tried and failed", so there is no skipped state to emit. | ||
| expect(fn).not.toContain('"skipped"'); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a fingerprint-specific failure reason.
When
r.writtenis true butr.fingerprintis absent andr.reasonis unset, this branch reports"Claude Desktop write failed"even though the Desktop file was written. This can mislead retry and cleanup decisions about the actual partial state. Split the conditions or provide a distinct reason for a missing fingerprint.Proposed fix
As per the PR objectives, the route must distinguish a successful Desktop write from a missing fingerprint.
📝 Committable suggestion
🤖 Prompt for AI Agents