Reported September 2026
OpenAIsimulation

Durable Work Queue with Dependencies

Reported by candidates from OpenAI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live OpenAI OA. Under 2s to a working solution.
Founder's read

The OpenAI OA reported in September 2026 hands you a durable work queue and expects you to build it from a wall of rules. It's a simulation problem wearing a queue costume. You get ENQUEUE, RESERVE, PASS, FAIL, ADVANCE_TIME and GET_DLQ, with retries, timeouts and dependencies layered on top. Most people lose points by misreading what RESERVE actually does, not by lacking algorithms. If you blank on the state machine mid-assessment, StealthCoder runs invisibly on your desktop and can hand you a working structure. Read the rules slowly first, because the details decide everything here.

The problem

Simulate an at-least-once work queue with retry limits, reservation timeouts, a dead-letter queue, and job dependencies. Start at time zero with no jobs, and return one result string for every operation.
ENQUEUE id timeout maxRetries dependencies: create a job. Dependencies is - or a comma-separated list of already-enqueued IDs. Return OK, or INVALID for a duplicate ID, unknown dependency, or self-dependency.
RESERVE id: among queued jobs whose dependencies have passed, find the earliest queued entry. Reserve it only when its ID equals id; return OK or UNAVAILABLE. A reservation consumes one attempt and expires at current time plus timeout.
PASS id: mark a running job passed; return OK, otherwise INVALID.
FAIL id: fail a running job; return OK, otherwise INVALID.
ADVANCE_TIME delta: advance time and expire every reservation whose deadline is at or before the new time; return OK.
GET_DLQ: return dead-lettered IDs in arrival order joined by commas, or EMPTY.
A failure or timeout requeues a job at the tail while another retry remains. A job with maxRetries = r enters the dead-letter queue after its r + 1-th failed or expired reservation. A dependent job becomes reservable only after every dependency has passed; a dead-lettered dependency leaves it blocked.

Function
simulateDurableQueue(operations: String[]) → String[]

Examples
Example 1
operations = ["ENQUEUE a 5 1 -","ENQUEUE b 3 0 a","RESERVE b","RESERVE a","ADVANCE_TIME 5","RESERVE a","PASS a","RESERVE b","PASS b","GET_DLQ"]
return = ["OK","OK","UNAVAILABLE","OK","OK","OK","OK","OK","OK","EMPTY"]
Job a times out once, succeeds on its retry, and then unlocks dependent job b.
Example 2
operations = ["ENQUEUE a 1 0 -","RESERVE a","ADVANCE_TIME 1","GET_DLQ","RESERVE a"]
return = ["OK","OK","OK","a","UNAVAILABLE"]
With no retries, the first expired reservation sends a to the dead-letter queue.

Constraints
1 <= operations.length <= 10^4
Job IDs are unique nonempty alphanumeric strings when accepted.
1 <= timeout, delta <= 10^9 and 0 <= maxRetries <= 100.
Every dependency list contains distinct IDs and only refers to earlier operations.
Time fits in a signed 64-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that RESERVE is not 'grab any ready job.' You find the earliest queued entry among jobs whose dependencies have all passed, then reserve it only if its ID matches the requested id. Otherwise return UNAVAILABLE and change nothing. That's the mistake that sinks a first attempt: reserving the requested job because it's ready, even when an earlier ready job exists. Example 1 shows it, since RESERVE b fails while a is ahead. Keep a queue list ordered by tail insertion, a per-job state (queued, running, passed, dead), an attempts counter and a deadline. On ADVANCE_TIME, expire every running job with deadline <= new time, then requeue or dead-letter after attempt r+1. Mind the order when several expire at once. Scanning the queue per RESERVE is fine at 10^4 operations. StealthCoder is your hedge in the live OA if the expiry ordering trips you up.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Durable Work Queue with Dependencies cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass OpenAI's OA.

OpenAI reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Durable Work Queue with Dependencies FAQ

What's the trick in the OpenAI durable work queue problem?+

RESERVE only succeeds if the requested id is the earliest queued job whose dependencies have all passed. Being ready isn't enough. If an earlier eligible job exists, return UNAVAILABLE and mutate nothing. Most wrong answers reserve any ready job.

How do retries and the dead-letter queue count attempts?+

Each reservation consumes one attempt. A job with maxRetries r goes to the dead-letter queue after its r+1-th failed or expired reservation. Before that, a failure or timeout puts it back at the tail of the queue. Track an attempts counter per job.

How should I handle ADVANCE_TIME?+

Add delta to the clock, then expire every running job with deadline at or before the new time. Expiry counts like a failure: requeue at the tail or dead-letter. Expire in a consistent order, such as by deadline then reservation order, and test with multiple simultaneous expiries.

What happens to jobs whose dependency is dead-lettered?+

They stay blocked forever. A dependent is reservable only when every dependency has passed, and a dead-lettered dependency never passes. So RESERVE on that job returns UNAVAILABLE. Don't remove it or dead-letter it automatically unless the rules say so.

How do I prepare for this in 48 hours?+

Write the state machine on paper first: queued, running, passed, dead. Then code it and run both examples by hand. Add edge tests for duplicate IDs, self-dependency, PASS on a non-running job, and timeouts hitting exactly at the deadline. Simple lists are fast enough at 10^4 operations.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with OpenAI.

OA at OpenAI?
Invisible during screen share
Get it