The direct answer
For the documented default asyncio task branch, review the current context at task creation rather than treating the creator’s later context as the task’s live scope. Keep copied correlation labels separate from an independently owned work record and current authorization. Restoring a creator binding is not a revocation, cancellation or erasure mechanism for created work.
Know which scope a fixed task is meant to use
A fictional AI console prepares a small metadata label for an already admitted note. Trusted request handling has workspace scope S-A and work record W-A. It creates task T-A, then continues handling another request under S-B. A helper inside T-A reads a context variable instead of receiving the workspace label as an explicit argument.
The useful question is which binding that helper is intended to observe. A correct tenant identifier in a later log line does not establish how the task obtained it, which note it belongs to or whether processing remains permitted.
The existing tenant-isolation guide requires trusted scope and current object checks. This worksheet adds a specific runtime binding boundary. It neither replaces those checks nor defines a database snapshot, durable job credential or new worker-pool policy.
Freeze the documented copied-context branch
The two selected official bodies identify Python 3.15.2. asyncio.create_task() documents copying the current context when no context argument is supplied. The Task description says its coroutine runs in that copied context. The review point is task creation, not a later assumption about the caller’s current labels.
ContextVar.get() and set() operate on the current context. set() returns a token for restoring the previous value with reset(); the same token cannot be reused. Taken together with task-context copying, restoring the creator’s binding is not a rewrite of the separate task’s copied binding.
This profile selects one trusted default task-creation path and a fixed application coroutine. It excludes explicit custom contexts, custom task factories, eager-execution behavior, callbacks, threads, processes and alternate scheduling APIs. Actual interpreter, effective creation path and binding lifecycle are uninspected. If they cannot be reconciled with this scope, the positive stays unsupported.
Write a creation-point association sheet
Use labels only: owner O-A, intended scope S-A, immutable work record W-A and task association T-A. Before creation, the trusted owner must establish the intended scalar bindings and check that W-A belongs to that scope. The review sheet then records the selected creation path and expected task-context association.
At the first trusted work boundary inside the fixed task, compare its context-derived labels with W-A rather than letting those labels choose a different record. An absent or conflicting binding holds the work; a convenient default must not silently select a shared workspace. The record supplies the intended ownership, while the context offers a local lookup convenience.
Only bounded immutable scalar labels are permitted in this plan. Keep credentials, prompts, document bodies and mutable authorization mappings out of context values. The documented copy is not evidence that an application’s referenced data became an independent immutable deep copy. This worksheet makes no mutable-value aliasing prediction or memory-isolation claim.
Actual task/result lifetime, supported cleanup, bounded consumption and work-record integrity remain application prerequisites. Context association alone does not establish successful completion, safe arbitrary code or delivery of an audit record.
Distinguish creator cleanup from work admission
The coroutine documentation distinguishes calling a coroutine from scheduling it. Preparing a coroutine object under S-A is not the selected task-context capture event. If task creation occurs under S-B, do not assert S-A merely because the object was prepared earlier.
Likewise, a creator restoring its previous binding serves that creator’s context bookkeeping. Preserve the corresponding token and binding ownership through the supported lifecycle; an unexplained reset sequence cannot attest correct cleanup. This is not a token-reuse recipe or a claim about undocumented exception behavior.
Current work permission is another check. If W-A is cancelled or the initiating subject loses access, a context still naming S-A does not reopen admission. Apply the actual supported current-rights gate before any model request or business effect. No cancellation, revocation or effect coordinator is implemented here.
Review eight inert task-context cards
All cards are PROPOSED_UNRUN. They contain invented event labels, not constructed Python contexts, coroutine objects or tasks.
| Card | Proposed condition | Review decision |
|---|---|---|
| 1. Ordinary association | T-A created with intended S-A; trusted immutable W-A and all prerequisites established. | Conditionally use labels for this fixed metadata task; no model dispatch follows from them alone. |
| 2. Creator moves on | Creator changes its own binding to S-B after creating T-A. | Do not relabel T-A/W-A using the creator’s newer scope. |
| 3. Earlier coroutine object | Object prepared under S-A, task creation occurs under S-B. | Review creation-point context; reject an asserted S-A association unsupported by W-A and actual creation. |
| 4. Creator resets | Creator restores its binding after T-A creation. | No claim that T-A was cleared, revoked, cancelled or erased. |
| 5. Alternate creation path | Explicit custom context, unknown factory or another API is used. | Outside this selected branch; hold rather than infer equivalent behavior. |
| 6. Mutable or selected scope | A model supplies scope, or a mutable mapping is stored as context data. | Reject the trusted scalar-only profile; no deep-copy safety inference. |
| 7. Missing lifecycle evidence | Binding setup, token ownership or restoration sequence is unknown. | No supported association; require actual lifecycle review. |
| 8. Old labels, changed rights | S-A remains familiar but W-A differs or current authority is revoked. | Hold or deny independently before dispatch; labels grant no authority. |
Keep the ordinary positive narrow
The positive is useful when a trusted fixed task needs a bounded correlation label for one authorized note. It remains conditional on supported runtime behavior, trusted scalar setup, correct token lifecycle, independently owned W-A, current rights and bounded result handling. None of those deployment prerequisites is verified here.
No ContextVar, token, coroutine, task, loop, callback or fixture was created or exercised. No set/reset, await, runtime import, model call or context-propagation experiment occurred. Boundary remains prelaunch with planned request-path checks; it does not ship this Python task-context controller or an authorization engine.
Primary sources
Official references supporting the guidance. Examples in this guide are synthetic and are not reports of a production incident.