Skip to content

Add managedSettings.clearCache RPC bindings (force-clear managed settings cache) - #2438

Draft
joshspicer wants to merge 2 commits into
mainfrom
agents/managed-settings-clear-cache
Draft

Add managedSettings.clearCache RPC bindings (force-clear managed settings cache)#2438
joshspicer wants to merge 2 commits into
mainfrom
agents/managed-settings-clear-cache

Conversation

@joshspicer

Copy link
Copy Markdown
Contributor

What

Adds the new managedSettings.clearCache server RPC method to the generated language clients (TypeScript, C#, Python, Go, Rust, Java).

managedSettings.clearCache force-clears the enterprise managed-settings cache everywhere: it wipes the persistent on-disk cache for every account (the whole <cacheHome>/managed-settings directory) and drops the runtime process's in-memory retained server policy, so the next managed-settings read for any account re-fetches from the network instead of serving a cached response.

It is the primitive behind a host "force refresh account policy" action — the motivating use case is wiring it into VS Code's Developer: Sync Account Policy command so managed policy can be cleared everywhere on demand.

Consumers call it via the autogenerated RPC wrapper, e.g. in Node.js:

await client.rpc.managedSettings.clearCache();

…and the equivalent ClearCacheAsync() (C#), clear_cache() (Python/Rust), ClearCache(ctx) (Go), clearCache() (Java).

How these files were generated

These are purely generated files, produced by the repo's standard codegen pipelines:

  • cd nodejs && npm ci + cd scripts/codegen && npm ci && npm run generate (TS, C#, Python, Go, Rust), then cd rust && cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml
  • cd java/scripts/codegen && npm ci && npx tsx java.ts (Java)

To isolate just this method, I ran the pipeline against the current pinned @github/copilot schema baseline with only the managedSettings.clearCache node added, after first confirming a pristine regen reproduces the committed files with zero diff. So the diff here is exactly the clearCache bindings and nothing else — matching what a post-publish regen will produce.

Dependency / ordering

The runtime side (the schema + server implementation) lives in github/copilot-agent-runtime (companion PR: github/copilot-agent-runtime#17809). This SDK PR is intentionally ahead of the published @github/copilot package:

  • ⚠️ codegen-check CI will fail here until the @github/copilot dependency is bumped to a version that exposes managedSettings.clearCache (the pinned 1.0.82-0 baseline does not have it yet). Once the runtime change ships and the dependency is bumped, npm run generate reproduces these exact files and the check goes green.

Kept as a draft until the runtime change is released.

Testing

  • nodejs: npm run typecheck passes with the regenerated rpc.ts.
  • Verified the generated output format matches the existing null-result server methods (mcp.config.reload, runtime.shutdown), which use the same {"type":"null"} result shape.

joshspicer and others added 2 commits August 28, 2026 19:55
Adds the `managedSettings.clearCache` server RPC method across all generated
language clients (TypeScript, C#, Python, Go, Rust, Java).

`managedSettings.clearCache` wipes the persistent enterprise managed-settings
cache for every account and drops the runtime process's in-memory retained
server policy, so the next managed-settings read re-fetches from the network.
It is the primitive behind a host "force refresh account policy" action (e.g.
VS Code's `Developer: Sync Account Policy`).

Consumers call it via the autogenerated RPC wrapper, e.g. in Node.js:

    await client.rpc.managedSettings.clearCache();

These files were produced by the standard codegen pipeline
(`scripts/codegen` + `java/scripts/codegen`) run against the current pinned
`@github/copilot` schema baseline with the new method added, so they match
what a post-publish regen will produce. The runtime side lives in
github/copilot-agent-runtime; once that ships and the `@github/copilot`
dependency is bumped to a version exposing `managedSettings.clearCache`,
`codegen-check` reproduces these files exactly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Auto-committed by java-codegen-check workflow.
@github-actions github-actions Bot added the dependencies Pull requests that update a dependency file label Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Cross-SDK Consistency Review

This PR adds managedSettings.clearCache bindings to five of the six SDK languages. Based on the PR diff, the following SDKs have been updated:

SDK Status Method name
Node.js/TypeScript ✅ Added clearCache()
Python ✅ Added clear_cache()
Go ✅ Added ClearCache(ctx)
.NET ✅ Added ClearCacheAsync()
Rust ✅ Added clear_cache()
Java Missing clearCache()

⚠️ Java implementation missing

The PR description mentions Java (clearCache()) as an intended target and describes running cd java/scripts/codegen && npm ci && npx tsx java.ts. However, no Java files are present in the PR diff, and the current generated file java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerManagedSettingsApi.java only contains the read() method — clearCache() is absent.

The Java ServerManagedSettingsApi should be updated to add:

/**
 * Wipes the persistent enterprise managed-settings cache for every account...
 *
 * `@apiNote` This method is experimental and may change in a future version.
 * `@since` 1.0.0
 */
`@CopilotExperimental`
public CompletableFuture<Void> clearCache() {
    return caller.invoke("managedSettings.clearCache", java.util.Map.of(), Void.class);
}

This can be regenerated by running cd java/scripts/codegen && npm ci && npx tsx java.ts as described in the PR.


All other naming conventions are consistent with language idioms (camelCase for TS/Java, snake_case for Python/Rust, PascalCase for Go/.NET).

Generated by SDK Consistency Review Agent for #2438 · sonnet46 24.3 AIC · ⌖ 5.51 AIC · ⊞ 6.6K ·

@github-actions

Copy link
Copy Markdown
Contributor

❌ Automated Fix Unable to Resolve Build Failure

The agentic fix workflow analyzed the failing mvn verify build on branch agents/managed-settings-clear-cache.

Root Cause

The build failure is not caused by code generation changes or handwritten SDK/test code. Instead, the failure is caused by an enforce-jdk25 rule in java/sdk/pom.xml:

[ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
[ERROR] JDK 25+ is required to build the Multi-Release JAR with the virtual-thread overlay.

The CI workflow (java-codegen-check.yml) runs mvn verify with JDK 17 (java-version: "17"), but java/sdk/pom.xml has an enforce-jdk25 execution that requires JDK 25+.

What Was Attempted

  • Inspected the branch commits: the enforcer rule is present since the initial commit
  • Confirmed the java-codegen-check.yml workflow uses java-version: "17" for Maven builds
  • The JDK version mismatch causes mvn verify to fail before any compilation or tests run

Why Manual Intervention Is Needed

The fix requires one of:

  1. Update java/sdk/pom.xml to remove or relax the enforce-jdk25 enforcer rule (e.g., make it conditional on a profile), OR
  2. Update .github/workflows/java-codegen-check.yml to use JDK 25 for the mvn verify step

Both of these files are outside the scope of automated fixes in this workflow. A human maintainer needs to decide whether the JDK 25 requirement is intentional (and the workflow needs updating) or accidental (and the enforcer should be removed/relaxed).

The codegen-related changes in this PR (adding managedSettings.clearCache RPC bindings) appear correct and complete.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • repo.maven.apache.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "repo.maven.apache.org"

See Network Configuration for more information.

Generated by Java Codegen Agentic Fix · sonnet46 63.7 AIC · ⌖ 5.13 AIC · ⊞ 8.6K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant