Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d233a0c
feat(opencode): target OpenCode v2 in Flow 10
vriesdcrv Oct 24, 2026
25a8378
fix(opencode): preserve logical completion and native failure evidence
vriesdcrv Oct 24, 2026
58ef483
chore(ci): integrate reviewed action updates and delivery order
vriesdcrv Oct 24, 2026
fc5495b
test(validation): cover native session-relative workdirs
vriesdcrv Oct 24, 2026
1027988
fix(validation): compare exact session-relative shell directories
vriesdcrv Oct 24, 2026
f2782cd
test(opencode): expose retained request snapshot lifetimes
vriesdcrv Oct 24, 2026
22b4230
fix(opencode): release superseded execution snapshots
vriesdcrv Oct 24, 2026
b37ad88
test(opencode): cover unregistered native execution paths
vriesdcrv Oct 24, 2026
3c02066
fix(opencode): isolate native turns from Flow authority
vriesdcrv Oct 24, 2026
70e7184
test(opencode): project terminal events into native idle records
vriesdcrv Oct 24, 2026
3a04a9f
test(opencode): preserve running turns across queued prompts
vriesdcrv Oct 25, 2026
c38dc14
fix(opencode): defer queued authority until native consumption
vriesdcrv Oct 25, 2026
3a51aba
test(opencode): expose failed validation capture to the model
vriesdcrv Oct 25, 2026
0228d8a
fix(opencode): surface validation capture failures
vriesdcrv Oct 25, 2026
7198573
test(opencode): reproduce failed reservation blocking queued turns
vriesdcrv Oct 25, 2026
4035632
fix(opencode): recover checked inputs after failed reservations
vriesdcrv Oct 25, 2026
b7a9179
chore(release): qualify Flow 10.0.0 on OpenAI only
vriesdcrv Oct 25, 2026
e026475
chore(ci): run release checks on Node 26
vriesdcrv Oct 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
396 changes: 396 additions & 0 deletions .agents/plans/18-opencode-v2/README.md

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions .agents/plans/18-opencode-v2/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Native v2 host boundary

The selected design uses a process-local primary request snapshot for each
native session, an admission registry, and immutable assistant bindings.
It does not reconstruct authority from the latest transcript user or the
arrival order of asynchronous events.

The context hook captures consumed input IDs before the model request. Tool
execution verifies the exact native session, assistant, agent, call, workspace,
and consumed-input prefix. A later input cannot relabel an earlier assistant.
The prompt hook can revoke old authority. Positive authority requires an exact
accepted admission joined to the private dispatch and its live epoch.

Automatic compaction has its own checked control identity. The causal
compaction hook reads the native running automatic-compaction record. Resume
requires that same record to be completed and the same epoch to remain live.
The model-facing checkpoint uses a user role but grants no new user authority.

## Selection and proof

The independent Grok 4.7 cross-judge selected the request snapshot over the
larger event ledger. Its initial findings required more steering and compaction
proof. The later native probe extension supplies those observations. The parent
reran the original 49 receipt assertions and the 44-assertion live extension.
The extension passed all four cases. These counts describe bounded probe
assertions, not release qualification or provider coverage.

The cross-judge also corrected a duplicate-admission timestamp claim in the
earlier design. Duplicate identity is the input ID and payload. Timestamps and
hook invocation counts are not admission identity.

Retained compact receipts are `probe-verification.json` and
`probe-extension-verification.json`. The rerunnable probe lives in
`probes/server/`. Run `python3 probes/server/bootstrap.py --exe <exact-host>`.
It copies its owned fixtures into `/tmp/flow-v2-server-probe` and keeps all
host state there. The executable must report OpenCode 2.1.4. The default path
names the isolated Darwin executable used in this session. Linux remains a
separate verification gate.

## Concurrent ownership

- The server owner ports registration, role transforms, tools, session guards,
validation capture, and composition.
- The continuation owner ports command handling, request attribution, native
hooks, compaction, and continuation policy integration.
- The picker owner ports the terminal and server-owned model preferences.
- The evaluation owner ports host transport, identity observations, metadata
probes, experimental evaluation plugins, and packed live smoke.
- The canary owner ports preparation, budgeted launch, and native evidence.
- The parent owns package metadata, release policy, workflows, public docs,
the wiki draft, integration, authoritative checks, and external writes.

Writers share the integration checkout with exclusive file ownership.
The parent runs complete checks after their changes converge.

