Skip to content

fix manifest cache - #4056

Merged
zreigz merged 2 commits into
masterfrom
fix-manifest-cache
Aug 27, 2026
Merged

fix manifest cache#4056
zreigz merged 2 commits into
masterfrom
fix-manifest-cache

Conversation

@zreigz

@zreigz zreigz commented Aug 25, 2026

Copy link
Copy Markdown
Member

Test Plan

Test environment: https://console.your-env.onplural.sh/

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@soffi-ai

soffi-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Soffi AI Summary

This PR fixes a subtle but impactful bug in the deployment operator's manifest caching layer. The cache previously stored a directory path for a fetched service manifest tarball and would return it as a cache hit as long as the entry was live and the SHA matched — but it never verified that the directory actually still existed on disk. If the directory was deleted or evicted (e.g., by an ephemeral container restart, node pressure, or external cleanup), the operator would return a stale/invalid path, leading to silent sync failures.

The fix adds a filesystem existence check (dirExists) before treating a cache entry as valid. If the cached directory is missing, the entry is explicitly removed from the cache and the manifest is re-fetched from the tarball source. Additionally, on any service sync error, the component SHA cache entry is now expired to force a clean re-evaluation on the next reconcile, preventing a bad cached state from persisting through retries.

Commits

Commit Summary
927c9e0 Adds a filesystem existence check to the manifest cache hit path. If a cached directory entry is live and the SHA matches but the directory no longer exists on disk, the stale cache entry is removed and the manifest is re-fetched rather than returning an invalid path.
0efc136 Expires the component SHA cache entry whenever a service sync error occurs, ensuring that error state does not persist across reconcile attempts and that the next reconcile starts from a clean slate.

Updated: 2026-08-25 14:35 UTC

Deploy in Soffi

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes manifest-cache reuse conditional on the cached directory still existing, evicting and refetching entries whose directories disappeared.

  • Verifies cached paths with os.Stat before returning them.
  • Removes invalid cache entries and logs missing-directory refetches.
  • Adds a small directory-existence helper.

Confidence Score: 5/5

The PR appears safe to merge because invalid cached directories are now evicted and refetched without changing valid-cache behavior.

The changed path verifies directory availability before reuse, removes unusable entries, and falls through to the existing manifest-fetch flow; investigated concurrency and error paths did not reveal a new reachable failure.

Important Files Changed

Filename Overview
go/deployment-operator/pkg/manifests/cache.go Adds missing-directory detection and eviction to prevent stale manifest-cache paths from being reused; no actionable changed-code defect was identified.

Reviews (1): Last reviewed commit: "fix manifest cache" | Re-trigger Greptile

@zreigz zreigz added the bug-fix This pull request fixes a bug label Aug 25, 2026

@michaeljguarino michaeljguarino left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the bug here?

@zreigz

zreigz commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

what's the bug here?

The agent reused a cached manifest path after rollout (or other changes) and directory was deleted. The agent couldn't fetch a new tarball because relayed on the cache. A later successful sync never cleared that error in Console

@michaeljguarino

Copy link
Copy Markdown
Member

there's probably an associated bug fix to make sure the errors properly clear then too

@zreigz
zreigz merged commit 8a6f9b5 into master Aug 27, 2026
70 of 77 checks passed
@zreigz
zreigz deleted the fix-manifest-cache branch August 27, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This pull request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants