Add /-/tasks introspection endpoint for supervised background tasks - #2892
Open
asg017 wants to merge 4 commits into
Open
Add /-/tasks introspection endpoint for supervised background tasks#2892asg017 wants to merge 4 commits into
asg017 wants to merge 4 commits into
Conversation
asg017
force-pushed
the
asg017/first-request-6-tasks-endpoint
branch
from
August 31, 2026 20:05
b776d76 to
86ba1d4
Compare
asg017
force-pushed
the
asg017/first-request-6-tasks-endpoint
branch
from
August 31, 2026 20:27
86ba1d4 to
c8ab289
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## asg017/first-request-5-wrapper-reorder #2892 +/- ##
======================================================================
Coverage 0.00% 0.00%
======================================================================
Files 74 74
Lines 12461 12467 +6
======================================================================
- Misses 12461 12467 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
asg017
force-pushed
the
asg017/first-request-6-tasks-endpoint
branch
from
August 31, 2026 21:25
c8ab289 to
3683361
Compare
simonw
force-pushed
the
asg017/first-request-6-tasks-endpoint
branch
from
September 1, 2026 16:32
3683361 to
e0644de
Compare
simonw
force-pushed
the
asg017/first-request-6-tasks-endpoint
branch
from
September 1, 2026 16:39
e0644de to
4a637ea
Compare
asg017
marked this pull request as ready for review
September 2, 2026 16:42
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
Rolled down from the stack's docs-only tip PR: introspection docs now link to the background-task API sections, the internals docs mention /-/tasks where relevant, and the full 1.0a39 changelog (including the asgi_wrapper migration guide) lands here at the top of the stack. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
asg017
force-pushed
the
asg017/first-request-6-tasks-endpoint
branch
from
September 2, 2026 16:49
99e12b9 to
66b5291
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds new
/-/tasksand/-/tasks.jsonendpoints for monitoring new "background tasks" introduced in #2889 , similar to/-/threads. It requires thepermissions-debugpermission like/-/threadsand friends.🤖 Claude-generated PR description
Sixth and final PR in the startup/lifecycle stack, on top of #2891.
What this does
Adds a
/-/tasks(and/-/tasks.json) introspection endpoint listing every supervised background task registered viadatasette.add_background_task()(#2889), plus whether the launch phase has run.Changes
datasette/app.py: new_tasks()data method exposed throughJsonDataViewat/-/tasks, guarded by the existingpermissions-debugpermission (same as/-/threads). Each task reportsname,state,plugin,started_at, and arepr()of its exception if it crashed.datasette/background_tasks.py: publiclaunchedproperty on the supervisor so the endpoint can distinguish "no tasks registered" from "registered but launch hasn't fired yet".docs/introspection.rstanddocs/json_api.rst: documents the endpoint.Docs
Rolled down from the former docs-only tip PR (#2893), this PR now also carries the stack's capstone docs:
docs/introspection.rst:/-/tasksdocs cross-reference the background-task API and lifecycle sections.docs/internals.rst: the API reference sections mention/-/taskswhere relevant.docs/changelog.rst: the full 1.0a39 release notes for the whole stack — single-event-loop serve, lifespan startup, the background-tasks API, theshutdown()hook, theasgi_wrapperreorder,/-/tasks— including the "Migrating away fromasgi_wrapperbootstrap hacks" guide.Tests
New
tests/test_tasks_endpoint.pycovering the payload shape, permission gating, and states;/-/tasksadded to the endpoint inventories intests/test_permissions.pyandtests/test_success_envelope.py.Stack created with GitHub Stacks CLI • Give Feedback 💬