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.

Claude Code 2.1.319 release notes

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.

Codex CLI 0.167.0 release notes

Release notes start the acceptance process; they do not prove success
Update signalWhat it helps you inspectWhat still needs proof
Claude Code MCP tasksServer acceptance, background status and result deliveryRequired tasks finished, artifacts correct and cancellation effective
Deny a prompt-requiring call and continue the turnRecorded denial and other work continuingThe denied required step succeeded
Codex provider / backend switchingHistory visibility, target session and continuation stateMatching environment, permissions, billing and files
Compaction and network-approval fixesRetained failures, request completion and approval stateBusiness 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.

Claude MCP background calls and server tasks

Do not collapse different mechanisms into one background-complete label
KindWhat returns firstBoundary when the session exits
Ordinary long MCP callA locally tracked background call / task identifierContinuation is not guaranteed; cancellation does not prove the server did no work
Server-managed MCP taskA task accepted by the serverA remote server can continue; check the stdio process and server implementation separately
Codex asynchronous hookOne background hook invocationSession 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.

Codex hooks and background-hook lifecycle

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.

Claude Code 2.1.319 release notes

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.

Codex CLI command reference

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.

The teaching statuses below are this guide’s normalized labels
SignalWhat it can establishWhat it cannot establish alone
client_exit_code = 0The command exited normally under its own rulesResume, all required tasks succeeding or artifact verification
Required task is deniedThe required call was refusedPermission to bypass policy or omit the step
Task is completedThe task reports a terminal stateCorrect return value, files and business checks
Independent verification passesDeclared checks passed for specified inputsReliability 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.

Save as prepare_fixture.py; machine example identical in all six languages
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)
Create lifecycle-demo/fixture.json and the fixed artifact
python3 prepare_fixture.py

The 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.

Offline standard-library validator, not a production protocol adapter
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.

Codex non-interactive execution

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.

Regression mode: expected exit code 0
python3 lifecycle-demo/verify_lifecycle.py
A local synthetic fixture run, not a model performance test
caseExpected statusMeaning
queue_ack_onlyNOT_RESUMEDContinuation required but not evidenced
background_runningPENDINGRequired task has not ended
denied_turn_continuesBLOCKEDRequired task was denied
completed_without_artifactUNVERIFIEDTerminal state does not establish delivery
resumed_and_verifiedVERIFIEDThis synthetic example satisfies the checks
client_failedFAILEDThis client chain failed
wrong_digestUNVERIFIEDArtifact 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.

Batch gate: this fixture should exit with code 2
python3 lifecycle-demo/verify_lifecycle.py --gate

The 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.

Copyable lifecycle-review prompt; no model was called
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.

Claude MCP background calls and server tasks

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.

Codex CLI 0.167.0 release notes

Copyable evidence-handoff prompt; not executed
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.

Claude MCP background calls and server tasks

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.

Claude MCP background calls and server tasks

A missing client result is not a reason to repeat an action immediately
ObservationState to retainNext evidence
Waiting budget exhaustedLocal wait timed out; remote outcome unknownOriginal task and server records
Cancellation sentCancellation requested, not necessarily completeCancellation confirmation or final outcome
Task missing after environment changeAssociation not restoredOriginal server, connection and session
Permission denial while turn continuesRequired step still blockedLegitimate alternative plan or new authorized check
Completion notification but missing fileUNVERIFIEDResult 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.

Codex CLI 0.167.0 release notes

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.

  1. Record run and required tasks
  2. Separate acceptance from resume
  3. Check actual tool terminal states
  4. Retain denials and unknowns
  5. Independently inspect linked artifacts
  6. Release only when all required conditions pass
Synthetic lifecycle gate; no real service execution implied

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.