Skip to content

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

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

Add managedSettings.clearCache RPC bindings (force-clear managed settings cache)#2438
joshspicer wants to merge 19 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 merged by github/copilot-agent-runtime#17809 in commit 16fa21d3550c887466421791fb4466d0665b55f6.

  • 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 Copilot CLI 1.0.83-3 schema. The merged runtime schema also contains unrelated post-1.0.83-3 APIs whose generated nullable semantics need separate cross-SDK work, so this PR applies only the merged managedSettings.clearCache schema node to the pinned baseline.

Java's clearCache() wrapper was regenerated from that isolated schema and passed full mvn verify, but the Java codegen workflow correctly removed it again because CI regenerates from the published 1.0.83-3 package. Once a post-merge CLI release is published and pinned, standard regeneration will persist the Java wrapper and reproduce the other bindings.

The PR remains 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 passes with the locally regenerated clearCache() wrapper before CI normalizes generated output back to the 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
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
joshspicer and others added 2 commits September 3, 2026 09:02
Generate the missing Java RPC wrapper from the merged runtime schema while retaining the pinned CLI schema baseline for unrelated APIs.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Auto-committed by java-codegen-check workflow.
@SteveSandersonMS
SteveSandersonMS marked this pull request as draft September 3, 2026 17:30
@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Thanks for getting ahead of this — the clearCache capability itself looks like a legitimate, well-scoped addition once it ships.

I verified that the currently pinned CLI (1.0.83-3) schema does not contain managedSettings.clearCache at all, so running scripts/codegen today deletes the checked-in wrapper you added rather than reproducing it — that's also why CI keeps stripping the Java version. Committing hand-patched "generated" files for 5 of 6 languages ahead of the real schema isn't something we want to carry, since it can't be regenerated or verified against the actual runtime contract yet.

I'm moving this to draft for tracking. To get this merged, please:

  1. Wait for a CLI release that actually ships managedSettings.clearCache in its published schema, and pin that version across all SDKs.
  2. Run the standard codegen for all six languages (including Java) from that release, so bindings are reproducible rather than hand-inserted.
  3. Add a real end-to-end test in each language's e2e suite that exercises the actual behavior against the real runtime — create a session, call clearCache, and verify the on-disk cache is removed and a subsequent session resolution re-fetches policy rather than serving a stale value. Serialization-only or mocked-RPC tests aren't sufficient here since the whole point of this method is genuine runtime side effects.

Once the runtime capability has landed and the e2e tests pass against it, this is mergeable. Please mark the PR ready for review at that point.

joshspicer and others added 2 commits September 3, 2026 10:33
- Updated the Node.js CLI release pin
- Re-ran code generators
- Formatted generated code
@joshspicer

Copy link
Copy Markdown
Contributor Author

@copilot bump to the latest (at least 1.0.83-4 is out, maybe newer by the time you pick this up)

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@copilot bump to the latest (at least 1.0.83-4 is out, maybe newer by the time you pick this up)

Updated the CLI pin to published 1.0.83-4 and regenerated all six SDKs from its schema in commit 9bfebad.

joshspicer and others added 2 commits September 3, 2026 11:18
Exercise the released managedSettings.clearCache RPC in all six SDKs and adapt handwritten callers to the regenerated 1.0.83-4 types. Preserve explicit nulls for required nullable Java and .NET RPC fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…che' into agents/update-pr-runtime-clean

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The in-process host does not expose managedSettings.clearCache, and invoking this process-global invalidation inside shared in-process suites can disturb unrelated tests. Keep the replay-backed coverage on the default transport for each SDK.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ime-clean

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Thanks for the contribution. Since the runtime managedSettings.clearCache capability is not available in a shipped schema yet, we should keep this PR in draft for now.

For tracking, I've moved this to draft - please mark as ready to review when appropriate.

When it's ready to come back, we don't need a PR that only contains regenerated codegen output. What would be useful is adding E2E tests that exercise clearCache behavior.

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
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.

4 participants