Skip to content

Commit 7351fef

Browse files
seL4 Developerclaude
andcommitted
docs: link upstream OpenCode status-lag issue from both workarounds
Filed anomalyco/opencode#35472 (root cause: SessionStatus in-memory map only flips to idle via Runner.onIdle, which fires asynchronously from the prompt response stream closing). The legate_run grace poll and the legate_await stuck-busy escape now reference it so both can be deleted when fixed upstream. Closes legate-2bb. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent f64fcbf commit 7351fef

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎.beads/issues.jsonl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{"_type":"issue","id":"legate-dxw","title":"Introduce typed OpenCodeApiError; kill JSON-string error matching","description":"Handlers throw new Error(JSON.stringify(error)) and callers detect 404s via .message.includes with '\"status\":404' / 'NotFoundError' (index.ts:361, 502, 1394). Fragile against SDK serialization changes. Fix: one throw site producing class OpenCodeApiError extends Error { status?: number; name?: string; raw: unknown }, callers use instanceof + .status === 404. isNotFound(index.ts:111) collapses into the class. Prerequisite for the tool-wrapper refactor.","status":"closed","priority":2,"issue_type":"task","assignee":"seL4 Developer","owner":"[email protected]","created_at":"2026-07-05T18:37:28Z","created_by":"seL4 Developer","updated_at":"2026-07-05T18:54:54Z","started_at":"2026-07-05T18:50:16Z","closed_at":"2026-07-05T18:54:54Z","close_reason":"OpenCodeApiError with status/errorName/raw + isNotFound(); 45 throw sites converted; 3 string-match blocks replaced with instanceof; 8 new tests","dependency_count":0,"dependent_count":1,"comment_count":0}
1313
{"_type":"issue","id":"legate-muv","title":"Drop brittle exactly-40 tool-count assertions in index.test.ts","description":"Three tests hard-code the tool count at 40, so every tool addition breaks three tests whose only remedy is editing the number. Keep the valuable invariants (zero prefect_ names; every registerTool name starts with legate_) and drop the exact-count checks — or derive the expected count from the skill-card table so there is one source of truth.","status":"closed","priority":3,"issue_type":"task","assignee":"seL4 Developer","owner":"[email protected]","created_at":"2026-07-05T18:37:59Z","created_by":"seL4 Developer","updated_at":"2026-07-05T18:43:59Z","started_at":"2026-07-05T18:41:18Z","closed_at":"2026-07-05T18:43:59Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
1414
{"_type":"issue","id":"legate-xjw","title":"Add security warning to legate_inject_mcp_server tool description","description":"legate_inject_mcp_server registers an arbitrary local command that OpenCode will spawn — a privilege-escalation vector comparable to session_shell, but unlike session_shell (index.ts:1867) and get_config (index.ts:1818) its description carries no WARNING. Add one: local configType executes an arbitrary command on the OpenCode host; only inject servers you trust.","status":"closed","priority":3,"issue_type":"task","assignee":"seL4 Developer","owner":"[email protected]","created_at":"2026-07-05T18:37:57Z","created_by":"seL4 Developer","updated_at":"2026-07-05T18:43:58Z","started_at":"2026-07-05T18:41:17Z","closed_at":"2026-07-05T18:43:58Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
15-
{"_type":"issue","id":"legate-2bb","title":"File upstream OpenCode issue for status-map lag; link from legate_run grace poll","description":"index.ts:334-345 adds an up-to-2s post-completion poll (8 extra HTTP calls per run) to paper over OpenCode status-map lag after stream close. File an upstream issue against opencode, add the link in the comment so the workaround can be deleted when fixed. Same underlying bug motivates the legate_await stale-busy escape — reference both sites.","notes":"Draft ready at scratchpad/opencode-status-lag-issue.md. Upstream repo confirmed: anomalyco/opencode (sst/opencode redirects). Root cause traced: packages/opencode/src/session/status.ts in-memory map; idle written by Runner.onIdle async of HTTP stream close. Related: issues 32506, 27907, 17657; unmerged PR 14222 attempted same fix. AWAITING MAINTAINER: file the issue, then link URL in comments at the legate_run grace poll and legate_await stale-busy sites.","status":"in_progress","priority":3,"issue_type":"task","assignee":"seL4 Developer","owner":"[email protected]","created_at":"2026-07-05T18:37:55Z","created_by":"seL4 Developer","updated_at":"2026-07-05T18:55:51Z","started_at":"2026-07-05T18:50:19Z","dependency_count":0,"dependent_count":0,"comment_count":0}
15+
{"_type":"issue","id":"legate-2bb","title":"File upstream OpenCode issue for status-map lag; link from legate_run grace poll","description":"index.ts:334-345 adds an up-to-2s post-completion poll (8 extra HTTP calls per run) to paper over OpenCode status-map lag after stream close. File an upstream issue against opencode, add the link in the comment so the workaround can be deleted when fixed. Same underlying bug motivates the legate_await stale-busy escape — reference both sites.","notes":"Draft ready at scratchpad/opencode-status-lag-issue.md. Upstream repo confirmed: anomalyco/opencode (sst/opencode redirects). Root cause traced: packages/opencode/src/session/status.ts in-memory map; idle written by Runner.onIdle async of HTTP stream close. Related: issues 32506, 27907, 17657; unmerged PR 14222 attempted same fix. AWAITING MAINTAINER: file the issue, then link URL in comments at the legate_run grace poll and legate_await stale-busy sites.","status":"closed","priority":3,"issue_type":"task","assignee":"seL4 Developer","owner":"[email protected]","created_at":"2026-07-05T18:37:55Z","created_by":"seL4 Developer","updated_at":"2026-07-05T20:43:30Z","started_at":"2026-07-05T18:50:19Z","closed_at":"2026-07-05T20:43:30Z","close_reason":"Filed https://github.com/anomalyco/opencode/issues/35472 with root-cause analysis and prior-art links; both workaround sites now reference it","dependency_count":0,"dependent_count":0,"comment_count":0}
1616
{"_type":"issue","id":"legate-x9c","title":"Pin hono override — high-severity transitive advisory via @opencode-ai/sdk","description":"npm audit reports one pre-existing high-severity advisory in hono, pulled in transitively by @opencode-ai/sdk 1.14.25. package.json already uses the overrides field for ip-address and express-rate-limit — add a hono override to a patched version, or bump @opencode-ai/sdk (latest 1.17.13, needs compat testing against the 40-tool contract / mcp-smoke test). Found during legate-as1.","status":"closed","priority":4,"issue_type":"task","owner":"[email protected]","created_at":"2026-07-05T19:53:44Z","created_by":"seL4 Developer","updated_at":"2026-07-05T19:58:48Z","closed_at":"2026-07-05T19:58:48Z","close_reason":"npm audit fix bumped hono to 4.12.27; 0 vulnerabilities; full suite incl. mcp-smoke green","dependency_count":0,"dependent_count":0,"comment_count":0}
1717
{"_type":"issue","id":"legate-s4b","title":"postinstall fails on fresh-clone npm ci (build/cli.js does not exist yet)","description":"Verified empirically while adding CI: a plain npm ci on a fresh clone exits non-zero because postinstall runs node ./build/cli.js install-command before tsc has produced build/. Published-tarball installs are unaffected (build/ ships in files array); only contributors and CI hit it. CI works around it with --ignore-scripts. Consider making postinstall resilient: node -e guard on existsSync(build/cli.js) or a || exit 0 wrapper, so a source checkout installs cleanly.","status":"closed","priority":4,"issue_type":"bug","owner":"[email protected]","created_at":"2026-07-05T18:44:02Z","created_by":"seL4 Developer","updated_at":"2026-07-05T19:57:09Z","closed_at":"2026-07-05T19:57:09Z","close_reason":"scripts/lifecycle.cjs guard: postinstall/preuninstall skip cleanly when build/cli.js absent; verified plain npm ci on fresh clone now succeeds","dependency_count":0,"dependent_count":0,"comment_count":0}
1818
{"_type":"issue","id":"legate-as1","title":"Add ESLint + Prettier config","description":"No lint or format config in the repo. Add a minimal flat-config ESLint (typescript-eslint recommended) and Prettier, wire npm run lint, include in CI after the CI issue lands. Low urgency — codebase style is currently consistent by hand.","status":"closed","priority":4,"issue_type":"task","assignee":"seL4 Developer","owner":"[email protected]","created_at":"2026-07-05T18:38:02Z","created_by":"seL4 Developer","updated_at":"2026-07-05T19:53:40Z","started_at":"2026-07-05T19:41:53Z","closed_at":"2026-07-05T19:53:40Z","close_reason":"Flat ESLint config (ts-eslint recommended + prettier-compat), lint CI job, real fixes: no-fallthrough breaks, cause-preserving rethrow in registry.ts; prettier shipped for editors, not CI-gated (would reflow 25 files)","dependencies":[{"issue_id":"legate-as1","depends_on_id":"legate-sea","type":"blocks","created_at":"2026-07-05T14:38:20Z","created_by":"seL4 Developer","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0}

‎src/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ server.registerTool(
411411
// Grace delay: OpenCode's status map updates asynchronously after the stream closes.
412412
// Poll for up to 2s so that a legate_session_status call immediately after legate_run
413413
// returns sees idle rather than a stale busy.
414+
// Upstream bug: https://github.com/anomalyco/opencode/issues/35472 — delete this
415+
// workaround once fixed upstream and the SDK is bumped past the fix.
414416
try {
415417
const graceDeadline = Date.now() + 2000;
416418
while (Date.now() < graceDeadline) {
@@ -1159,6 +1161,8 @@ server.registerTool(
11591161
// cross-check against message history. If the last message is a COMPLETED assistant
11601162
// message the agent has finished but OpenCode's status map has not caught up — break
11611163
// and treat as idle.
1164+
// Upstream bug: https://github.com/anomalyco/opencode/issues/35472 — remove this
1165+
// escape once fixed upstream and the SDK is bumped past the fix.
11621166
// legate-tia: role === 'assistant' alone is NOT sufficient — OpenCode creates the
11631167
// assistant message row (role set, zero parts) the instant the prompt is accepted,
11641168
// so any task busy >10s would match and legate_await would return empty/partial

0 commit comments

Comments
 (0)