1. The return was created; only its controller disappeared
A support task creates one return request for tenant A, order o-17, quantity 1. It does not refund money. The merchant has committed receipt r-return-17, but the worker exits before the session records that observation. At the same time, its disposable workspace is unavailable. Which parts should be restarted, restored or queried?
Putting every component in one long-lived container hides this question. A transcript, a temporary file and an external transaction have different owners and lifetimes. A useful modern harness makes those differences visible. The target is not a longer system prompt; it is a recoverable task with explicit authority at each boundary.
This article proposes an application architecture, using official material checked on 2026-10-30. Anthropic's Managed Agents article, 2026-04-08 motivates independent session/harness/execution interfaces. OpenAI's Agents API announcement, 2026-09-10 and architecture guide describe a managed harness and selectable environments, including no environment for suitable tool-only tasks. Neither vendor source establishes the proposed merchant contract or a completed deployment of this teaching system.
2. Draw the architecture around ownership
Visual guide · Keep durable facts outside replaceable computation
Proposed architecture: replace controller and optional executor independently; retain session events, artifact bytes and business receipts outside both. Select the figure to open it at full size.
User / trusted session identity
|
v
Application admission + release selection
|
+------> Durable session service <------+
| events + artifact references |
v |
Replaceable harness ----> model + working context |
| |
+--> discovery / bounded read program --+
|
+--> disposable executor --> artifact store
|
v
Authorized tool gateway / credential proxy
|
v
Merchant operation ledger + receipts
^
|
Receipt reconciler --------> session observations
| Boundary | Responsibility in this design | State kept outside a worker |
|---|---|---|
| Admission/application | Authenticate tenant/user, bind task and release, enforce request limits | Task identity, release digest, access policy |
| Session service | Order events; reject conflicting event identity; serve governed history | Input/intent/observation events and cursors |
| Harness/controller | Select context, invoke model, propose dispatch and await results | No unique business truth in controller memory |
| Executor/sandbox | Run permitted computation and produce candidate files | Rebuild recipe and retained output digests |
| Artifact store | Retain bytes with scope/version and digest verification | Source documents, patches and output objects |
| Gateway/proxy | Enforce current authority, approval and per-attempt limits; use credentials outside generated code | Grants, action binding, allowed targets, attempt ledger |
| Merchant | Atomically bind operation to business effect and receipt under its declared service contract | Independent operation and receipt ledger |
| Evaluator/reconciler | Check business evidence and quality separately, resolve unknown outcomes | Evaluation version and observation provenance |
“Append-only” is an application event interface, not an instruction to retain sensitive data forever. Use redaction, access control, lifecycle policy and authorized deletion. A hash helps bind bytes; it does not authenticate who supplied a document or authorize its use. A telemetry trace can aid diagnosis, but cannot replace the operation ledger.
The controller and executor are independently replaceable only if the required records and artifacts really live outside them. A log entry describing a file is not a retained file. A container image is a rebuild recipe, not a backup of uncommitted edits.
3. Trace one operation end to end
Visual guide · After worker replacement, reconcile the original operation
Proposed recovery: refresh authorization and query return-17. Record a bound receipt or retain unknown, preserving the original operation identity. Select the figure to open it at full size.
The following is a proposed fictional protocol, not a recorded provider run:
| Step | State/action | Authority to check |
|---|---|---|
| 1 | Accept task t-17 for tenant A, select release R7 | Authenticated application session; no tenant claim from model arguments |
| 2 | Load order/policy through approved read tools; retain versioned evidence references | Current merchant ownership and policy scope |
| 3 | Build a bounded context for the model | Source cursor, document versions, projection version, missing-evidence marker |
| 4 | Produce a candidate return action | Candidate is not permission or completion |
| 5 | Bind reviewer approval to order o-17, quantity 1, original reason and applicable versions | Trusted reviewer, expiry, current grant and immutable action binding |
| 6 | Persist intent for operation return-17 before dispatch | Session/action store; same ID and payload survive retries |
| 7 | Gateway authorizes and submits; merchant commits r-return-17 | Receiving boundary's current policy, stable-operation and receipt contract |
| 8 | Worker ends before its receipt event; context and workspace disappear | Session still ends at intent; outcome is unknown locally |
| 9 | Replacement worker loads R7, refreshes authority and queries return-17 | Verify merchant payload/receipt; do not issue a new operation because memory was lost |
| 10 | Append receipt observation, independently check acceptance, notify user | Business receipt and output-quality evidence remain distinct |
An illustrative event envelope is:
{
"session_id": "s-17",
"event_id": "receipt-return-17",
"sequence": 15,
"kind": "receipt_reconciled",
"operation_id": "return-17",
"attempt_id": "lookup-2",
"producer_epoch": 8,
"release_digest": "R7",
"artifact_ref": "merchant-receipt:r-return-17"
}
These fields are application choices. R7 here is a readable teaching label, not a computed cryptographic digest. A real manifest records actual bytes and resolution provenance. A sequence is allocated by the session authority, not selected by the model. Network attempt identity changes on a new lookup; business operation identity does not.
The course implementation supplies a complete copyable Python program. Its actual separate invocations yield session event counts 1→2→2 and one fictional merchant row throughout. The “interruption” is a deliberate normal process stop before receipt logging, not a measured crash or network failure. Two local SQLite files and a same-process merchant fixture establish persistent identity behavior; they do not establish remote authorization, hosted recovery, multi-host fencing or malicious-code isolation. The existing capstone supplies a different bounded localhost HTTP/process experiment.
4. Make tool efficiency respect execution boundaries
Start with the smallest tool set the workflow actually uses. For a large catalog, discovery should return eligible definitions and required scope metadata; execution still checks current authority at the point of use. A stale catalog grant cannot authorize a write.
OpenAI's Tool search guide, checked 2026-10-30, has separate configuration paths: deferred functions need tool_search plus defer_loading, while Agents API MCP discovery is automatic. Eager functions remain eager unless selected for deferral. This matters during migration: copying a flag from another API can create an apparently configured but ineffective discovery strategy.
Programmatic tool calling can coordinate reads, apply conditions and retain intermediate results outside the next model input. In this application, use it to fetch order, policy and evidence concurrently only when their dependencies permit it. Cap in-flight reads, reserve attempts before calls, bound total bytes and deadline, and return a small evidence-bearing summary plus artifact references.
Filtering should reduce data volume without hiding disqualifying records. If policy exceptions are mandatory, top-k filtering cannot drop the exception and still label the result complete. A summary of 20 fetched rows cannot stand for 20,000 unexamined rows. Do not allow a generated program to obtain a broad write tool merely because it discovered it. Cancellation of a read task and cancellation of an already transmitted write have different guarantees.
5. Credentials, skills and hooks belong to the governed release
Keep the provider and merchant secrets outside the generated-code environment. Vault documentation describes hosted placeholders replaced by a proxy for approved HTTPS hosts; network allowed_domains and credential allowed_hosts control different things. A placeholder cannot supply a real secret for local signing. For that case, expose a restricted application-side signing/action operation. This reduces secret exposure; it does not itself prove that all uses of the credential are authorized.
A release manifest in this proposed system binds model selection policy, harness image/code digest, session/context schemas, tool definition digests, business policy version, skill/plugin archive digests, hook executable digests and evaluation dataset/judge versions. Resolve packages immutably and record the loaded files. Plugin manifests provide package metadata, but a declared version string alone does not prove the bytes are unchanged.
Instruction precedence depends on the runtime. For example, Codex's AGENTS.md guide describes per-directory discovery and root-to-working-directory merge. Do not turn that into a universal agent standard or let an untrusted retrieved document join the instruction chain. In this design, administrator execution policy remains outside task-writable files.
Hooks may execute commands/tools and influence permission decisions. Review them as code with privileges, documented ordering, timeouts and fail behavior. A notification after an action is an observer, not a pre-action authorization check. A permission hook capable of allowing actions is part of the trusted policy path. Record whether it actually matched and which bytes ran; an installed hook is not evidence it enforced this operation.
When plugin/skill/hook interpretation changes during a pending approval, either keep the task on its pinned compatible release or require an explicit reviewed migration. Do not silently broaden old approval. No file called SKILL.md can give itself an external grant.
6. Choose the workload before choosing hosting
| Workload and team constraint | Candidate | Why it may fit | What must still be proved |
|---|---|---|---|
| A few remote read tools, no files | Managed or self-managed harness, no sandbox | Avoid unnecessary compute startup and retention work | Tool authority, evidence completeness, full-task outcomes |
| Many independent reads, large payloads | Harness with bounded programmatic reads and selective context | Reduce serial waits and model input volume | Discovery recall, exception retention, attempts/bytes/deadline accounting |
| Code changes and build artifacts | Disposable execution plus retained artifacts and protected repository operations | Rebuild compute without treating workspace as the sole record | Patch/base binding, actual isolation controls, egress and publish approvals |
| Private-network tools or custom native runtime | Self-managed executor, optionally managed harness | Keep execution where dependencies and resources live | Provision/reconnect/shutdown, patching, identity, private-network policy |
| Small operations team and standard execution needs | Hosted harness/environment after policy review | Delegate parts of lifecycle operations | Data location, export/replay, service limits, version behavior and app-owned business recovery |
Hosted harness and self-managed execution are not mutually exclusive. OpenAI's architecture guide assigns self-hosted environment lifecycle to the application, including provisioning, reconnecting and preserving required files. A managed session does not assume those responsibilities away.
Measure the whole task: queue, discovery, environment startup, model work, tool calls, approval wait according to a stated policy, reconciliation and delivery. Keep synthetic units, provider usage and currency separate. Include failures and unknown outcomes in accounting; a success-only token average can hide more human reconciliation.
7. Release the model and harness as a tested pair
Freeze a versioned task set with easy and difficult cases, held-out conditions and severe counterexamples. Compare A=(old model, old harness), B=(new model, old harness), C=(new model, one mechanism removed). Match task identities, policies, tool state and budgets. Disclose stochastic repetitions and missing provider usage rather than filling gaps with zero.
Use explicit acceptance gates. For this proposed return workflow, any unauthorized write, duplicate effect, acceptance without a bound receipt or silently changed approval meaning blocks promotion. Quality thresholds, allowed unknown rate, full-task latency/cost and human-review capacity are product decisions declared before inspecting candidate scores. Predeclare sample/observation requirements and retain each denominator; this article supplies no measured production threshold.
Remove old orchestration by its causal purpose. Forced context resets may have compensated for a particular model failure; repetitive planning or review loops may add latency after a model improves. Anthropic's long-app harness research, 2026-03-24 investigates incremental simplification. Use the same method on your own tasks: remove one mechanism, preserve independent verification and check the original failure plus quality/resource regressions. A vendor example does not authorize removing your boundaries.
For a canary, assign a small declared set of new tasks to the candidate release, preserve a prior compatible release and monitor every hard gate plus product metrics. Avoid duplicating real writes in a shadow comparison. A read-only or recorded replay can compare decisions, but cannot stand in for a live generation or production transaction test.
Rollback has three separate actions: stop candidate assignment, route new tasks to the prior release and reconcile in-flight work under an explicit ownership/migration plan. Preserve original operation IDs and merchant receipts. A returned code version cannot undo a submitted return; compensation needs its own current authority and independently checked outcome. If the new context/event format cannot be read by the old release, retain a compatible owner or migration adapter rather than pretending rollback is lossless.
8. What the evidence in this article establishes
The executable course example was run on 2026-10-30 with Python 3.14.7. It demonstrates one local unknown-receipt window, persistent identity across separate invocations and duplicate receipt-event replay. Its implementation exposes event and operation identity conflicts for negative-control exercises. The architecture, release manifest, gateway policy and workload table are teaching designs.
There were no provider requests, hosted-environment calls, credentials, real commercial effects, production load or learner observations in this supplement. Keeping those claims separate makes the next experiment concrete: implement one actual integration boundary, inject its failure, retain independent records and compare the resulting evidence against the same declared task contract.