[2.x] Extension Manager: queued tasks fail on PostgreSQL (output NOT NULL, command varchar(50))
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
- 78/100
Línea de trabajo
Comienza en extensions/package-manager/src/Task/Task.php, en Task::build(), que guarda una tarea pendiente sin establecer la columna NOT NULL output; el issue ya incluye una corrección candidata. Después, revisa el esquema de extension_manager_tasks en extensions/package-manager/migrations (probablemente la migración original de creación de tabla más una nueva migración de cambio) para ampliar command más allá de varchar(50). Se considera terminado cuando se puede crear una tarea encolada y guardar el comando de actualización global en PostgreSQL/SQLite/MySQL estricto: verifica con php flarum migrate en una base de datos estricta y ejecutando la ruta de creación de tareas del extension manager o sus tests existentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Current Behavior
With the queue enabled ('queue' => ['driver' => 'database']) and "queue jobs" turned on in the Extension Manager, two schema problems in extension_manager_tasks break tasks on PostgreSQL. MySQL in non-strict mode silently stores '' and truncates, so they go unnoticed there.
1. Every queued task fails to be created. Task::build() saves a pending task without setting output, but the column is mediumText('output') with no ->nullable(). The admin UI shows "Database query failed. This may be caused by an incompatibility between an extension and your database driver." and the log has:
SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "output" of relation "extension_manager_tasks" violates not-null constraint
DETAIL: Failing row contains (1, pending, extension_update, null, fof/links, null, 2026-10-07 01:02:45, null, null, null, null).
2. The Global Update is recorded as failed after Composer has finished. command is string('command', 50), but the global update command is 56 characters (update --prefer-dist --no-dev -a --with-all-dependencies). Composer completes, then Task::end() cannot save the row:
SQLSTATE[22001]: String data, right truncated: 7 ERROR: value too long for type character varying(50)
(SQL: update "extension_manager_tasks" set "status" = failure, "command" = update --prefer-dist --no-dev -a --with-all-dependencies, ...)
The job then stops, so the steps after the update never run: a pending migration from an updated extension stayed unapplied until I ran php flarum migrate by hand.
Steps to Reproduce
- Install Flarum 2.x on PostgreSQL and enable the Extension Manager.
- Set
'queue' => ['driver' => 'database']inconfig.phpand enable queued jobs in the Extension Manager settings. - Click "Update" on any extension: the task is never created and the alert above appears (bug 1).
- With
outputmade nullable, click "Run Global Update": Composer finishes, but the task ends as failed with the varchar(50) error (bug 2).
Expected Behavior
Tasks are created, and the global update is recorded as successful, on PostgreSQL (and SQLite or strict MySQL) just as on non-strict MySQL.
Environment
- Flarum version: core v2.0.0-rc.8, flarum/extension-manager v2.0.0-rc.5 (the same code is unchanged on
2.x) - Website URL: private test site
- Webserver: Caddy with PHP-FPM
- Hosting environment: VPS
- PHP version: 8.5.4
- Database: PostgreSQL 18.6
- Browser: not relevant (server side)
Possible Solution
Set output to an empty string when building a task, and widen command to text (a major update lists every extension, so 255 may also be too short). The patch below applies cleanly to 2.x. I applied the equivalent schema change on our install, and both kinds of task now save.
diff --git a/extensions/package-manager/src/Task/Task.php b/extensions/package-manager/src/Task/Task.php
--- a/extensions/package-manager/src/Task/Task.php
+++ b/extensions/package-manager/src/Task/Task.php
@@ -68,6 +68,8 @@ class Task extends AbstractModel
$task->operation = $operation;
$task->package = $package;
$task->status = static::PENDING;
+ // The output column is NOT NULL; PostgreSQL and SQLite reject a pending task without it.
+ $task->output = '';
$task->created_at = Carbon::now();
$task->save();
diff --git a/extensions/package-manager/migrations/2026_10_07_000000_change_command_column_to_text_in_extension_manager_tasks_table.php b/extensions/package-manager/migrations/2026_10_07_000000_change_command_column_to_text_in_extension_manager_tasks_table.php
new file mode 100644
--- /dev/null
+++ b/extensions/package-manager/migrations/2026_10_07_000000_change_command_column_to_text_in_extension_manager_tasks_table.php
@@ -0,0 +1,26 @@
+<?php
+
+/*
+ * This file is part of Flarum.
+ *
+ * For detailed copyright and license information, please view the
+ * LICENSE file that was distributed with this source code.
+ */
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Schema\Builder;
+
+return [
+ 'up' => function (Builder $schema) {
+ // Composer commands such as the global update are longer than 50 characters.
+ // MySQL in non-strict mode truncates them; PostgreSQL rejects the row.
+ $schema->table('extension_manager_tasks', function (Blueprint $table) {
+ $table->text('command')->nullable()->change();
+ });
+ },
+ 'down' => function (Builder $schema) {
+ $schema->table('extension_manager_tasks', function (Blueprint $table) {
+ $table->string('command', 50)->nullable()->change();
+ });
+ }
+];
Additional Context
The Extension Manager's Dispatcher silently skips a new request while another task is pending or running, so after bug 1 the UI gives no further feedback on retries.
- Lenguaje dominante
- PHP
- Estrellas
- 6.8k
- Forks
- 889
- Merge medio
- 14 h 13 min
- PR fusionados (30 d)
- 140
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 flarum/framework
-
[2.x] extension-manager: update checks fail for composer repositories with credentials in the URLPosiblemente ocupada @ernestdefoe la tomó hace 2 días. Abiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
flarum/framework#5281 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Admin search throws for permissions added through Admin.generalIndexItems('permissions', ...)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Admin search ignores a settings or permissions item's own linkPosiblemente ocupada @GBra-4-669 la tomó hace 5 días. Abiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
type/extensibility
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
[mentions] Formatting fails with a 500 when the flarum/tags package isn't installedPosiblemente ocupada @HawkForge la tomó hace 1 día. Abiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
Todos los issues de flarum/framework
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
0. Needs triage 36-feedback bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
area:ci priority:low type:chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
crazy-goat/php-fpm-ng#1021 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ProfessionalWiki/NeoWiki#1755 ·
Los mantenedores suelen responder en 1 día