Статус: COMPLETED
Структурированная сводка для этой задачи не записана. Показан сохранённый результат без изменений.
I fixed the root cause in the isolated clone and wrote docs/e2e/SAAS-041-REPORT.md (6.5 KB). Nothing is deployed, and I did not recover the stuck job.
Root cause (reproduced):
PDO::inTransaction() returns false after a raw exec('BEGIN IMMEDIATE').saasSpendReserve opens a raw transaction. When the spend cap tripped, its guarded rollback was skipped and the transaction stayed open.beginTransaction() at :91. It never marked the job failed, so the job stayed running and the worker retried it every 6 seconds.architect-worker.php:91 with the same error when I inject a spend-cap fault.Fix:
saasRollback() helper in app/bootstrap.php. It always rolls back and ignores "no transaction is active".app/spend-guard.php now uses it. Cap semantics are unchanged: it still fails closed and never refunds reservations.app/architect-worker.php uses it in the failure path and uses raw BEGIN IMMEDIATE/COMMIT for its own writes.running job whose earlier attempt already started a provider call is no longer resent. It is marked failed with the attempt uncertain, so the owner retries once on purpose.Tests:
tests/saas-041-regression.php passes 13/13. It covers a normal conversation, spend-cap exception, API error, DB error while saving, a leaked raw transaction, no duplicate billable request after a crash, a single resume when no call had started, and tenant isolation.php -l is clean on all app/*.php.Limits:
docs/e2e/SAAS-040-STAGE1.md.failed with no new API call, or resumes it once. Either way the owner presses Retry once.spend_reservations. I did not raise the cap.docs/e2e/saas-041/backup/. The report has the deployment steps (stop the service, back up code and SQLite, copy three files, restart) and the rollback steps.Ожидает вашего решения: принять, вернуть на доработку или отложить.