Checked on November 7, 2026. Both client release notes discussed here are dated November 6. They describe runtime updates, not new model announcements, and do not establish identical support for every installed client or account.
The engineering question is which layer succeeded: accepting a command, continuing a session, finishing the tool and independently checking the artifact are different events. We use official documentation and entirely synthetic local files to demonstrate acceptance. The teaching script is not a production MCP client and does not contact real services.
1. What the updates actually change
The Claude Code 2.1.319 notes list terminal MCP tasks, a setting that denies calls instead of waiting for permission prompts, and background-task changes. We cite that version’s record, without treating it as the first appearance in every surface or a guarantee that any tool survives process exit.
The same-day Codex CLI 0.167.0 notes cover connected backends, chat visibility after provider changes, network-approval lifetime and accounting for failed responses during compaction. These improve recovery and diagnosis, but a visible chat does not establish lossless recovery of its environment or remote task.
| Update signal | What it helps you inspect | What still needs proof |
|---|---|---|
| Claude Code MCP tasks | Server acceptance, background status and result delivery | Required tasks finished, artifacts correct and cancellation effective |
| Deny a prompt-requiring call and continue the turn | Recorded denial and other work continuing | The denied required step succeeded |
| Codex provider / backend switching | History visibility, target session and continuation state | Matching environment, permissions, billing and files |
| Compaction and network-approval fixes | Retained failures, request completion and approval state | Business success or rollback of remote effects |
This guide separates client/tool lifecycle from API conversation storage, model rankings and subscription purchasing. The focus is how an outer workflow preserves the right outcome when work is asynchronous, a call is denied or a continuation fails.
2. Distinguish three kinds of background work
Claude distinguishes automatic backgrounding of an ordinary slow MCP call from a server-managed MCP task. A main-conversation call may move to the background after the default two minutes; a server task returns once accepted. Both can yield an identifier before a result, but their exit and recovery boundaries differ.
| Kind | What returns first | Boundary when the session exits |
|---|---|---|
| Ordinary long MCP call | A locally tracked background call / task identifier | Continuation is not guaranteed; cancellation does not prove the server did no work |
| Server-managed MCP task | A task accepted by the server | A remote server can continue; check the stdio process and server implementation separately |
| Codex asynchronous hook | One background hook invocation | Session end cancels unfinished hooks and discards undelivered output |
Codex background hooks are a separate mechanism. Information from a finished hook reaches the model at a later safe point; it cannot block, approve or rewrite the action that triggered it. Control needed before an action belongs in the appropriate synchronous policy, not an asynchronous report afterward.
Record who owns the task, who can query it, who cancels it and where its result arrives. A task ID without its original server, session or call association invites querying the wrong task or retrying merely because the result has not arrived.
3. Separate denial, exit 0 and successful resume
The release-noted permissions.denyInsteadOfPrompting setting denies a call that would wait for a permission prompt, then continues the turn. Continuing does not grant permission or make the tool succeed. A denied required step remains blocked unless a legitimate alternative plan is explicitly approved and recorded.
Codex queue with --resume is another specific trap. Its current reference says an unsuccessful resume can print a warning and still exit successfully. Checking exit 0 alone therefore confuses a queued message with resumed work. This is a documented command-specific behavior, not a rule for every CLI.
Conversely, a nonzero client exit does not prove that a remote task stopped or rolled back. It means this client chain cannot pass acceptance. Reconcile the remote outcome and artifacts before sending another request that could repeat a side effect.
| Signal | What it can establish | What it cannot establish alone |
|---|---|---|
| client_exit_code = 0 | The command exited normally under its own rules | Resume, all required tasks succeeding or artifact verification |
| Required task is denied | The required call was refused | Permission to bypass policy or omit the step |
| Task is completed | The task reports a terminal state | Correct return value, files and business checks |
| Independent verification passes | Declared checks passed for specified inputs | Reliability for all future inputs or other surfaces |
4. Prepare seven entirely offline scenarios
Use a new empty practice directory and Python 3.10 or later. Save the following as prepare_fixture.py. It creates lifecycle-demo and a fixed text file beneath the current directory. It reads no account configuration and starts no Claude, Codex, MCP or network request.
fixture.json is our teaching format, not any vendor’s event schema. Each case has one required task and a predefined expected classification. In a real integration, a trusted plan must define the required set; the model must not quietly relabel a failed step as optional.
import hashlib
import json
from pathlib import Path
root = Path.cwd() / "lifecycle-demo"
(root / "artifacts").mkdir(parents=True, exist_ok=True)
content = b"synthetic report\n"
(root / "artifacts" / "report.txt").write_bytes(content)
artifact = {"path": "artifacts/report.txt", "sha256": hashlib.sha256(content).hexdigest()}
def case(name, state, expected, artifacts=None, resume=False, resumed=False, exit_code=0):
return {
"case": name,
"client_exit_code": exit_code,
"continuation_required": resume,
"continuation_state": "resumed" if resumed else "not_resumed",
"tasks": [{"task_id": "t1", "required": True, "state": state}],
"artifacts": artifacts or [],
"expected": expected,
}
fixtures = [
case("queue_ack_only", "queued", "NOT_RESUMED", resume=True),
case("background_running", "running", "PENDING"),
case("denied_turn_continues", "denied", "BLOCKED"),
case("completed_without_artifact", "completed", "UNVERIFIED"),
case("resumed_and_verified", "completed", "VERIFIED", [artifact], True, True),
case("client_failed", "completed", "FAILED", [artifact], exit_code=3),
case("wrong_digest", "completed", "UNVERIFIED", [{"path": artifact["path"], "sha256": "0" * 64}]),
]
(root / "fixture.json").write_text(json.dumps(fixtures, indent=2) + "\n", encoding="utf-8")
print(root)
python3 prepare_fixture.pyThe seven cases cover queue acknowledgement, background work still running, denial followed by continuation, completion without an artifact, verified resumed work, client failure and a mismatched digest. These are synthetic inputs, not seven model calls or statistics about provider reliability.
5. Turn state and artifact checks into a gate
Save the next file as lifecycle-demo/verify_lifecycle.py. It checks client and continuation state first, required tasks second, then artifact paths and SHA-256. The order is intentional: a complete file cannot erase a failed resume, and a task-complete notification cannot replace an artifact.
import argparse
import hashlib
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent
def classify(case):
exit_code = case.get("client_exit_code")
if type(exit_code) is not int:
return "UNVERIFIED"
if exit_code != 0:
return "FAILED"
if case.get("continuation_required") is True and case.get("continuation_state") != "resumed":
return "NOT_RESUMED"
required = [task for task in case.get("tasks", []) if task.get("required") is True]
if not required:
return "UNVERIFIED"
states = {task.get("state") for task in required}
if "denied" in states:
return "BLOCKED"
if states & {"failed", "cancelled", "timed_out"}:
return "FAILED"
if states & {"queued", "running"}:
return "PENDING"
if states != {"completed"}:
return "UNVERIFIED"
artifacts = case.get("artifacts", [])
if not artifacts:
return "UNVERIFIED"
for artifact in artifacts:
relative = Path(artifact.get("path", ""))
if relative.is_absolute() or ".." in relative.parts:
return "UNVERIFIED"
path = (ROOT / relative).resolve()
if not path.is_relative_to(ROOT) or not path.is_file():
return "UNVERIFIED"
expected = artifact.get("sha256")
if not isinstance(expected, str) or len(expected) != 64:
return "UNVERIFIED"
if hashlib.sha256(path.read_bytes()).hexdigest() != expected:
return "UNVERIFIED"
return "VERIFIED"
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--gate", action="store_true")
args = parser.parse_args()
fixtures = json.loads((ROOT / "fixture.json").read_text(encoding="utf-8"))
results = [{"case": item["case"], "status": classify(item)} for item in fixtures]
print(json.dumps(results, indent=2))
if any(result["status"] != item["expected"] for result, item in zip(results, fixtures)):
return 1
if args.gate and any(result["status"] != "VERIFIED" for result in results):
return 2
return 0
if __name__ == "__main__":
raise SystemExit(main())
The expected digest here comes from predetermined synthetic text in the preparation script and checks identical bytes. Real reports usually cannot have a known digest in advance; use an independent structure, content or test oracle. Hashing the model’s new file and having the same model announce a match does not prove correct content.
The small script implements neither server polling, permission decisions nor real protocol authentication. Before adapting actual events, validate their provenance and structure, map them into a controlled ledger and ensure terminal states belong to the same run, session, server and task. A completed word in arbitrary logs is not a trusted terminal event.
6. Run the regression, then the batch gate
Run ordinary mode first. It prints seven classifications and checks them against each fixture’s expected value. We ran it in an isolated output practice directory with the expected exit code 0. That zero means the validator correctly recognized its successful and unsuccessful examples.
python3 lifecycle-demo/verify_lifecycle.py| case | Expected status | Meaning |
|---|---|---|
| queue_ack_only | NOT_RESUMED | Continuation required but not evidenced |
| background_running | PENDING | Required task has not ended |
| denied_turn_continues | BLOCKED | Required task was denied |
| completed_without_artifact | UNVERIFIED | Terminal state does not establish delivery |
| resumed_and_verified | VERIFIED | This synthetic example satisfies the checks |
| client_failed | FAILED | This client chain failed |
| wrong_digest | UNVERIFIED | Artifact does not match the expected bytes |
Then run --gate. If any case remains non-VERIFIED, the mixed batch returns 2 and is blocked as intended. Do not delete failure cases to obtain a green command, or treat regression-mode zero as proof that every business task finished.
python3 lifecycle-demo/verify_lifecycle.py --gateThe modes separate whether the test program is correct from whether the tested batch can pass. A production pipeline needs its own error and retry policy. FAILED here means acceptance failed; it does not establish rollback of remote effects.
7. Ask the agent for evidence, not a completion claim
Give the agent a checkable result contract: inputs actually read, terminal states of required tasks, unresolved denials and independently accessible artifacts. A prompt communicates requirements; the caller and trusted tools must still verify state. Having a model fill JSON is not a permission or completion mechanism.
RUN_ID: lifecycle-demo-v1
INPUT_FILES: lifecycle-demo/fixture.json, lifecycle-demo/artifacts/report.txt
OUTPUT_DIR: lifecycle-demo/artifacts
Check only the supplied synthetic data. No network, real CLI runs or retries of real tools.
Distinguish queue acknowledgement, running, denial, failure, completion and verified artifacts for each case.
Do not treat client_exit_code 0 as successful continuation or delivery.
If a required step is denied, retain the block and missing evidence. Do not rewrite policy or silently make the step optional.
Report each case status, evidence location and unknowns. Leave unverifiable fields unknown.
Claim delivery only for artifacts that exist and passed independent checks.Persist the run ID, original task ID, input version and required-step set in controlled records. A new run must not borrow an old successful artifact as evidence for itself. Its content, timing and task association should all match.
8. Resuming the task is different from starting a chat
Claude’s guide says a remote MCP task may keep running after exit. Follow it from the original session with matching server name and connection settings. A one-shot -p resume does not follow the old task; a new session or fork does not inherit it automatically. A stdio server may exit with the client, so a server-task label alone cannot promise persistence.
The November 6 Codex fix preserves saved-chat visibility after provider switching and offers transcript-based preparation of a new prompt when resume is unavailable. Transcript visibility restores information, not every remote handle, file-system state or permission. Check the destination environment before continuing the original task or creating a recorded replacement.
HANDOFF_ID: lifecycle-handoff-v1
List the original run, session, server/task identifiers and confirmed input version.
Report history read, message queued, session resumed and tool result retrieved separately.
In a new chat, do not assume the original background task remains queryable. Use only connections and permissions explicitly restored.
If the old action outcome is unknown, reconcile server records and artifacts before repeating a potentially state-changing action.
Separate next steps into continue, wait and human confirmation, stating the evidence missing for each.
Do not output credentials, session tokens or unsanitized transcripts.A controlled handoff retains completed subresults, remote actions still needing reconciliation and original denials. Otherwise a new chat may receive only “continue” and miss the constraints. Record plan changes and new acceptance criteria when an alternative is necessary.
9. Separate timeout, cancellation and unknown outcome
An ordinary call timing out is not the same observation as losing contact with a server task. Claude’s current guide gives background MCP tasks no default Claude Code time limit. The caller needs its own waiting budget and escalation path. Reaching that budget stops waiting, not necessarily the remote job.
Cancellation is usually a request, not proof of outcome. Claude notes that a server may finish after tracking stops or cancellation is requested, and Esc is not equivalent to stopping a background task. Reconcile an unknown outcome before retrying, especially exports, writes or sends that could duplicate work.
| Observation | State to retain | Next evidence |
|---|---|---|
| Waiting budget exhausted | Local wait timed out; remote outcome unknown | Original task and server records |
| Cancellation sent | Cancellation requested, not necessarily complete | Cancellation confirmation or final outcome |
| Task missing after environment change | Association not restored | Original server, connection and session |
| Permission denial while turn continues | Required step still blocked | Legitimate alternative plan or new authorized check |
| Completion notification but missing file | UNVERIFIED | Result body, actual artifact and independent content check |
Idempotency keys, retry counts and deduplication records depend on the real service and business semantics. This guide supplies no universal safe-retry switch for every MCP server and uses no real payments, messages, accounts or business data to demonstrate cancellation.
10. Context and permission records belong in recovery evidence
Codex 0.167.0’s compaction fix concerns retained output from failed responses and responses lacking token usage. Failure does not establish zero context cost; missing usage must not become zero. Retain reasons, observed side effects and unfinished steps instead of only the final success sentence.
Permissions and network approvals control execution. Codex distinguishes what the sandbox permits from when approval is needed; background information does not replace permission before an action. A long-running goal retains existing boundaries rather than granting wider access.
Codex approvals and sandboxing · Codex long-running work and goals
When compacting those constraints into a handoff, retain prohibited actions, denial events and unknown outcomes. A summary helps a later turn understand the task but is not a new authorization source. If a human decision was required, a summarized “continue” must not quietly remove it.
11. The checks from acceptance to release
This is our normalized acceptance flow, not a vendor’s internal state machine. When a branch remains denied, running or unverifiable, retain that state and its owner rather than merging logs to produce a green terminal result.
- Record run and required tasks
- Separate acceptance from resume
- Check actual tool terminal states
- Retain denials and unknowns
- Independently inspect linked artifacts
- Release only when all required conditions pass
12. Do not guess disputed flags or compatibility
Two current OpenAI pages disagree: the November 6 changelog mentions codex agents --no-daemon, while the CLI reference says the combination is unsupported. We record this unresolved documentation difference, provide no copyable invocation for it and have not executed the CLI to declare either side validated.
Codex CLI 0.167.0 release notes · Codex CLI command reference
Claude also has version-sensitive differences. The 2.1.319 notes discuss MCP tasks without feature-flag fetching, while the current MCP guide retains feature-flag and provider conditions and the environment table lists an earlier minimum version. Do not assemble a universal compatibility promise from one page.
Claude Code 2.1.319 release notes · Claude MCP background calls and server tasks · Claude Code environment variables
The release notes describe permissions.denyInsteadOfPrompting, but we found no dedicated entry in the settings reference reviewed here. We discuss only the stated deny-and-continue behavior, without guessing a full configuration schema, changing user settings or recommending broader permissions.
Claude Code 2.1.319 release notes · Claude Code settings reference
Another distinction: bare skips automatic discovery, but does not force every explicitly configured MCP task to wait for its result. Check waiting behavior for the task type, surface and current documentation. A simpler startup mode is not an acceptance gate.
Claude MCP background calls and server tasks · Claude Code non-interactive and bare modes
13. Integrate it without losing execution boundaries
Separate the workflow into a submitter, event adapter, artifact checker and final gate. The submitter establishes acceptance; the adapter associates real tasks and retains denials/errors; the checker opens actual outputs; the gate applies the caller-defined required conditions.
Test the outer logic first with synthetic cases: reorder arriving results, leave one task running, deny a required step, acknowledge a queue without resume and replace an artifact. An early completion message or client exit must not bypass unmet conditions.
Then verify real protocols and versions in an already authorized isolated environment, using tools without side effects and the same record format. What we actually ran was a Python standard-library fixture. No real Claude Code, Codex, MCP server or business action ran, so it establishes neither performance, account availability nor production readiness.
The final report should identify which run passed which checks, who still owns pending tasks and how unknown outcomes will be reconciled. That converts more flexible background execution into a workflow with an explicit completion definition.
Keep task associations and acceptance records before choosing tools or plans. Purchase pages describe currently listed delivery and benefits; verify the actual surface, permissions, region and version separately.