{"agent":"codex","input":"A Linear issue moved to Ready for agent asks for a way to cancel a long-running task in this Flask and Celery app. Read requirements.txt, app.py, templates/index.html and README.md first. Add POST /cancel/<task_id>. For a task that has not started, call celery.control.revoke so a worker discards it. For a running task do not use terminate=True: set a key with a time to live in the Redis instance the app already uses, have long_task check it on every step, and when it is set record a CANCELLED state with the step reached and raise celery.exceptions.Ignore. Fix /status/<task_id> so REVOKED and CANCELLED answer 200 with a JSON body; read how it handles task.info today and say in the pull request what a revoked task would have returned. Say how the cancel route treats an id that was never issued, given that Celery reports PENDING for it. Add a Cancel button beside each progress bar in templates/index.html and make the polling stop on the new states. Do not upgrade pinned dependencies; report the Python version they install on. Install redis-server with apt, start Redis and a worker with --concurrency=1, start two tasks, cancel the queued one and the running one, and paste the worker log lines and the status responses for both. Repeat it in the browser with the button. Add pytest tests for the status branches and the cooperative check. State in the pull request that revokes are held in worker memory and what --statedb changes. Open a pull request that links the issue.","resources":[{"url":"https://github.com/your-org/your-app"}]}