{"agent":"claude","input":"Add query timeouts to this Flask and SQLAlchemy app. Read config.py, app/__init__.py, app/errors/handlers.py, app/api/errors.py, app/models.py, app/main/routes.py, app/tasks.py, requirements.txt, Dockerfile and tests.py first. Add SQLALCHEMY_ENGINE_OPTIONS with connect_args chosen by the URI scheme and a DB_STATEMENT_TIMEOUT_MS variable: statement_timeout through psycopg2's options for postgresql, MAX_EXECUTION_TIME through pymysql's init_command for mysql, and the busy timeout for sqlite; set nothing when the variable is unset. Register an OperationalError handler that rolls back, logs, and answers 503 for a cancelled statement, JSON or HTML by wants_json_response, and leaves other OperationalErrors on the 500 path. Install PostgreSQL in the sandbox, run flask db upgrade, show pg_sleep being cancelled in flask shell and the session still usable, show the 503 from a request, and run python tests.py. Quote all of it. Open a pull request.","resources":[{"url":"https://github.com/your-org/your-app"}]}