## Remaining product gates

Probe success does not certify the integrated Flow package. Runtime tests must
exercise the actual packed candidate, its role permissions, source-bound
validation, reviewer child, automatic continuation, and model picker.

No matching terminal live-control skill was installed. The native computer-use
attempt returned `Computer Use is not allowed to use the app 'com.apple.Terminal'
for safety reasons.` That restriction remains in effect. PTY receipts establish
terminal input and returned values. Visual review remains open.

Paid qualification requires a concrete approved dispatch proposal. Publication
requires the prepared exact candidate and the repository's final approval gate.

## Selected native account source

The user chose existing OpenCode 2 accounts. Metadata inspection found saved
OAuth connections for OpenAI and xAI. The authenticated background service
reports 2.1.4. No real credential values or refresh tokens were exported.

A private export bank was rejected. Native import skips an existing credential
ID, and native create returns a conflict. A cloned OAuth refresh could therefore
leave the original account stale. The key-only research helper is not adopted.

The selected design keeps refresh in the existing native service. A temporary
project plugin resolves only approved active connections and replaces the
original refresh value with a placeholder before returning data. A private local
relay connects that authenticated native RPC to the isolated test host. The
child overrides only the selected OAuth method and delegates its refresh to the
source. The original refresh token never enters the child. Broker requests and
host leases are serialized. Account switches or source failures are refused.

The synthetic two-host prototype persisted source rotation, preserved identity
and unrelated accounts, sent the correct bearer to a loopback model, and failed
before another model request when the source was unavailable. Its proof is
`/tmp/flow-v2-native-auth-probe/report.md`. Production integration passed native
bootstrap and shutdown proof with no model generations at
`/tmp/flow-v2-eval-auth-integration/verification.json`. Synthetic private Linux
forwarding passed separately. Actual provider qualification and independent
account-helper review remain open.
No real source-service plugin or account state has changed.
52 changes: 52 additions & 0 deletions .agents/plans/18-opencode-v2/baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"sourceSha": "8103f1cd42e1b4d111f25d2a311935d4e41fb997",
"bunVersion": "1.4.0",
"isolatedBun": "/tmp/flow-v2-toolchain/node_modules/.bin/bun",
"install": {
"command": "bun install --frozen-lockfile",
"exitCode": 0
},
"oldHostPackedSmoke": {
"command": "PATH=/tmp/flow-v2-toolchain/node_modules/.bin:$PATH bun run smoke:live",
"host": "1.18.31",
"pass": 22,
"fail": 0,
"log": "/tmp/flow-v2-baseline-smoke-pinned.log"
},
"deterministicCheck": {
"command": "PATH=/tmp/flow-v2-toolchain/node_modules/.bin:$PATH bun run check",
"status": "failed",
"log": "/tmp/flow-v2-baseline-check-pinned.log",
"observedFailure": "Two macOS temporary path aliases in materialize-qualification.test.ts and canary-run.test.ts",
"passCount": 4275,
"skipCount": 21,
"failCount": 2
},
"fixtureCorrection": {
"file": "tests/materialize-qualification.test.ts",
"command": "PATH=/tmp/flow-v2-toolchain/node_modules/.bin:$PATH bun test tests/materialize-qualification.test.ts",
"pass": 21,
"fail": 0,
"log": "/tmp/flow-v2-materialize-test.log",
"files": [
"tests/materialize-qualification.test.ts",
"tests/canary-run.test.ts"
],
"focusedPassCount": 25,
"focusedFailCount": 0
},
"correctedCheck": {
"status": "passed",
"log": "/tmp/flow-v2-baseline-check-fixed.log",
"passCount": 4277,
"skipCount": 21,
"failCount": 0,
"totalTests": 4298
},
"replay": {
"command": "bun run replay",
"gatedCassettes": 13,
"matched": 13,
"log": "/tmp/flow-v2-baseline-replay.log"
}
}
42 changes: 42 additions & 0 deletions .agents/plans/18-opencode-v2/capture-error-reporting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Capture error reporting

Sentry discussion 4369391412 identified a real v2 reporting regression. The
completed shell could succeed while Flow capture failed, leaving the model with
only raw shell output. The host log contained the exception. No validation
receipt was fabricated.

The parent reproduced this on the exact `c38dc14e` candidate and native OpenCode
2.1.4. Plan save, approval, run start and validation arming all succeeded before
the disposable command deliberately made its own session JSON unreadable. The
shell exited zero; the next model request contained only its literal output.
The first wrong-platform setup attempt remains excluded from that proof.

