Translation cache key ignores service, model and system prompt, entries never expire
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
El informe identifica TranslateService::translate() como el lugar donde se crea y almacena la clave de caché. Lee primero ese método y el uso de la caché que lo rodea; comprueba si las pruebas de traducción existentes cubren el comportamiento del servicio, el modelo, el prompt y la caducidad. El trabajo estará hecho cuando las traducciones con configuraciones distintas no reutilicen una entrada incompatible y las entradas en caché tengan una vida útil limitada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Steps to reproduce
- Configure a distributed memory cache in
config.php(e.g. APCu or Redis) (e.g.'memcache.distributed' => '\OC\Memcache\Redis'), as recommended for production instances. - Configure two different translation services, or a single service whose model you can change in the settings.
- Translate the same text with the same source and target languages using the first service or model, then using the second one.
Expected behaviour
The second translation is actually performed by the second service or model, since different providers and models produce different translations of the same input.
Actual behaviour
The second translation is served from the cache entry written by the first one. The provider is never called again.
The cache key is built in TranslateService::translate() as:
$cacheKey = $sourceLanguageCode . '/' . $targetLanguageCode . '/' . md5($chunk);
The key contains neither the service, nor the model, nor the system prompt, so a cache entry written through one configuration is necessarily hit by any other configuration translating the same text between the same languages. Entries are also stored without a TTL ($cache->set($cacheKey, ...)), so once written, a translation is served forever, even after the underlying model or service configuration is changed or fixed.
This also means the cache silently loses most of its value as soon as an instance uses more than one translation service, since hits become essentially random across configurations.
Side observation: on instances without a distributed memory cache configured, the distributed cache falls back to a per-request backend, so the translation cache never hits at all and every translation is recomputed. If that fallback is considered acceptable for small instances it may be worth documenting; if not, the cache could use a different backend.
Suggested direction
Include at least the service id and the model in the cache key (and ideally the system prompt, which is part of the translation behaviour), and store entries with a finite TTL so that configuration or model changes eventually invalidate stale translations.
Reproduction on a live instance
Reproduced end-to-end on a live Nextcloud 35.0.3 instance with APCu as the distributed cache, using a local mock provider that echoes what it receives and logs every request. Two distinct translation services were configured, both pointing at the mock, and the same text was translated three times in a row:
| Call | Service | Model | Provider called? |
|---|---|---|---|
| 1 | A | model-aaa |
yes |
| 2 | A | model-bbb |
no — served from cache |
| 3 | B | model-ccc |
no — served from cache |
Only the first of the three translations reached the provider, although each used a different model or an entirely different service.
Assisted by Devin:SWE-2.1
- Lenguaje dominante
- PHP
- Estrellas
- 78
- Forks
- 42
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nextcloud/integration_openai
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
nextcloud/integration_openai#477 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
nextcloud/integration_openai#471 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Vllm rejecting requests that have empty tools listPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
nextcloud/integration_openai#448 · 3 comentarios · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
Chunked text processing silently drops the end of long textsPosiblemente ocupada @nonofr91 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
nextcloud/integration_openai#478 ·
Los mantenedores suelen responder en 1 día
-
Solve 2 transcription problems: Video input and big inputPosiblemente ocupada @danafon la tomó hace 1 día. Abiertobug enhancement priority: high
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
nextcloud/integration_openai#472 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de nextcloud/integration_openai
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
Automattic/static-site-importer#3462 ·
Los mantenedores suelen responder en 1 día
-
Document lexicon.default.userconfig and lexicon.default.userconfig.enforced in config.sample.phpAbiertoenhancement feature: settings good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
a11y
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
omeka/plugin-Contribution#84 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
recca0120/vscode-phpunit#620 ·
Los mantenedores suelen responder en 1 día