Skip to content

feat: Add overall estimated time remaining calculation#18

Merged
insign merged 2 commits intomainfrom
jules-overall-eta-3790971146602252366
Apr 28, 2026
Merged

feat: Add overall estimated time remaining calculation#18
insign merged 2 commits intomainfrom
jules-overall-eta-3790971146602252366

Conversation

@insign
Copy link
Copy Markdown
Contributor

@insign insign commented Apr 24, 2026

This PR introduces the ability to calculate the estimated time remaining for an entire job composed of multiple local processes.

It adds real value to the project by exposing getOverallEstimatedTimeRemaining(), which calculates the remaining time by finding the earliest start time among all local tasks and dividing the remaining overall progress by the overall rate. This completes the ETA functionality, which previously was only available for individual local processes.

Changes:

  • Implemented getOverallEstimatedTimeRemaining in src/Progressable.php
  • Exported overall_estimated_time_remaining in the toArray() output
  • Documented the new method and the existing local ETA method in README.md
  • Added comprehensive unit tests in tests/OverallEtaTest.php covering different start times and progress levels
  • Updated existing toArray tests in tests/ProgressableTest.php to include the new array key

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

This adds a `getOverallEstimatedTimeRemaining` method to calculate the global ETA of a task based on the average progress and the earliest start time of all local instances. This provides concrete value by allowing applications to display remaining time for complex multi-part jobs, completing the existing local ETA functionality.

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: 0204e5acf8

ℹ️ 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
* Get the estimated time remaining in seconds for the overall progress.
*/
public function getOverallEstimatedTimeRemaining(): ?int {
$overallProgress = $this->getOverallProgress();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use unrounded progress when computing overall ETA

getOverallEstimatedTimeRemaining() derives its rate from getOverallProgress(), which applies configured precision rounding before returning. That makes ETA depend on display precision: with low precision (or very small/near-complete real progress), the rounded value can become 0 (returning null) or 100 (returning 0) even though work is still in progress, so callers can get incorrect overall ETA. Compute ETA from raw progressData values (without presentation rounding) to avoid precision-induced errors.

Useful? React with 👍 / 👎.

@insign
Copy link
Copy Markdown
Contributor Author

insign commented Apr 28, 2026

Este PR ainda não está pronto porque o CI está vermelho. O job Code Style falha em composer lint:test/Pint com style issue em tests/IsOverallCompleteBugTest.php (new_with_parentheses, blank_line_after...). Rode o formatador do projeto (vendor/bin/pint ou script equivalente) no branch e atualize o PR; PHPUnit e análise estática já estão verdes.

@google-labs-jules
Copy link
Copy Markdown
Contributor

Este PR ainda não está pronto porque o CI está vermelho. O job Code Style falha em composer lint:test/Pint com style issue em tests/IsOverallCompleteBugTest.php (new_with_parentheses, blank_line_after...). Rode o formatador do projeto (vendor/bin/pint ou script equivalente) no branch e atualize o PR; PHPUnit e análise estática já estão verdes.

I have run vendor/bin/pint to fix the style issues in tests/IsOverallCompleteBugTest.php and staged the change. PHPUnit and static analysis continue to pass successfully. I will submit the branch now to update the PR.

Running `vendor/bin/pint` fixed missing blank lines and parenthesis
warnings in `tests/IsOverallCompleteBugTest.php` that was causing
the CI build to fail on Code Style check.

Co-authored-by: insign <1113045+insign@users.noreply.github.com>
@insign insign merged commit 9e2fe5d into main Apr 28, 2026
4 checks passed
@insign insign deleted the jules-overall-eta-3790971146602252366 branch April 28, 2026 00:59
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