feat(commands): bind a job to the thread it was started in #676

Merged
coilyco-ops merged 1 commit from coilyco-ops/bind-a-job-to-its-thread into main 2026-08-13 18:34:37 +00:00 AGit
Member

closes #620 - the id-less job command fallback could never resolve because nothing wrote the binding it reads. Binding an existing thread needed no decision, only creating one does.

closes #620 - the id-less job command fallback could never resolve because nothing wrote the binding it reads. Binding an existing thread needed no decision, only creating one does.
feat(commands): bind a job to the thread it was started in
All checks were successful
ci / image-build (pull_request) Successful in 25s
ci / test (pull_request) Successful in 39s
ci / publish-echo-image (pull_request) Has been skipped
ci / publish-observed (pull_request) Has been skipped
f7c423d89a
job-status and job-cancel take an optional job id and fall back to the thread's
binding, so a follow-up inside the thread repeats nothing. That fallback could
never resolve. BindJobToThread is the only writer of Origin.ThreadID and nothing
called it, so an id-less command always reported no referent.

I filed sirens-echo#620 saying this needed a product decision, because binding
requires either creating a thread per job or binding an existing one. Only the
first is a decision. The second was already free and I did not check.

Discord treats a thread as a channel, so a command run inside a thread already
arrives with that thread as its channel id. The job knew its thread the whole
time and nothing recorded it.

Only a thread binds. Binding an ordinary channel would make it resolve to one
arbitrary job of however many were started there, which is worse than no
binding.

Best effort. BindJobToThread refuses a thread already bound to another job,
which is the singularity the commands doc states rather than a fault, so it is
logged and the job still submits.

Quail's threadbindingdoc test caught the docs the moment the caller appeared,
which is exactly what it was written for. Both are updated: the threads doc no
longer says unwired, and the commands doc now states the two limits rather than
that nothing binds at all.

What stays open is whether a job gets its own thread, created for it. Nothing
opens one, so a job started in a channel still has no referent. That is the
decision, and it is Kai's.

closes #620

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-gaming/sirens-echo!676
No description provided.