Skip to content

Comments

Fix incorrect method call in updateExpTextProcessingTime()#334

Merged
kyteinsky merged 1 commit intonextcloud:mainfrom
IONOS-Productivity:fix/processing_time_exception
Feb 12, 2026
Merged

Fix incorrect method call in updateExpTextProcessingTime()#334
kyteinsky merged 1 commit intonextcloud:mainfrom
IONOS-Productivity:fix/processing_time_exception

Conversation

@printminion-co
Copy link
Contributor

This commit fixes a bug where the method updateExpTextProcessingTime incorrectly called getExpImgProcessingTime. The change ensures that text and image processing times are tracked independently.

Description

Fixes a bug in updateExpTextProcessingTime() where it incorrectly calls getExpImgProcessingTime() instead of getExpTextProcessingTime(). This causes database type conflicts when processing text generation tasks.

The Bug

File: lib/Service/OpenAiAPIService.php
Line: 850

The function reads image processing time configuration when it should read text processing time configuration:

public function updateExpTextProcessingTime(int $runtime): void {
    $oldTime = floatval($this->getExpImgProcessingTime());  // ❌ Wrong method
    // ...
}

This causes a mismatch between:

  • Read: openai_image_generation_time / localai_image_generation_time
  • Write: openai_text_generation_time / localai_text_generation_time

Impact

Error Message

RuntimeException: OpenAI/LocalAI request failed: conflict with value type from database

When it Occurs

  • Background job processing for TaskProcessing text generation tasks
  • All text-based AI operations (FreePrompt, Summary, Headline, etc.)
  • Both OpenAI and LocalAI endpoints affected

Affected Versions

  • Introduced in v3.6.0 (commit e1ffaba - "psalm fixes", April 4, 2025)
  • Present in all subsequent versions through current v4.2.0

The Fix

Change line 850 to call the correct method:

  public function updateExpTextProcessingTime(int $runtime): void {
-     $oldTime = floatval($this->getExpImgProcessingTime());
+     $oldTime = floatval($this->getExpTextProcessingTime());
      $newTime = (1.0 - Application::EXPECTED_RUNTIME_LOWPASS_FACTOR) * $oldTime + Application::EXPECTED_RUNTIME_LOWPASS_FACTOR * floatval($runtime);

Root Cause

Copy-paste error when updateExpTextProcessingTime() was created. The corresponding updateExpImgProcessingTime() method (line 774) correctly calls getExpImgProcessingTime(), but this pattern wasn't updated for the text processing variant.

Testing

The fix ensures:

  1. Text processing time metrics are properly tracked
  2. No database type conflicts when reading/writing config values
  3. Proper exponential moving average calculation for text generation times

Reproduction

  1. Configure LocalAI or OpenAI endpoint
  2. Trigger any text generation task via Assistant
  3. Background job worker processes the task
  4. Error occurs when trying to update processing time metrics

Stack Trace Context

File: /var/www/html/lib/private/TaskProcessing/Manager.php:949
  -> OCA\OpenAi\TaskProcessing\TextToTextProvider->process()

File: /var/www/html/apps-external/integration_openai/lib/TaskProcessing/TextToTextProvider.php:135
  -> RuntimeException: OpenAI/LocalAI request failed: conflict with value type from database

Checklist

  • Bug fix (non-breaking change which fixes an issue)
  • Tested locally
  • One-line change, minimal risk
  • No new dependencies
  • Maintains backward compatibility

@printminion-co printminion-co force-pushed the fix/processing_time_exception branch 2 times, most recently from 58c953d to 59036d5 Compare February 9, 2026 09:09
This commit fixes a bug where the method updateExpTextProcessingTime incorrectly called getExpImgProcessingTime. The change ensures that text and image processing times are tracked independently.

Additionally, unit tests have been added to verify the correct functionality of processing time tracking for both text and image generations.

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
@printminion-co printminion-co force-pushed the fix/processing_time_exception branch from 59036d5 to ba8ad92 Compare February 12, 2026 09:15
Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

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

thanks!

@kyteinsky kyteinsky merged commit c5f8411 into nextcloud:main Feb 12, 2026
27 checks passed
@printminion-co printminion-co deleted the fix/processing_time_exception branch February 17, 2026 08:27
@artonge
Copy link

artonge commented Feb 17, 2026

@kyteinsky do you have a branch for 31?

@artonge
Copy link

artonge commented Feb 17, 2026

/backport to stable32

@backportbot
Copy link

backportbot bot commented Feb 17, 2026

The backport to stable32 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable32
git pull origin stable32

# Create the new backport branch
git checkout -b backport/334/stable32

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick ba8ad924

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/334/stable32

Error: Failed to cherry pick commits: error: no cherry-pick or revert in progress
fatal: cherry-pick failed


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@kyteinsky
Copy link
Contributor

do you have a branch for 31?

stable32 should cover 30 -> 32

@kyteinsky
Copy link
Contributor

/backport c5f8411 to stable32

backportbot bot pushed a commit that referenced this pull request Feb 17, 2026
This commit fixes a bug where the method updateExpTextProcessingTime incorrectly called getExpImgProcessingTime. The change ensures that text and image processing times are tracked independently.

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
kyteinsky pushed a commit that referenced this pull request Feb 17, 2026
…) (#344)

This commit fixes a bug where the method updateExpTextProcessingTime incorrectly called getExpImgProcessingTime. The change ensures that text and image processing times are tracked independently.

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
Co-authored-by: Misha M.-Kupriyanov <145785698+printminion-co@users.noreply.github.com>
@github-actions
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants