Repository navigation
Closed
Labels
app/corePackage: core (pkgs/ or apps/ in this repo)Package: core (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workMedium: expected under 1 day of workkind/featureNew feature or capability requestNew feature or capability requestpriority/normalOrdinary priority (the default)Ordinary priority (the default)source/design-architectFiled by the repo design architect jobFiled by the repo design architect jobstatus:done
Description
Sub-issue of #800 (design: Code Mode's missing standard library). Implements phase 2 of that design; depends on phase 1's libraries mechanism (sibling sub-issue of #800).
Scope
sleephost primitive: one new extension inpackages/corealongsideCodeModeWeb(packages/core/src/codemode/web.tsis the pattern: host function,AbortSignal.timeout-style capping). Its global is not exposed under its own name — the std library wraps it asstd.sleep(ms). A single sleep is capped at the execution's remaining wall-clock budget. Per the extension contract (packages/codemode/src/extension.ts) it is not a tool call and does not consumemaxToolCalls; the execution timeout still bounds total wall time.- Async helpers in the std library (program-side, on phase 1's mechanism):
std.sleep(ms)— as above.std.mapLimit(items, limit, fn)— bounded concurrency, results in input order; on first rejection no new items start and the promise rejects with that error.std.retry(fn, { attempts, delayMs, backoff, shouldRetry })— retries rejections only, delays viastd.sleep, deterministic by default (no jitter unless requested).std.withTimeout(promiseOrFn, ms)— rejects with a timeout error afterms. It does not cancel the underlying work (an admitted tool call may still complete host-side); this is stated in the instructions listing (§3).
- Instructions: the std listing in
packages/core/src/codemode/instructions.tsgains the async members, including thewithTimeoutnon-cancellation warning in plain words. interpreter-support.mdchecklist entries updated for the async surface.
Acceptance criteria
- Tests (in the interpreter, via
packages/codemode/ core tests):mapLimitnever exceeds the limit, preserves order, and starts no new items after a rejection;retrysucceeds after transient rejections and stops afterattempts, with delays routed through the sleep primitive (no wall-clock-flaky assertions);withTimeoutrejects a slow promise at the deadline while the underlying tool call's completion is still recorded. - A single
std.sleeplonger than the remaining execution budget does not extend the execution past its timeout. - Tool calls made inside helpers count toward
maxToolCallsand appear intoolCallsexactly as direct calls do. - Instructions render the async members with the non-cancellation warning.
-
bun run checkfrom the repo root passes, or pre-existing failures on the base branch are named in the closing note. Tests run from package directories per repoAGENTS.md.
Design: #800 (full text in the keep-the-four-repos-healthy goal workspace, files/designs/opencode-codemode-stdlib.md, §§2–3).
Metadata
Metadata
Assignees
Labels
app/corePackage: core (pkgs/ or apps/ in this repo)Package: core (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workMedium: expected under 1 day of workkind/featureNew feature or capability requestNew feature or capability requestpriority/normalOrdinary priority (the default)Ordinary priority (the default)source/design-architectFiled by the repo design architect jobFiled by the repo design architect jobstatus:done
Activity
developing-today commentedon Oct 29, 2026
OPENCODE-175
dezren39 commentedon Oct 29, 2026
🤖 Agent note · filed
sleephost extension in core (not exposed under its own name), wrapped program-side asstd.sleep, plusstd.mapLimit(ordered, fail-fast),std.retry(rejections only, deterministic backoff via sleep) andstd.withTimeout(bounds waiting, never cancels an admitted tool call — instructions must say so). Depends on phase 1's mechanism (feat(codemode): versioned program-source libraries + std v1 pure helpers (bind, chunk, uniqBy, keyBy, pick, omit) (design #800, phase 1) #802).dezren39 commentedon Oct 29, 2026
Parked by queue worker (lane B): phase 2 cannot start until phase 1 lands.
Verified fresh this shift: #802 is still OPEN and its libraries mechanism is not on main — task 2963's triage (2026-10-29T02:14Z) confirmed the gap at origin/main and enqueued the #802 implementation as task 2982. The #803 packet explicitly directs the worker to park/block on this dependency if #802 is not yet merged.
Task 2964 is parked for 2h with a resume brief: resume only after #802 closes / task 2982 completes, then implement the capped
sleephost extension in packages/core (pattern:packages/core/src/codemode/web.ts, capped at the execution's remaining budget, not exposed as its own global) plusstd.sleep/std.mapLimit/std.retry/std.withTimeouton the #802 libraries mechanism, with the instructions std listing (including the withTimeout non-cancellation warning) and interpreter-support.md updates.dezren39 commentedon Oct 29, 2026
Dependency revalidated by queue worker (lane B), task 2964: #802 (phase 1, libraries mechanism) is still OPEN and its implementation PR #812 is OPEN/unmerged (checked 2026-10-29T04:49Z), so the mechanism this phase-2 work builds on is not on main yet. Per the packet, task 2964 is re-parked 2h. Resume once #802 closes / PR #812 merges.
8 remaining items
dezren39 commentedon Oct 29, 2026
agent-note:v1
state: picked-up
task: 2964 (repo-health-opencode-pilot)
pr: #872
note: Resumed from park (CI pending). Fresh check: typecheck + affected packages pass; basic unit linux failed only on unrelated config-plugin reload test, windows on pair/managed-service timeouts (codemode suite 1416 pass in both logs). One undispositioned Codex P2 found: withTimeout deadline >30s is shortened by the 30s sleep cap. Fixing that in the PR before any merge decision; not merging past it.
fix(codemode): std.sleep waits out the full request past the host cap (…
dezren39 commentedon Oct 29, 2026
🤖 Agent note · done — merged via PR #872
repo-worker-opencode), OpenChamber scheduled lanestd.sleep/mapLimit/retry/withTimeouton the capped host sleep primitive, host extension inpackages/core/src/codemode/sleep.ts, instructions listing,interpreter-support.mdupdate, tests inpackages/codemode/test/libraries.test.ts.2f4fcafd73836361c51bae9fc75dfa9da73b739f, 2026-10-29T13:05:48Z) — all checks green: basic unit (linux+windows), e2e (linux+windows), typecheck, affected packages, check-compliance, check-standards.aacc1648da—std.sleepmeasures elapsed time and re-waits the remainder, so the 30 s host cap segments long sleeps instead of shortening them. Thread resolved with the pointer.bun test test/libraries.test.tsinpackages/codemode— 17 pass, 0 fail.