The interview problem
Run coding agents against customer repositories. Each task can edit files, execute tests, and propose a patch, but publishing changes requires an explicit authorization boundary.
Original practice question. No company interview attribution. Reviewed September 26, 2026. All workload numbers and acceptance thresholds below are illustrative practice assumptions.
1. Make completion observable
Clarify whether the output is a patch, pull request or deployment. For this exercise it is a patch plus test evidence; repository writes outside the task workspace require approval. Agree on task success: a patch applies to the intended base, required checks run, and unresolved failures are reported. Passing tests alone does not establish that the requirement was met.
Spend 5 minutes on the task contract, 10 on state and permissions, 12 on execution, 10 on recovery and 8 on evaluation. A single durable worker and sandbox is a useful baseline before considering multiple cooperating agents.
2. Separate task state from model context
POST /tasks identifies tenant, repository, base revision, goal, allowed tools and budget. Store an append-only task event log, a current state projection, workspace snapshots and immutable result artifacts. States include queued, running, awaiting-approval, cancelling, succeeded and failed. A model conversation is working context, not the authoritative task database.
The orchestrator chooses the next action; a tool broker independently validates its scope. Repository files, tool output and web content are untrusted inputs, not permission grants. An execution environment with a stronger isolation boundary such as gVisor or a microVM reduces host exposure; it still needs resource limits, egress policy, scoped credentials and lifecycle cleanup. Ordinary container packaging by itself is not a complete isolation argument.
3. Bound active tasks and artifact growth
At 100 new tasks/hour and a mean 12-minute runtime, Little’s law gives 20 active tasks on average. At a hypothetical 2 vCPU and 4 GiB per task, that is 40 vCPU and 80 GiB of active workspace capacity before headroom. Bursty arrivals, stuck tests and long-tail tasks make these averages insufficient for admission planning.
If each task produces a 50 MB artifact bundle, 2,400 tasks/day produce 120 GB/day before compression and deduplication. Apply retention and tenant quotas to logs, snapshots and artifacts separately. A task needs wall-clock, tool-call, token and disk budgets; limiting just model tokens leaves runaway subprocesses possible.
4. Recover without replaying external actions
Before dispatch, persist an action ID and its intent. Store the result with that ID. If the worker disappears after a tool call, the orchestrator first checks whether a result or downstream idempotency record exists. Read-only tests can usually be rerun; an external publish call may have an unknown outcome and must be reconciled rather than blindly repeated.
A task lease and generation prevent stale workers from advancing durable task state. They do not undo a running shell process or external request. Cancellation propagates to the broker and process supervisor, revokes short-lived capabilities, and records incomplete cleanup. Resume from a known workspace snapshot and verify repository revision compatibility before applying a patch.
5. Evaluate behavior at the permission boundary
Test a malicious instruction embedded in a repository file, a fork bomb, a hung test, a network timeout after publication, and a base revision changed during execution. The model should never be the sole enforcer of the allowed-tool list. Approval must bind to the concrete action and artifact hash; approval of an earlier patch cannot authorize an altered patch.
Persistent workspaces reduce startup cost but increase cross-task contamination risk. Ephemeral workspaces simplify isolation but need reliable snapshot/export paths. Choose deliberately and measure startup overhead against the actual task duration.
6. Follow-ups and rubric
Foundation: trace one edit-test-result cycle. Senior: recover from a crash between publishing a pull request and recording its URL. Staff: design safe migrations of running tasks when tool contracts change.
Score 0–2 each for explicit output contract, durable state, enforced permissions, ambiguous-action recovery and bounded execution. Two points mean explaining both the mechanism and what it cannot guarantee. A design that treats a model-generated “approved” string as authorization fails the permissions criterion.
Sources and next steps
References support the underlying concepts; the proposed architecture, exercises, and rubric are our own. Review task scheduling and evaluate agent outcomes.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.