Skip to content

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

Open
joshspicer wants to merge 8 commits into
mainfrom
agents/managed-settings-clear-cache
Open

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

Conversation

@joshspicer

@joshspicer joshspicer commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

Adds the new managedSettings.clearCache server RPC method to the generated TypeScript, C#, Python, Go, and Rust clients.

managedSettings.clearCache force-refreshes enterprise managed settings for every account by:

  • wiping the persistent server-policy cache (the whole <cacheHome>/managed-settings directory), and
  • dropping the runtime process's in-memory retained server policy.

The method does not fetch policy itself. The next session resolution for an account re-fetches that account's org policy from the network. managedSettings.read only returns device/MDM settings and does not trigger an account server-policy fetch, so a host implementing "sync account policy" should start a fresh session resolution rather than treat a subsequent managedSettings.read call as refreshed org policy.

This is the primitive behind a host "force refresh account policy" action, such as wiring VS Code's Developer: Sync Account Policy command to clear managed policy on demand.

Consumers call it through the generated RPC wrapper, for example:

await client.rpc.managedSettings.clearCache();

Equivalent methods are ClearCacheAsync() in C#, clear_cache() in Python and Rust, and ClearCache(ctx) in Go.

Generation

The bindings were regenerated from the authoritative runtime API schema at github/copilot-agent-runtime#17809 head 7ab07b119ba0fe42fe427836dfb2bcd936819082.

  • TypeScript, C#, Python, Go, and Rust were generated with scripts/codegen.
  • Rust was formatted with the repository's pinned nightly toolchain.

The generated output now matches the runtime contract's current behavior and documentation, including rejection when the on-disk cache cannot be removed.

Dependency ordering

The checked-in bindings are intentionally ahead of the currently pinned @github/copilot package. Once the runtime schema is published and the SDK dependency is bumped, a standard regeneration will reproduce these bindings and generate Java's clearCache() wrapper. Until then, the Java codegen workflow correctly normalizes Java back to the published schema, so the Java binding is not included in this draft.

The PR remains draft/blocked until that package update is available.

Testing

  • Node.js: format, lint, and typecheck pass; codegen/runtime-artifact unit tests pass (31 tests).
  • Python: Ruff and ty pass; generated RPC/timeout/JSON-RPC unit tests pass (32 tests).
  • Go: non-E2E packages pass, including go/rpc.
  • .NET: formatting verification and SDK build pass for netstandard2.0, net8.0, and net10.0.
  • Rust: pinned-nightly formatting, Clippy, and library tests pass (234 tests).
  • Java: full mvn verify and a clean follow-up SDK verification pass against the currently published schema. The locally generated clearCache() wrapper also compiled successfully before CI normalized it back to that published schema.

Full cross-language E2E suites were also exercised. Remaining failures were unrelated environment/runtime-harness issues (replay misses/timeouts, unavailable local .NET 8 testhost, and tests requiring a runnable/authenticated CLI), not generated binding failures.

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

This comment has been minimized.

@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 ·

joshspicer and others added 2 commits September 1, 2026 15:55
@joshspicer
joshspicer marked this pull request as ready for review September 1, 2026 23:05
@joshspicer
joshspicer requested a review from a team as a code owner September 1, 2026 23:05
Auto-committed by java-codegen-check workflow.
Copilot AI balanced review requested due to automatic review settings September 1, 2026 23:05
@joshspicer
joshspicer marked this pull request as draft September 1, 2026 23:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The checked-in schema cannot reproduce the generated outputs, and the promised Java binding is missing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: None

What changed in this PR

Adds generated managedSettings.clearCache RPC bindings for force-refreshing enterprise policy caches.

Changes:

  • Adds wrappers for TypeScript, C#, Python, Go, and Rust.
  • Adds Rust and Go result/method definitions.
File Description
rust/​src/​generated/​rpc.rs Adds clear_cache().
rust/​src/​generated/​api_types.rs Adds the RPC method constant.
python/​copilot/​generated/​rpc.py Adds clear_cache().
nodejs/​src/​generated/​rpc.ts Adds clearCache().
go/​rpc/​zrpc.go Adds result type and ClearCache().
dotnet/​src/​Generated/​Rpc.cs Adds ClearCacheAsync().

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

joshspicer and others added 3 commits September 2, 2026 11:36
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Auto-committed by java-codegen-check workflow.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review

This PR adds a new generated RPC method managedSettings.clearCache and wires it into .NET, Go, Node.js, Python, and Rust:

  • .NET: ServerManagedSettingsApi.ClearCacheAsync()
  • Go: ServerManagedSettingsAPI.ClearCache()
  • Node.js: managedSettings.clearCache
  • Python: ServerManagedSettingsApi.clear_cache()
  • Rust: ClientRpcManagedSettings::clear_cache()

All five implementations are consistent: same wire method name (managedSettings.clearCache), no parameters, empty/void result, and equivalent doc comments/experimental annotations, following each language's naming convention (PascalCase, camelCase, snake_case as appropriate).

Gap found — Java: java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerManagedSettingsApi.java currently only exposes read() (mirroring managedSettings.read) and was not updated in this PR to add the clearCache() equivalent. Since this is generated code (per scripts/codegen/java.ts), this is most likely just a codegen/regeneration timing gap rather than an intentional omission — worth regenerating the Java SDK bindings (cd java && mvn generate-sources -Pcodegen) so ServerManagedSettingsApi picks up a clearCache() method for parity with the other five SDKs before merge (or in a fast-follow PR).

No other consistency issues found — this is a clean, generated, cross-language addition.

Generated by SDK Consistency Review Agent for #2438 · sonnet50 20 AIC · ⌖ 6.4 AIC · ⊞ 8.8K ·

@joshspicer
joshspicer marked this pull request as ready for review September 3, 2026 15:48
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.

3 participants