The fix adds a static `[flow-validation-error]` notice to completed v2 content.
It preserves existing text or file parts, metadata and structured output.
Detailed errors remain in the existing log. The notice says no validation
receipt was produced; it does not claim a write could never partially persist.
Native error objects remain unchanged because v2 can render a nested cause
instead of an outer message. Stale null refusals and unrelated calls remain
silent. The marker grants no validation, receipt or continuation authority.

The regression was committed first as `3a51aba7`. Five visibility cases failed
before the fix while three guards passed. The same eight cases pass afterward.
The parent passed all 157 focused cases. Independent OpenAI source review and
comment review pass. The production change is 12 lines in the existing catch,
with no new production helper, state or API.

The component persistence probe uses a regular lock file and preserves sentinel
durable bytes. That differs from the intentionally corrupted native fixture,
which does not preserve a valid session document. SDK-optional absent content is
tested for field preservation only. It is not native fallback qualification.

The parent must replay the same corrected native driver on a new exact archive
and require the notice in both durable native tool content and the next model
request, with no false validation receipt. Full contribution gates precede push.
Paid qualification, merge and publication remain on hold.

Local evidence is under `/tmp/flow-v2-capture-error-20261025/`. The source review
is `source-review-r1/review.md`, the accepted native before receipt is
`parent-native/before-accepted.json`, and the unchanged before/after driver is
`parent-native/driver-corrected.ts`. Parent package and native-after evidence
retain their own identities.
29 changes: 29 additions & 0 deletions .agents/plans/18-opencode-v2/compaction-boundary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Compaction boundary synthesis

Base A is selected. The parent read both packages in full. Parent rubric scores were A 15 and B 9. The independent Grok cross-judge scored A 14 and B 10 and selected the same base. These are design judgments on six criteria, not test results. The cross-judge report and both unchanged candidates remain in their original directories.

The source-state census and exact native reload pair reject the premise that native summary completion requires a live execution origin. A single input ledger owns historical source classification, private readiness, local input reservations, and the admission frontier. A compaction boundary owns native proof and the decision between summary-only permission and continuation. Lifecycle retains execution and policy side effects. No second transcript join, copied admission-id registry, or public lease inspection is introduced.

Use A's module and deletion plan. Move existing real candidates, accepted real origins, and private host binding into the existing admission knowledge owner. Keep InputOrigin and its revocation semantics. Historical evidence outside that owner is a discriminated ordinary or automatic fact, without a positive origin. Any originally non-null authority is historical automatic classification, including automatic=false inputs. Do not turn arbitrary errors into ordinary history. Unknown marked history after reload can summarize but cannot recover a token or satisfy checkpoint execution.

Grafts and precise requirements:

1. Reserve the local input frontier synchronously at command execute and synthetic entry, before session.get or any other await. Real prompt observation uses that same owner. The private registration links to its reservation and cannot bypass a later frontier. A failed or superseded reservation grants nothing. Interrupt advances execution lifetime and invalidates old scopes, but does not reserve a new input frontier. This is why a new ordinary manual summary after interruption can read old history without inventing a new input.
2. A scope captures exact input/lineage, lifecycle lifetime, and the local frontier. Capture rejects an old consumed source that does not cover the already reserved frontier. Every async boundary checks that same scope. New real, command, or synthetic reservations invalidate it, including same-epoch private work. Repeated callbacks for one unchanged input do not invent a new admission.
3. Scope cancellation has its own wake-up promise, separate from admission.ready. Lifetime, frontier, unload, and stream loss reject stale scope waits even when ready never settles. They do not reject a fresh admission's ready promise and do not call revoke on a fresh owner. Old finally removes only its own pending slot. A stale slot must not exclude a replacement operation before its old underlying request settles.
4. All pending private admissions wait for exact readiness before positive authority or source ownership checks. Do not inspect private lease.messageId, add an accessor for it, use current captureAuthority as a pending owner, or gate waiting on a partial-activation Boolean. Match the exact native receipt and payload under the existing admission policy. Readiness alone does not freeze a primary or grant tools.
5. One compaction parser proves exact running control, explicit reason auto/manual, full consumed/native prefix, and actual delivery. If admission readiness introduces another await after the first proof, reread and require the same native control/reason/prefix. The hook has no original control-id argument. Preserve the stated limit about correlation to an unread replaced control rather than inventing a field.
6. Manual summary of unknown or retired ordinary history is a summary-only result with no InputOrigin, authority, execution epoch, recovery renewal, guidance, primary, assistant binding, or tool grant. Do not copy the current host epoch into old provenance. Known automatic history, including revoked registrations/checkpoints, cannot fall back here. Current automatic manual refusal remains. Existing live ordinary auto/manual and live grantless plan/reviewer checkpoint behavior remains.
7. A continuation stores one checked fact and exactly one checkpoint origin. Repeated admit with equal host, control id, consumed ids and proved attributes reuses that fact and the same origin object. Completed context and retry return that object. Do not allocate compactedInputOrigin on every pure proof and compare the new object to the stored object.
8. Keep B's minimal summary-permit fence and dead-source projections. Keep classification/disposition exhaustive and pure inside the existing knowledge boundary when possible. Do not copy B's unavailable snapshot inputs, private messageBound, incomplete permission table, five public functions, or origin-identity reuse rule.
9. Keep execution failure cleanup tied to the exact still-live source. A scope's captured current lifetime is not an execution owner. Pending context, historical summary, or stale callback cannot revoke a fresh invocation. Preserve existing negative guards, genuine active-primary overlap refusal, immutable assistant/Request binding, strict marker/delivery checks, grantless completed-close origin, and no new advice/abandonment intent.

The production caller surface stays admission capture/readiness plus compaction admit/completed. PrimaryHost in A is explanatory pseudocode, not a new production forwarding class. Delete duplicated lifecycle source lookup, real/accepted maps after migration, the missing-record manual branch, isUnattributedManualSummary, and the current-authority fallback for pending ownership in the same change. Preserve exact real prompt payload matching and automatic policy.

Implementation ownership is lifecycle.ts, execution-attribution.ts, auto-compaction.ts and their lifecycle/attribution tests. auto-drive.ts, command-hook.ts, application/domain/Sessionv5, auth, Typesafe reader, preferences, harness, package, and docs stay frozen. Modules must remain below the actual 1000-line ceiling without compression. Retain the substantive src/platform/opencode/input-admission.ts module as a boundary around input knowledge. Final ownership audit shows its 509 lines and execution-attribution.ts's 454 lines could fit together below the ceiling before import deduplication. The split is therefore justified by distinct knowledge ownership, not mathematical necessity. This explicitly supersedes the earlier ceiling-dependent authorization. Its single InputAdmissions owner holds registrations, real/accepted input facts, reservations/frontier, scope cancellation, host bindings and non-authorizing lineage. ExecutionAttribution then retains primary/Request/assistant/tool identity and deletes the migrated admission methods; lifecycle calls the ledger directly. No forwarding compatibility methods or second registry remain. Record the exact module/type map before implementing it and proceed within this scope. No pass-through PrimaryHost class or formatting workaround is allowed.

Acceptance is behavioral. Preserve the original 28-row current-behavior census and provenance correction. New acceptance tests use a fresh output directory and assert interrupted ordinary manual completion, no checkpoint-only tool, no automatic lease/advice, and a later separately accepted real input reaching its own tool. Cover repeated summary lineage and automatic tombstone refusal. Adapt the pending-activation baseline into an actual barrier test and prove no early primary/request/tool, eventual success after exact acceptance, and stale scope cancellation without settling fresh ready. Cover pre-get command/synthetic reservations, same-epoch inserts during native reads, held ready on epoch/frontier/unload, stale finally, duplicate checked-control admission identity, malformed reasons, and all existing controls.

The implementation owner first proves focused tests, types/lint/architecture, the exact native failed sequence before and after, all nine prior compaction cases, marker/options cases, and both transport families with their intended stimuli actually reached. This is private source proof only. The root then builds one new candidate and runs the unchanged 119-assertion native smoke and other package gates before final source review. Moving full packed smoke ahead of the next review catches integrated regressions before another bounded source PASS. No archive is accepted merely because it was built. A source fix changes measured inputs and requires fresh canonical checks, exact-package proof, and independent review before qualification.

Actual native overlapping-context reachability and same-model auxiliary retry remain unproved. No real account, credential refresh, paid generation, Git write, package publication, or wiki publication is authorized by this synthesis. The existing user goal authorizes local implementation; paid and publication gates remain separate.
Loading
Loading