GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Workflows rolling follow-up: dev sync, audit round 2, Deep Research example by mguttmann · Pull Request #2 · VasyaYovbak/opencode

Conversation

@mguttmann

@mguttmann mguttmann commented Jun 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Hi @VasyaYovbak — following up on #1 (thanks for the quick merge! 🎉).

This rolling PR delivers a dev sync + a full second-round audit of the merged workflow feature. Every box below is green on the full gates (typechecks for opencode/core/plugin/sdk, the complete packages/opencode suite, and the httpapi exercise gate in all three modes).

Roadmap

  • dev sync — merged the latest commits from anomalyco dev twice (incl. the core protocol refactors and the fff search tools), conflict-free / reconciled.
  • Adversarial audit, round 2 — fresh full audit of the merged state (engine, tool, HTTP, TUI dashboard, tests, docs). Confirmed findings fixed below.
  • Built-in "Deep Research" example workflow — your suggestion; shipped in round 3 below.
  • pause/resume — shipped in round 3 below (per-agent journal replay; per-agent re-run covers the retry case).

What the round-2 audit fixed

Correctness / safety

  • Discovery no longer executes module code — workflow listing/autocomplete now extracts meta via a static AST reader instead of importing each file. Removes arbitrary code execution at discovery time (and a 1s-dashboard re-import loop).
  • Hardened discovery — symlink boundary, temp-file cleanup, project-over-global precedence, workflow-name sanitization (no permission-pattern injection).
  • Cancel is correct — cancel/remove are race-free across detached agent fibers; cancel no longer returns 404 when it loses the race against a run's own natural completion; foreground tool honors ctx.abort.
  • Terminal-state integrity — terminal runs close every agent node (no zombie running agents), orphan sweep normalizes zombie nodes, null results survive persistence distinctly, and snapshot() is a total defensive projection (JSON-normalized results, severed agent-token aliasing — can't crash finish or leak live engine state).
  • Workspace scoping — runs are scoped to their workspace directory (no cross-directory read/cancel/delete).

Security

  • create honors the workflow permission (was only asking edit); denial blocks the file write; validation is static (no import of the just-written module).
  • Workflow subagents inherit parent permissions — deny + external_directory rules and Plan-Mode edit restriction now propagate to ctx.agent child sessions (regression of Subagents Bypass Plan Mode READ-ONLY Restrictions anomalyco/opencode#26514). (behavior change)
  • TUI starts route permission prompts to the active session.

Contracts

  • HTTP 404 convention — get/cancel/start return 404 for unknown runs/workflows (was 200+null / 400); SDK + OpenAPI regenerated. (behavior change)
  • Declared argument types & defaults enforced at the engine boundary — "42"→42, "true"→true, empty/non-finite/unconvertible → error, declared defaults coerced; applies uniformly to HTTP/Tool/TUI. (behavior change)
  • Budget counts all subagent turns — per-agent cost/tokens (and budget enforcement) sum every assistant turn, not just the last message. (behavior change)
  • Finite time fields (no NaN-string variants) in the SDK for log/agent timestamps.

TUI dashboard

  • Stable selection by run id, delete confirmation, cancelled status glyph, honest inline widget for failed/cancelled/interrupted, rendered log section, deep-link without discovered definitions, linear (ReDoS-free) arg tokenizer, status-column width fix. (behavior change: delete asks for confirmation)

Tool

  • Robustness: malformed run-ids fail cleanly (no defect), timeout schema bounds, honest failure reporting (failed/cancelled/interrupted surface as tool errors on every path), XML-escaping of all interpolated untrusted fields, all inspect views covered.

Tests & docs

  • Engine/tool/TUI suites grew substantially (deterministic concurrency/budget/wait coverage, real multi-turn cost fakes persisting through the message table, cancel/orphan/roundtrip). Docs aligned with the audited behavior.

Every behavior-changing fix to your original code is flagged above with (behavior change) — happy to adjust or drop any of it.

Round 3: Claude Code parity (ultracode, pause/resume, deep-research, approval)

  • ultracode keyword + /ultracode session mode — the keyword anywhere in a prompt (highlighted in the input, configurable via workflows.ultracode_keyword) opts that turn into workflow orchestration: the agent authors and starts a workflow instead of working turn by turn. /ultracode toggles a session mode that plans workflows for every substantial task (understand → change → verify chains) and best-effort bumps the model to its strongest reasoning variant (restored on toggle-off/session change).
  • Run caps + pause/resume — run-wide agent concurrency cap min(16, max(2, cpus−2)) on top of per-call limits, 1,000-agent lifetime limit per run; new non-terminal paused status with p (pause/resume) and r (re-run one agent) in the dashboard, POST /workflow/run/{id}/pause, and resume via the persisted agent journal — completed agents replay from cache (cached: true, costs still charged against the budget). Because the journal lives in SQLite, resume works across app restarts. Resume sources are status-guarded (only paused/interrupted), and schema/journal drift falls back to a live run instead of defecting.
  • Bundled deep-research + direct slash commands — a built-in workflow (plan → research → verify → synthesize with adversarial claim voting and cited output; fails clearly when agents have no web tools) shipped via a new builtin discovery root (project > global > builtin). Discovered workflows now appear as direct /<name> commands, and s in the dashboard saves any run's script as a command (project or global). The builtin module loads through the global workflows dir, so it works in the compiled binary (import.meta.dir is read-only /$bunfs there — caught in review with an empirical probe).
  • Per-run approval for interactive starts — name/description/phases/args preview with Yes / Yes-always (persisted in workflows.approved) / View script / No, configurable via workflows.approval (always/first-run/never, default first-run). Tool-initiated starts keep the existing workflow permission gate.

All gates green after the round: 4 package typechecks, full packages/opencode suite (3271 pass / 0 fail), httpapi exercise 181/181 in all three modes, SDK/OpenAPI regen idempotent.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

VasyaYovbak reacted with eyes emoji
All reactions
  • 👀 1 reaction
kitlangton and others added 30 commits June 5, 2026 14:55
@kitlangton
fix(core): scope Vertex provider transforms (anomalyco#31004)
05d1104
@kitlangton
feat(core): expose session model switching (anomalyco#31011)
a57fb32
@kitlangton
fix(tui): update tool spacing before layout
c814f84
@kitlangton
fix(core): recover v2 context overflow (anomalyco#31005)
820c984
@kitlangton
fix(core): validate public session model switches (anomalyco#31012)
025e1ac
@jlongster
feat(tui): delete working copies from move dialog (anomalyco#31017)
f591bf5
@opencode-agent
chore: generate
969bb90
@jlongster
fix(tui): bootstrap new project copies (anomalyco#31019)
499a8a4
@jlongster
fix(opencode): limit generated project copy names (anomalyco#31022)
a645615
@jlongster
fix(tui): inject reminder after moving session (anomalyco#31027)
d5b2056
@rexdotsh
fix(session): respect directory filter with workspaces (anomalyco#30804)
015e79f
@arvsrn
feat(app): improve servers UI (anomalyco#30961)
e3a55db
@opencode-agent
chore: generate
93a58f5
@arvsrn
feat(app): updates to project avatar (anomalyco#30964)
24347f3
@opencode-agent
chore: generate
9ed17da
@arvsrn
feat(app): sessions list improvements (anomalyco#30941)
1fd9c77
@opencode-agent
chore: generate
3e704d0
@opencode-agent
fix(core): scope v2 prompt cache by session (anomalyco#31036)
7c6adcf
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
@adamdotdevin
fix(stats): filter market share to go
b36b859
@Hona
fix(app): increase project session limit and add scrolling (anomalyco…
f750dea
…#31035)
@kitlangton
fix(core): make V2 reads media-aware and binary-safe (anomalyco#31038)
83dca45
@opencode-agent
chore: update nix node_modules hashes
fa2b63f
@rekram1-node
feat(opencode): add search to auth logout command (anomalyco#31053)
3f0ef9b
@rekram1-node
feat(opencode): support non-interactive MCP add (anomalyco#31054)
ba57718
@kitlangton
feat(http-recorder): prepare public beta release (anomalyco#31018)
54f4974
@kitlangton
refactor(core): simplify filesystem mutation protocol (anomalyco#31059)
ceccde7
@kitlangton
refactor(core): simplify filesystem read protocol (anomalyco#31058)
147169e
@opencode-agent
chore: update nix node_modules hashes
4ac4df4
@kitlangton
refactor(core): simplify search root protocol (anomalyco#31060)
09d9cf0
@Hona
feat: desktop v2 everything WSL (anomalyco#23407)
bd7eb06
kitlangton and others added 21 commits June 6, 2026 20:54
@kitlangton
fix(core): use static tool type imports (anomalyco#31170)
807c804
@kitlangton
docs(v2): update permission rule naming (anomalyco#31167)
12acb9a
@kitlangton
fix(core): isolate image normalization (anomalyco#31165)
10d1e04
@kitlangton
fix(test): release Windows search handles (anomalyco#31172)
48c26fa
@kitlangton
fix(core): harden unified tool runtime (anomalyco#31171)
eb9a683
@kitlangton
test(core): cover managed output read permissions (anomalyco#31166)
1025540
@kitlangton
fix(core): preserve session failure causes
53ff1b5
@thdxr
refactor(server): canonicalize service API (anomalyco#31049)
fe0c4f8
@opencode-agent
chore: generate
155e1f2
@opencode-agent
chore: update nix node_modules hashes
31c099b
@robertDouglass @opencode-agent @rekram1-node
fix(tui): sort connect providers alphabetically (anomalyco#30891)
f20655b
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
@Hona
feat(desktop): make updates persistent and responsive (anomalyco#31191)
9b4d5b0
@opencode-agent
chore: generate
7a2c49e
@thdxr
refactor(tui): extract standalone package (anomalyco#31193)
106f8e9
@opencode-agent
chore: generate
21a644f
@opencode-agent
chore: update nix node_modules hashes
f240497
@Hona
fix(app): refresh directory MCP status (anomalyco#31194)
a29deb1
@Hona
feat(desktop): open attachments in active project (anomalyco#31192)
2181472
@opencode-agent
chore: generate
472b331
@Hona
fix(desktop): style home session scrollbar (anomalyco#31202)
2006259
Claude Agent @claude
fix(opencode): builtin workflow sources are self-contained — no imports
559402e
The deep-research builtin imported `@opencode-ai/plugin`. Its source is
materialized as a temp module under the global workflows directory, so that
bare specifier resolved through `<config>/node_modules` — the PUBLISHED plugin
package that config.ts installs there, never a dev workspace checkout. In local
development the builtin would only load after manually linking the workspace
plugin into the global config dir (reported on PR anomalyco#2).

Ship the source in the wrapper-free `export default { meta, run }` shape
instead — exactly what the plugin's workflow() helper returns at runtime, and a
form the static MetaReader reads natively. The materialized temp module now
resolves nothing at all and loads identically in dev, in tests, and in the
compiled binary. The wrapper only ever added editor types, which a string
constant cannot benefit from anyway.

Documented as an INVARIANT in builtin.ts, enforced by a regression test (the
builtin source must not contain imports), and the test's plugin-symlink
workaround is gone. loadModule keeps writing to the global workflows dir — in a
compiled binary import.meta.dir is /$bunfs/root and read-only — but no longer
depends on any node_modules above it.

131/131 workflow/meta-reader/tool tests, typecheck clean. Import-smoke-verified
from a bare directory with no node_modules in scope.

Reported by @VasyaYovbak on PR anomalyco#2.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@mguttmann

mguttmann commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Glad it boots now — thanks for confirming, and great catch on the builtin materialization nuance!

You diagnosed it exactly right: the deep-research builtin is materialized as a temp module under the global config dir, so its import { workflow } from "@opencode-ai/plugin" resolved through <config>/node_modules — the published plugin package that config.ts installs there, never your dev workspace. Hence the manual link you needed.

Fixed properly in 559402e — builtin workflow sources are now self-contained (no imports):

  • the deep-research source ships in the wrapper-free export default { meta, run } shape — exactly what workflow() returns at runtime, and a form the static meta reader supports natively
  • the materialized temp module therefore resolves nothing at all and loads identically in a dev workspace, in tests, and in the compiled binary (smoke-verified by importing it from a bare directory with no node_modules in scope)
  • documented as an invariant in builtin.ts and enforced by a regression test (a builtin source containing an import now fails the suite); the test's plugin-symlink workaround is gone too

So after pulling 559402e you can remove your manual @opencode-ai/plugin link — it's no longer needed. User-authored workflows in the project/global dirs are unaffected: those still resolve imports from their own location, which is the expected behavior there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Claude Agent @claude
merge: origin/dev — TUI package extraction; workflow TUI migrated to …
bddf3fe
…packages/tui

Sync onto upstream dev (2006259). The dominant upstream change is the TUI
extraction into the new packages/tui package; the workflow feature surface
moved with it:

- dialog-workflow(+helpers), dialog-workflow-approval(+helpers), ultracode,
  and workflow-autocomplete now live in packages/tui/src/component (relative
  imports, no aliases; Clipboard.copy -> clipboard write API)
- session route: WorkflowCall adapted to the untyped ToolProps + display()
  dispatch ("workflow" added to toolDisplays); workflowMetadata kept
- prompt: ultracode submit path keeps RAW-input keyword strip with sentinel-
  protected paste spans (restored named pastedRanges; upstream part shape
  without client part ids; tui.prompt.append event API)
- app: DialogWorkflow wiring carried into the Effect-based Tui.run bootstrap
- httpapi: WorkflowApi kept alongside the renamed server Api export
- our five workflow/ultracode TUI test files moved to packages/tui/test
- SDK regenerated: openapi.json carries the 6 /workflow routes

Verified: typecheck clean (opencode + tui); 131/131 workflow/meta-reader/tool,
287 pass / 1 skip tui (incl. the 5 migrated suites), 280 pass / 2 skip server;
TUI boots under a PTY and renders the home route.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@mguttmann

mguttmann commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Synced this branch onto the latest upstream dev (bddf3fe00, upstream dev @ 2006259).

The main thing the sync involved was the TUI package extraction migration — reconciling our changes against the moved/extracted TUI package so the workflow autocomplete, dashboard, and approval-dialog components line up with the new layout.

All suites are green. Ready to merge into feat/workflows.

Numbers after the sync: typecheck clean for both packages/opencode and packages/tui; 131/131 workflow/meta-reader/tool, 287 pass / 1 skip tui (incl. the five migrated workflow/ultracode suites, now under packages/tui/test), 280 pass / 2 skip server; TUI boots under a PTY and renders the home route.

VasyaYovbak reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

VasyaYovbak
VasyaYovbak approved these changes Jun 7, 2026
View reviewed changes

@VasyaYovbak VasyaYovbak left a comment

Copy link
Copy Markdown
Owner

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@VasyaYovbak
VasyaYovbak merged commit afb6f5a into VasyaYovbak:feat/workflows Jun 7, 2026
2 of 6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mguttmann mguttmann mentioned this pull request Jun 7, 2026
feat(workflow): question/shell/nesting/isolation/events — full review-roadmap round #3
Closed
4 of 6 tasks
mguttmann added a commit that referenced this pull request Jun 14, 2026
@mguttmann @claude
fix(tui): boot crash in prompt — memo reads before initialization/com…
bbd1e92
…putation

The home route's Suspense fallback renders the Prompt eagerly, exposing three
ordering bugs that crashed boot with a fatal-error screen:

- autocomplete: the `options` memo could be read before its first computation
  ("undefined is not an object (evaluating 'options().length')"). Give it an
  initial value of [] and return [] while the menu is hidden so it never pulls
  commands()/slashes()/files() during the fallback render.
- autocomplete: `commands` referenced the `slashCommandWorkflowInfos` resource
  declared after it — a temporal-dead-zone forward reference ("Cannot access
  'slashCommandWorkflowInfos' before initialization") whenever the memo
  computes eagerly. Declare both workflow-info resources before the memo and
  gate it on visibility.
- prompt: the `ultracodeKeyword` memo read `store` declared ~50 lines later
  (same TDZ class, "Cannot access 'store' before initialization"). Declare it
  after the store.

Verified by booting the TUI under a PTY (previously: fatal-error screen; now:
the home route renders). 163/163 TUI tests pass, typecheck clean.

Reported by @VasyaYovbak on PR #2.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
mguttmann added a commit that referenced this pull request Jun 14, 2026
@mguttmann @claude
fix(opencode): builtin workflow sources are self-contained — no imports
e094862
The deep-research builtin imported `@opencode-ai/plugin`. Its source is
materialized as a temp module under the global workflows directory, so that
bare specifier resolved through `<config>/node_modules` — the PUBLISHED plugin
package that config.ts installs there, never a dev workspace checkout. In local
development the builtin would only load after manually linking the workspace
plugin into the global config dir (reported on PR #2).

Ship the source in the wrapper-free `export default { meta, run }` shape
instead — exactly what the plugin's workflow() helper returns at runtime, and a
form the static MetaReader reads natively. The materialized temp module now
resolves nothing at all and loads identically in dev, in tests, and in the
compiled binary. The wrapper only ever added editor types, which a string
constant cannot benefit from anyway.

Documented as an INVARIANT in builtin.ts, enforced by a regression test (the
builtin source must not contain imports), and the test's plugin-symlink
workaround is gone. loadModule keeps writing to the global workflows dir — in a
compiled binary import.meta.dir is /$bunfs/root and read-only — but no longer
depends on any node_modules above it.

131/131 workflow/meta-reader/tool tests, typecheck clean. Import-smoke-verified
from a bare directory with no node_modules in scope.

Reported by @VasyaYovbak on PR #2.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
mguttmann pushed a commit that referenced this pull request Jun 14, 2026
@VasyaYovbak
Merge pull request #2 from mguttmann/feat/workflows-fixes
edd6891
Workflows rolling follow-up: dev sync, audit round 2, Deep Research implemetnation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@VasyaYovbak VasyaYovbak VasyaYovbak approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:compliance needs:title

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

13 participants

@mguttmann @VasyaYovbak @kitlangton @jlongster @rexdotsh @arvsrn @adamdotdevin @Hona @rekram1-node @dmtrKovalenko @fancive @thdxr @robertDouglass
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.