Skip to content

fix(cli): invalidate app metadata cache on 422 to clear stale data#36921

Merged
wylswz merged 1 commit into
mainfrom
fix/wta-258-stale-cache-422
Jun 2, 2026
Merged

fix(cli): invalidate app metadata cache on 422 to clear stale data#36921
wylswz merged 1 commit into
mainfrom
fix/wta-258-stale-cache-422

Conversation

@GareArc
Copy link
Copy Markdown
Contributor

@GareArc GareArc commented Jun 2, 2026

Summary

  • On HTTP 422 from run app, invalidate the cached app metadata (mode, input_schema, etc.) so the next invocation fetches fresh data from the backend
  • Add a hint to the error message guiding the user to retry: "app metadata cache cleared — if the app was recently republished, run the command again"
  • No retry — fail fast on first 422, but ensure next run starts clean

Context

When an app is republished in Dify (mode change, schema change), the CLI's 1-hour metadata cache (AppMetaClient) serves stale data, causing 422 errors from the backend. Previously the user had to manually delete the cache file or wait for TTL expiry.

Closes WTA-258

Test plan

  • New test: 422 on run invalidates cache entry and error includes republish hint
  • All 25 existing run.test.ts tests pass
  • Lint clean

When a run request returns HTTP 422, the cached app metadata (mode,
input_schema) may be stale from a recent republish. Invalidate the
cache entry so the next invocation fetches fresh metadata, and add a
hint guiding the user to retry.

Closes WTA-258
@GareArc GareArc requested a review from a team as a code owner June 2, 2026 03:42
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. javascript labels Jun 2, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 2, 2026
@wylswz wylswz added this pull request to the merge queue Jun 2, 2026
Merged via the queue into main with commit 6ce61ea Jun 2, 2026
32 checks passed
@wylswz wylswz deleted the fix/wta-258-stale-cache-422 branch June 2, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants