Skip to content

Add file path setup for mock policy server and improve state polling - #333272

Merged
joshspicer merged 1 commit into
mainfrom
agents/mock-policy-server-file-paths-setup
Aug 29, 2026
Merged

Add file path setup for mock policy server and improve state polling#333272
joshspicer merged 1 commit into
mainfrom
agents/mock-policy-server-file-paths-setup

Conversation

@joshspicer

Copy link
Copy Markdown
Member

This pull request introduces enhancements to the mock policy server, focusing on file path configuration and improving the responsiveness of the GUI to external state changes.

Changes made:

  • Documentation Updates:

    • Added instructions for setting file paths in the local testing documentation.
    • Updated the README for the mock policy server with new setup instructions.
  • Code Enhancements:

    • Implemented a new "Deploy as a file" section in the setup modal and policies page, allowing users to configure file-based settings.
    • Added a 2-second polling mechanism in app.ts to check for external state changes via the /api/state endpoint, ensuring the GUI reflects updates without requiring a page reload.
    • Safeguards were added to prevent clobbering user edits during polling and to ensure that the user's own saves are not reverted.

Validation:

  • The changes were type-checked and validated with a mock backend, confirming that external changes are now reflected in the editor and that user interactions remain intact.

Copilot AI balanced review requested due to automatic review settings August 28, 2026 22:13
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: d9b5c14f Current: e550f6b6

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/McpServersSearch/Light
Before After
before after

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

Review tier: Balanced
Findings: 4 Medium severity · 1 Low severity

New issues introduced by this change (5)
Severity Finding
Medium severity scripts/​mock-policy-server/​public/​app.ts — This accepts every syntactically valid JSON value, so arrays, primitives, and null get deploy…
Medium severity scripts/​mock-policy-server/​public/​app.tssudo tee only creates a root-owned regular file when the destination does not already exist. If…
Medium severity scripts/​mock-policy-server/​public/​app.ts — This “Go to” action only scrolls after closing the modal, leaving keyboard and screen-reader focus…
Low severity scripts/​mock-policy-server/​README.md — The generated Unix and PowerShell snippets are multiline here-doc/here-string commands, not…
Medium severity scripts/​mock-policy-server/​public/​app.tsapplyState calls renderTabs, which replaces every endpoint tab and toggle. If an external…
What changed in this PR

Adds file-based managed-settings deployment to the mock policy server and synchronizes external server-state changes into its GUI.

Changes:

  • Adds platform-specific deployment commands and setup UI.
  • Polls server state every two seconds.
  • Documents file-based policy testing.
File Description
scripts/​mock-policy-server/​README.md Documents file deployment.
scripts/​mock-policy-server/​public/​style.css Styles the new UI.
scripts/​mock-policy-server/​public/​index.html Adds setup and deployment controls.
scripts/​mock-policy-server/​public/​app.ts Generates commands and polls state.
.github/​skills/​policy-and-managed-settings/​local-testing.md Updates testing guidance.
Suppressed comments (2)

scripts/mock-policy-server/public/app.ts:690

  • The polling guard only treats focus or a pending/active save as an edit. An invalid JSON/status draft (or a draft whose save failed) has neither marker once the user blurs the field, so any external state change causes applyExternalState to overwrite that unsaved draft. Track dirty drafts independently and skip/reconcile polling until the matching save succeeds rather than using focus as the source of truth.
	async function refreshState(): Promise<void> {
		if (stateWritesInFlight > 0 || pendingSaves.size > 0 || isInteractingWithEditor()) {
			return;

scripts/mock-policy-server/public/app.ts:139

  • As on macOS, sudo tee preserves an existing file's ownership and mode and follows a symlink, so this does not guarantee the root-owned, regular, non-group/world-writable file promised by the UI. Replace the existing entry and set the required mode explicitly.
		return `sudo mkdir -p /etc/github-copilot && sudo tee ${linuxManagedSettingsPath} >/dev/null <<'JSON'\n${body}\nJSON`;

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/mock-policy-server/public/app.ts
Comment thread scripts/mock-policy-server/public/app.ts
Comment thread scripts/mock-policy-server/public/app.ts
Comment thread scripts/mock-policy-server/README.md
Comment thread scripts/mock-policy-server/public/app.ts
@joshspicer
joshspicer enabled auto-merge (squash) August 28, 2026 22:47
@joshspicer
joshspicer merged commit 3ae3ff0 into main Aug 29, 2026
38 checks passed
@joshspicer
joshspicer deleted the agents/mock-policy-server-file-paths-setup branch August 29, 2026 00:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants