Skip to content

agentHost: fix customization watcher test session cleanup - #336973

Merged
Christof Marti (chrmarti) merged 5 commits into
mainfrom
chrmarti/fix-instruction-watch-acknowledgement
Sep 21, 2026
Merged

Christof Marti (chrmarti) merged 5 commits into
mainfrom
chrmarti/fix-instruction-watch-acknowledgement

Conversation

@chrmarti

@chrmarti Christof Marti (chrmarti) commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the macOS Electron customization watcher failure from Azure build 475402.

Retained diagnostics from build 475420 exposed the teardown bug: every disposeSession request sent the obsolete { session } parameter. The protocol expects { channel }, so the server was successfully disposing file:///undefined, leaving the actual sessions and their discovery watchers alive while the test deleted their workspace folders. Subsequent tests accumulated stale discovery scans and overlapping watchers.

  • Dispose the actual session channel, checked against DisposeSessionParams.
  • Await the matching root/sessionRemoved notification before deleting temporary workspaces so a success-shaped no-op cannot pass teardown again.
  • Make instruction edits observable in both scan and SDK discovery modes by asserting changed applyTo globs. SDK discovery labels instructions by filename, so the old name-only assertion could pass without any refresh.
  • Use concrete glob patterns because the SDK normalizes **/* away.

Temporary production trace instrumentation used during the investigation has been removed. The net change is confined to the customization integration test; no production behavior or skipped-test changes. Watcher timeouts are unchanged; teardown uses the existing setup timeout so its disposal assertions can finish.

Validation

  • Focused watcher tests, ESLint, commit hygiene, and full npm run typecheck-client passed.
  • Full customization suite with real session cleanup: 20 passing.
  • Negative teardown control: restoring the obsolete parameter fails the removal-notification assertion; generated output restored afterward.
  • Five focused repetitions on the final cleanup fix: 10/10 passing. A negative control also verified that unchanged globs fail at the edit assertion.
  • Final macOS Azure CI validation: build 475433 succeeded. Both instruction watcher tests passed; the serial node integration suite finished with 644 passing. Publishing and releases were disabled.

Assert changed instruction globs in scan and SDK discovery modes before adding another instruction. SDK discovery labels instructions by filename, so the previous name-only assertion passed before a watcher refresh.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 05:59

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

🟢 Approval recommended

The focused test-only changes correctly address the watcher race without weakening coverage or altering production behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Stabilizes Copilot customization watcher integration tests by ensuring instruction edits produce observable state changes.

Changes:

  • Uses concrete Markdown and TypeScript glob patterns.
  • Verifies published rule globs before testing creation and deletion.
File Description
copilotCustomizations.integrationTest.ts Makes instruction watcher assertions reliably detect edits.

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

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Base: dc9db4a0 Current: 7a6e11bf

No screenshot changes.

Retain trace logs from failing customization tests to distinguish missing filesystem notifications from stale SDK discovery results.

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

Copy link
Copy Markdown
Collaborator Author

Azure build 475418 confirms that the name-only assertion was hiding a missing refresh: with glob assertions, the test now times out on the edit itself. The initial test-only change is insufficient. Build 475420 adds retained watcher/discovery trace logs to investigate the underlying macOS failure. The local SDK dependency was also restored to the checkout version; focused tests still pass locally.

CI diagnostics showed teardown disposing file:///undefined because it sent the obsolete session field. Use the current channel contract, type-check the request, and await the matching sessionRemoved notification before deleting the workspace. Remove temporary discovery tracing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chrmarti Christof Marti (chrmarti) changed the title agentHost: wait for observable instruction edits in watcher tests agentHost: fix customization watcher test session cleanup Sep 21, 2026
Use the existing setup timeout for teardown so the disposal and removal-notification deadlines are not cut short by Mocha's five-second default hook timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chrmarti
Christof Marti (chrmarti) merged commit 5b5f322 into main Sep 21, 2026
48 checks passed
@chrmarti
Christof Marti (chrmarti) deleted the chrmarti/fix-instruction-watch-acknowledgement branch September 21, 2026 08:57
@vs-code-engineering vs-code-engineering Bot added this to the 1.140.0 milestone Sep 21, 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.

3 participants