Skip to content

Avoid fatal panic on stale config-retainer project paths in project rebuild flow#3987

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fatal-server-crash-reproduction
Draft

Avoid fatal panic on stale config-retainer project paths in project rebuild flow#3987
Copilot wants to merge 3 commits into
mainfrom
copilot/fatal-server-crash-reproduction

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

A server crash was occurring in markProjectsAffectedByConfigChanges when config-change bookkeeping referenced a configured project path that no longer existed in the builder map. This made snapshot updates crash instead of continuing through a recoverable stale-state condition.

  • Crash condition

    • markProjectsAffectedByConfigChanges assumed every entry in configChangeResult.affectedProjects was present in configuredProjects.
    • Stale entries (e.g. project removed, retainer not yet cleaned) triggered a fatal panic.
  • Behavior change

    • Replace panic-on-missing-project with a guarded skip:
      • If a project path from affectedProjects is not in configuredProjects, log and continue.
      • Existing behavior for valid projects is unchanged (mark dirty and clear dirtyFilePath).
  • Regression coverage

    • Added TestProjectCollectionBuilder_HandlesStaleConfigRetainer in:
      • internal/project/projectcollectionbuilder_panic_repro_test.go
    • Test injects a stale retained project path for a config entry, triggers a config watch change, and verifies the update path no longer crashes.
for projectPath := range configChangeResult.affectedProjects {
	project, ok := b.configuredProjects.Load(projectPath)
	if !ok {
		if logger != nil {
			logger.Logf("Skipping stale project %s affected by config change (project may have been removed)", projectPath)
		}
		continue
	}
	project.ChangeIf(/* existing dirty-marking logic */)
}

Copilot AI and others added 2 commits May 19, 2026 16:40
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate and reproduce fatal server crash in markProjectsAffectedByConfigChanges Avoid fatal panic on stale config-retainer project paths in project rebuild flow May 19, 2026
Copilot AI requested a review from RyanCavanaugh May 19, 2026 16:42
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.

Fatal server crash at markProjectsAffectedByConfigChanges

2 participants