Skip to content

task.reassign refuses a destination inbox the caller may not post to - #240

Merged
zlareb1 merged 9 commits into
mainfrom
fix/task-reassign-poster-check
Nov 4, 2026
Merged

zlareb1 merged 9 commits into
mainfrom
fix/task-reassign-poster-check

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

task.reassign now applies the destination inbox's posters check, as task.create does: a caller who may not post there gets 403, or 404 when it cannot read the inbox's namespace either.

Why

Failing case: writer W owns inbox a and is neither listed on inbox x nor granted anything on x's owner namespace, so task.create(inbox="x") refuses it. W creates a task in a and calls task.reassign(task_id, to_inbox="x"). handle_task_reassign loaded the destination and ran its policy decision but never called _poster_may_post, so the child task landed in x (triage, or todo under a * auto policy). The 404 that hides unreadable inbox names was skipped too, so a registered unreadable inbox answered differently from an unregistered one.

Pattern: a second write path into a table that skips a gate the first one applies.

Fix: before the destination decision, handle_task_reassign runs the same gate as handle_task_create on the caller. Both handlers now call one helper, trust._require_poster, so the two paths cannot drift apart again. The gate is on the caller because the caller is the one posting; the destination's trust policy still applies to the original poster, as before.

Scope and risk

server/tasks/app/transitions.py (handle_task_create, handle_task_reassign), server/tasks/app/trust.py (_require_poster) and the to_inbox field comment. task.create's answers are unchanged. inbox.list with mine_everywhere (the dashboard's reassign picker) now lists the inboxes the caller may post to, by the same rule: it no longer lists an inbox whose owner namespace the caller can only read, which the picker would otherwise offer and the reassign refuse with 403. A reassign the gate refuses leaves the task where it is: the check runs before the task is cancelled.

Compatibility, rollout and rollback

  • Wire: no field change. Behaviour changes: a reassign into an inbox the caller may not post to now answers 403 or 404 instead of succeeding; inbox.list mine_everywhere leaves out inboxes the caller may only read (it still lists the caller's own namespace's inboxes, and inbox.list without mine_everywhere is unchanged).
  • Rolling upgrade: an N-1 replica still accepts such a reassign until it stops serving.
  • Operator steps: none. An owner who reassigns into another team's inbox needs to be listed in its posters or hold write on its owner namespace.
  • Rollback: nothing left behind.

Tests

  • New tests/unit/test_task_inbox.py::test_a_reassign_into_an_inbox_the_caller_may_not_post_to_is_refused: failed before the fix (no exception raised); now answers 404 with no read on the destination's namespace and 403 with read but no write, and leaves the task in place with no child row. The 404 detail equals the one for an unregistered inbox name.
  • New tests/integration/test_task_inbox.py::test_a_reassign_into_an_inbox_the_caller_may_not_post_to_is_refused: with real tokens, a reassign into another team's inbox answers 404 like an unregistered name and the task stays in its inbox.
  • New tests/unit/test_inbox_trust_by_subject.py::test_inbox_list_everywhere_leaves_out_an_inbox_the_caller_may_only_read: read alone does not list an inbox; a poster entry or write does.
  • tests/unit/test_task_inbox.py, test_inbox_trust_by_subject.py, test_inbox_gate_friction.py, test_docs_reference.py pass; make format lint typecheck clean.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. Checked the create gate it mirrors and the order of the reassign's checks by reading the code.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the fix/task-reassign-poster-check branch from 02ec642 to c4d88e5 Compare November 4, 2026 02:24
zlareb1 and others added 8 commits November 4, 2026 03:37
task.reassign filed a child task into any registered inbox without the posters
check task.create applies, so a writer could post into an inbox it may not
post to, and a registered unreadable inbox answered differently from an
unregistered one. The destination now passes the same gate: 404 when the caller
may neither post nor read its namespace, 403 when it may read but not post.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…_may_post

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the fix/task-reassign-poster-check branch from c4d88e5 to f6cb541 Compare November 4, 2026 03:38
@zlareb1
zlareb1 merged commit bf04b90 into main Nov 4, 2026
22 checks passed
@zlareb1
zlareb1 deleted the fix/task-reassign-poster-check branch November 4, 2026 08:16
@pufit pufit mentioned this pull request Nov 4, 2026
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant