Commit graph

10 commits

Author SHA1 Message Date
Aiden Cline
4bc90593df feat(codemode): interrupt all pending work at program return
Replace the two-class completion lifecycle with one rule: once the
program returns, every promise still running - race losers, fail-fast
stragglers, and fire-and-forget calls alike - is interrupted rather
than awaited. Work whose completion matters must be awaited by the
program.

Waiting for un-awaited work before interrupting observed leftovers
could hold the execution open or deadlock it outright: a fire-and-
forget chain awaiting a race loser, or queued work needing tool-call
permits the losers occupied, blocked a drain that only the pending
interruption could unblock. Rejections that settled un-awaited before
the return still surface as Success.warnings diagnostics.

Give warnings their own output byte budget equal to maxOutputBytes so
a budget-consuming value can never starve runtime diagnostics, and
state the lifetime rule in the model-facing instructions. Port ten
curated Test262 combinator cases (duplicate members, already-settled
inputs, ordering, resolve/reject flattening) and cover the timeout-
during-cleanup path with a never-settling slow-cleanup harness tool.
2026-07-09 23:22:28 -05:00
Aiden Cline
d785803dd6 fix(codemode): interrupt observed leftovers and report warnings
Rework the execution promise lifecycle:

- Normal completion drains unobserved (fire-and-forget) promises to
  empty, then interrupts remaining observed work (race losers,
  fail-fast Promise.all stragglers) in one synchronous batch signal,
  so abandoned losers no longer gate completion or eat the timeout.
- Replace Success.unhandledRejections/unhandledRejectionsTruncated
  with a generic warnings diagnostics channel; byte-budget truncation
  appends an in-band Truncated marker diagnostic.
- A timeout firing after the program returned keeps the computed
  value and reports a leading TimeoutExceeded warning instead of
  discarding the result.
- Make PromiseRuntime effect construction pure: split observe() into
  synchronous markObserved() plus a pure await(), and allocate
  creation ids at execution time before the fork.
- Replace the O(n^2) raceAll loop in Promise.all with fail-fast
  Effect.all over waiter subscriptions; sibling work is never
  cancelled at rejection time.
- Bind all per-execution state (tool runtime, logs, timeout
  bookkeeping) at run time so a reused execution Effect starts clean.
2026-07-09 19:34:28 -05:00
Aiden Cline
f3c28008de docs(codemode): clarify output byte budget 2026-07-08 13:50:31 -05:00
Aiden Cline
b2f5c07fd1 fix(codemode): preserve floating rejection results 2026-07-08 12:02:27 -05:00
Aiden Cline
4cee5bd824
refactor(codemode): split interpreter and stdlib (#35572) 2026-07-06 12:01:14 -05:00
Aiden Cline
5b2d90a441
feat(codemode): expand standard library support (#35566) 2026-07-06 10:36:02 -05:00
Aiden Cline
7f008df79d
fix(codemode): improve prompting (#35509) 2026-07-06 09:19:04 -05:00
Aiden Cline
f9d1d3b259
refactor(codemode): namespace public types (#35435) 2026-07-05 11:51:50 -05:00
Aiden Cline
f950497173
refactor(codemode): remove generic agent tool (#35420) 2026-07-05 10:41:21 -05:00
Aiden Cline
12d9f4b29b
feat(codemode): add confined execution package (#35118)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
2026-07-03 10:57:16 -05:00