Skip to content

Log organization resource cache creation failures - #326958

Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
microsoft:mainfrom
Bestra:bestra/org-instructions-trace
Jul 28, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 3 commits into
microsoft:mainfrom
Bestra:bestra/org-instructions-trace

Conversation

@Bestra

@Bestra Chris Westra (Bestra) commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Organization-level instructions can be missing from chat even when VS Code selects the expected organization. Existing trace output reports that the cache directory does not exist when instructions are read, but it does not show whether directory creation or the following file write succeeded.

This change adds trace logs before and after organization resource cache directory creation and cache file writes. If either filesystem operation fails, it logs the error with operation context and rethrows it so existing caller behavior remains unchanged.

No refresh, authentication, request, or cache behavior changes. Added focused tests for directory creation and file write failures.

Preserve cached instructions on fetch failures and refresh organization resources when authentication or workspace selection changes.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 5b647a0f-5022-4a32-959a-ad8c129b1614
Copilot AI review requested due to automatic review settings July 22, 2026 12:03

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.

Pull request overview

Restores organization instruction and custom-agent refreshes after authentication or workspace changes while preserving caches on transient failures.

Changes:

  • Adds event-driven, serialized resource refreshes with queued reruns.
  • Distinguishes confirmed absence from authentication/request failures.
  • Adds regression coverage and refresh-capable test mocks.
Show a summary per file
File Description
mockWorkspaceService.ts Adds workspace-change event support.
mockAuthenticationService.ts Adds authentication-change event support.
octoKitServiceImpl.ts Propagates request failures and handles confirmed absence.
githubService.ts Documents updated API semantics.
githubOrgInstructionsProvider.spec.ts Covers caching, failures, and invalidation.
githubOrgChatResourcesService.spec.ts Covers lifecycle refresh and disposal behavior.
githubOrgInstructionsProvider.ts Refreshes instructions and preserves cache on failures.
githubOrgCustomAgentProvider.ts Refreshes agents after organization changes.
githubOrgChatResourcesService.ts Implements event-driven serialized refreshes.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Medium

Log refresh outcomes, cache resource counts, prompt length, and cache preservation without recording instruction content.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 5b647a0f-5022-4a32-959a-ad8c129b1614
@Bestra

Copy link
Copy Markdown
Contributor Author

We chatted in slack and we're now thinking the that the actual problem here is that the cache directory doesn't exist, rather than there being a timing problem.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 5b647a0f-5022-4a32-959a-ad8c129b1614
@Bestra Chris Westra (Bestra) changed the title Recover organization instructions after authentication changes Log organization resource cache creation failures Jul 23, 2026
@Bestra

Copy link
Copy Markdown
Contributor Author

Paul (@pwang347) Per our conversation, I've updated this PR to just add a little bit more cache related trace logging.

try {
await this.fileSystem.createDirectory(cacheDir);
} catch (error) {
this.logService.error(error, '[GitHubOrgChatResourcesService] Failed to create cache directory');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking these should probably also be trace level logs instead of error level?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I looked around a bit and I think it's reasonable to keep these at error.

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 84e7f91 into microsoft:main Jul 28, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.132.0 milestone Jul 28, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants