Skip to content

Fix progress being overwritten to 0 when reinstantiating Progressable#20

Merged
insign merged 1 commit into
mainfrom
fix-progress-overwrite-1638829071095150976
May 8, 2026
Merged

Fix progress being overwritten to 0 when reinstantiating Progressable#20
insign merged 1 commit into
mainfrom
fix-progress-overwrite-1638829071095150976

Conversation

@insign
Copy link
Copy Markdown
Contributor

@insign insign commented May 8, 2026

This PR fixes a bug where reinstantiating a Progressable class with an existing overallUniqueName and localKey would inadvertently overwrite its persistent progress state to 0% in the cache.

By checking if the key already exists in the cache and hydrating the instance state accordingly before resetting, this fix ensures that background progress reporting correctly resumes across different requests or job retries. It also ensures that setLocalKey safely renames keys without blindly overwriting existing progress data for the target key.


PR created automatically by Jules for task 1638829071095150976 started by @insign

When connecting to an existing progress state (e.g., from a different process or after a queue job is retried) using the same `localKey` and `overallUniqueName`, the `Progressable` trait would blindly reset the local progress to 0% in the cache. This has been fixed by loading the existing state from cache instead of immediately resetting it. `setLocalKey` was also fixed to not overwrite existing target data.

Co-authored-by: insign <1113045+insign@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d401957012

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Progressable.php
Comment on lines +458 to 461
if (!isset($overallProgressData[$name])) {
$overallProgressData[$name] = $overallProgressData[$currentKey];
}
unset($overallProgressData[$currentKey]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Sync local state when key rename hits existing target

When setLocalKey() is called and both the current key and the target key already exist, this branch skips copying data to the target but still deletes the current key. In that case, the instance keeps its old in-memory fields ($progress, metadata, status, etc.) while storage keeps the target key's data, so the object and cache diverge. A later setLocalProgress() call from this instance can then overwrite the target entry with stale values, reintroducing data loss in multi-worker or key-collision scenarios.

Useful? React with 👍 / 👎.

@insign insign merged commit fdc2015 into main May 8, 2026
3 of 4 checks passed
@insign insign deleted the fix-progress-overwrite-1638829071095150976 branch May 8, 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.

1 participant