Skip to content

integration(v2): compose issue 132 stack for research migration - #144

Closed
kjgbot wants to merge 42 commits into
feat/v2-direct-inputfrom
feat/v2-research-migration
Closed

kjgbot wants to merge 42 commits into
feat/v2-direct-inputfrom
feat/v2-research-migration

Conversation

@kjgbot

@kjgbot kjgbot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Draft integration branch for issue #132, based on repaired #140. Exact product head: 9404a4e00026c081b85f86215e5bd94f766d5f2b.

This is a staged integration checkpoint, not an issue-closure claim. The branch has exact ancestry for #133 54361d7e0cbf5affa819395f61cdbf3295fd443f, repaired #134 5f2c0b9a22a7cab916980d49b5992f3cab041761, repaired #138 e164e4239b0aa9e8b2dd58ed126263d206ad29d0, repaired #139 e6210a2fc666df6dc8c777c009712ddf99efa877, and #140 0987e3830584d6efc3c784a7d32a98d5d660a256. #136 has not published its repaired head, and #137 78812c31d3a4e54bebd9d3e37054af14df61fc68 remains outside while its alias P1 is re-driven.

Literal ancestry at 9404a4e

refs/remotes/pr/133 54361d7e0cbf5affa819395f61cdbf3295fd443f included
refs/remotes/pr/134 5f2c0b9a22a7cab916980d49b5992f3cab041761 included
refs/remotes/pr/136 3f129ba1ef955252c1a71efff0473384b6a47370 MISSING
refs/remotes/pr/137 78812c31d3a4e54bebd9d3e37054af14df61fc68 MISSING
refs/remotes/pr/138 e164e4239b0aa9e8b2dd58ed126263d206ad29d0 included
refs/remotes/pr/139 e6210a2fc666df6dc8c777c009712ddf99efa877 included
refs/remotes/pr/140 0987e3830584d6efc3c784a7d32a98d5d660a256 included

Current blockers

  • The authoritative examples/research/research.flow.ts source is not reachable: research-flow is absent from remote refs and the local refs/worktrees/reflogs/unreachable objects and agent caches contain no source SHA. This PR does not fabricate a replacement.
  • feat(sdk): declare agent CLI and model with fail-closed checks #136 must publish a repaired head. kernel: dispatch runnable steps in parallel #137 must clear the re-driven alias P1 before its live head is integrated.
  • The full integrated SDK test set is red because inherited gates encode incompatible cross-PR expectations. An independent gate owner is assigned on a separate gate branch; the product integration owner does not edit those judging gates.
  • Final acceptance still requires the authoritative research source (or a verifiably recovered equivalent), typed parsed lane gates, the shipped @relayflows/surface package without local declarations, direct inline/file --input, three production-dispatched concurrent lanes, terminal completionReason plus journal evidence, and unchanged v1 default/support.

Verified at the current checkpoint

$ bun run --cwd surface build && bun run --cwd surface test
Test Files  1 passed (1)
Tests  7 passed (7)

$ cd sdk && ./node_modules/.bin/tsc --noEmit --pretty false && ./node_modules/.bin/tsc -p tsconfig.type-tests.json --pretty false && ./node_modules/.bin/tsc -p tsconfig.tests.json --pretty false && ./node_modules/.bin/vitest run tests/authored-flow.test.ts tests/direct-input.test.ts tests/gate-contract.test.ts tests/spec-parity.test.ts tests/validate.test.ts --reporter=dot --maxWorkers=1 --minWorkers=1
Test Files  5 passed (5)
Tests  92 passed (92)

$ node sdk/dist/cli.js run sdk/tests/fixtures/direct-input.flow.ts --input /tmp/flows-pr144-input-9404a4e.json --data-dir /tmp/flows-pr144-9404a4e.RZWT5w
RUN 01M1HX713Y36NPDCBQFSZT243H completed (2 steps) completionReason: success
CLI_EXIT=0
FLOW_OUTPUT=journal-backed-file-input-9404a4e

$ node sdk/dist/cli.js run testdata/hello-deterministic.flow.yaml --data-dir /tmp/flows-pr144-v1-9404a4e.VHfLCx
RUN 01M1HX7E7D7DS8MT68907FTK6R completed (2 steps) completionReason: success
CLI_EXIT=0

The repaired #134 operation lifecycle and unforgeable handle provenance are present, #138 dependency diagnostics are bounded, #139 hostile public inputs fail closed, and #140 typed input continues into the journal-backed authored body.

The full non-live SDK run is not green and is not represented as green:

$ cd sdk && ./node_modules/.bin/vitest run --exclude tests/live-kernel.test.ts
Test Files  3 failed | 21 passed | 1 skipped (25)
Tests  38 failed | 348 passed | 3 skipped (389)

Do not merge while this PR is draft.

kjgbot added 30 commits September 2, 2026 16:14
Add generic JSON output schemas to llm and agent StepSpec authoring. Compile output declarations into the existing kernel verification.json_schema primitive, reject ambiguous or malformed declarations before submission, and keep the kernel vocabulary unchanged.

Pin both sides of persistence: valid agent JSON is journaled as the parsed value, while a schema mismatch journals null plus a failed json_schema verdict. Migrate the hn-monitor authoring YAML to the new sugar without changing its canonical kernel step.

Refs #132

Session-Id: 01a06263-743a-7370-bf22-58d2512c5eee
Session-Id: 01a060b1-3228-74b1-806b-f4a3393d6b37
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062cc-f525-7d01-932e-a634815114c1
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51

Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51
Session-Id: 01a062df-0cdf-7f23-89dd-121aa9ecf743
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062cc-f525-7d01-932e-a634815114c1
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062df-0cdf-7f23-89dd-121aa9ecf743
Session-Id: 01a062df-0cdf-7f23-89dd-121aa9ecf743
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062cc-f525-7d01-932e-a634815114c1
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51

Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51

Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51

Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51
Session-Id: 01a062b4-562d-7143-9296-dd34cc65251f

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
# Conflicts:
#	.github/workflows/cloud-runtime-artifact.yml

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062b7-2aef-7772-8225-7cb00ee311dd
Session-Id: 01a062df-0cdf-7f23-89dd-121aa9ecf743
# Conflicts:
#	sdk/src/compile.ts
#	sdk/src/validate.ts

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
kjgbot added 7 commits September 2, 2026 21:10
# Conflicts:
#	sdk/src/cli/check.ts
#	sdk/src/validate.ts

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
Session-Id: 01a062df-0cdf-7f23-89dd-121aa9ecf743
Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@kjgbot

kjgbot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Integration evidence at exact head b65b8d9cdc9884a66cf97342c30ed80c35da18ae (no research completion claim).

Source recovery commands/output:

$ git for-each-ref --format="%(refname) %(objectname)" refs/heads refs/remotes refs/worktree | rg "research-flow|examples/research" || echo "NO_MATCH refs"
NO_MATCH refs
$ git worktree list --porcelain | rg -C 2 "research-flow|examples/research" || echo "NO_MATCH worktrees"
NO_MATCH worktrees
$ git reflog --all --format="%H %gs" | rg "research-flow|examples/research" || echo "NO_MATCH reflogs"
NO_MATCH reflogs
$ git ls-remote --heads origin research-flow refs/heads/research-flow
$ mdfind "kMDItemFSName == research.flow.ts"

The final two commands produced no output. Scanning every commit reported by git fsck --full --no-reflogs --unreachable --no-progress likewise produced NO_MATCH unreachable-commit-trees.

Real daemon/direct-file-input command/output:

$ node sdk/dist/cli.js run sdk/tests/fixtures/direct-input.flow.ts --input /tmp/flows-pr144-proof.pZhvnB/input.json --data-dir /tmp/flows-pr144-proof.pZhvnB/data
RUN 01M1HT7ZD1KMH07FHGA7VVZYSR completed (2 steps) completionReason: success
$ sed -n 1p /tmp/flows-pr144-proof.pZhvnB/result.txt
journal-backed-file-input
$ ./node_modules/.bin/vitest run tests/direct-input.test.ts
 ✓ tests/direct-input.test.ts (4 tests) 15325ms
 Test Files  1 passed (1)
      Tests  4 passed (4)

Production driver command/output:

$ /Users/khaliqgant/.rustup/toolchains/1.94.0-aarch64-apple-darwin/bin/cargo test --locked -p relayflowd --test parallel_driver
running 4 tests
test stop_after_one_holds_for_an_independent_deterministic_batch ... ok
test backpressured_or_mismatched_lane_does_not_drop_a_later_dispatch ... ok
test crash_boundaries_resume_the_real_driver_with_one_effect_per_lane ... ok
test pause_before_second_independent_step_holds_the_driver_boundary ... ok
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.99s

$ /Users/khaliqgant/.rustup/toolchains/1.94.0-aarch64-apple-darwin/bin/cargo test --locked -p relayflowd-core parallel
running 7 tests
test machine::parallel_tests::machine_starts_every_runnable_step_in_authored_order ... ok
test machine::parallel_tests::failed_run_drains_open_siblings_before_terminal_entry ... ok
test machine::parallel_tests::every_declared_mutable_surface_participates_in_conflict_selection ... ok
test machine::parallel_tests::crash_resume_preserves_each_parallel_lease_exactly_once ... ok
test machine::parallel_tests::parallel_lanes_do_not_cross_the_dependency_barrier_early ... ok
test machine::parallel_tests::overlapping_agent_surfaces_are_serialized_in_authored_order ... ok
test machine::parallel_tests::disjoint_agent_lanes_merge_pins_in_either_completion_order ... ok
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 27 filtered out; finished in 0.01s

Blocked acceptance remains exact: examples/research/research.flow.ts and its fixture are absent, so the required literal research command, typed lane gate, and three-lane direct-run proof cannot be executed without the authoritative source SHA/push. This draft does not fabricate them. The inherited #133/#138/#139 integration test contradictions are also awaiting an independent gate owner; this integration owner did not edit those gates.

kjgbot added 3 commits September 2, 2026 22:14
Session-Id: 01a062df-b92c-7a13-815f-147a82a4fc51
Session-Id: 01a062df-0cdf-7f23-89dd-121aa9ecf743
# Conflicts:
#	sdk/src/authored-flow-executor.ts
#	sdk/src/authored-flow.ts
#	sdk/tests/authored-flow.test.ts
#	surface/README.md
#	surface/src/flow.ts
#	surface/tests/flow.test.ts

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
@kjgbot

kjgbot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Integration checkpoint evidence for exact product head 64beb20d0773b38e9daf15e063e47c7bf8bd9135.

$ git show -s --format='HEAD=%H%nPARENTS=%P%nSUBJECT=%s' HEAD
HEAD=64beb20d0773b38e9daf15e063e47c7bf8bd9135
PARENTS=b65b8d9cdc9884a66cf97342c30ed80c35da18ae 5f2c0b9a22a7cab916980d49b5992f3cab041761
SUBJECT=merge: reconcile exact PR 134 lifecycle repair for integration

Focused reconciliation:

$ bun run --cwd surface build && bun run --cwd surface test
Test Files  1 passed (1)
Tests  7 passed (7)

$ cd sdk && ./node_modules/.bin/tsc --noEmit && ./node_modules/.bin/vitest run tests/authored-flow.test.ts tests/direct-input.test.ts
Test Files  2 passed (2)
Tests  26 passed (26)

Real direct file-input / daemon / terminal proof:

$ node dist/cli.js run tests/fixtures/direct-input.flow.ts --input /tmp/flows-pr144-input-64beb20.json --data-dir /tmp/flows-pr144-64beb20.EEXq6V
RUN 01M1HWRGW4HKF4M628QVH2109Z completed (2 steps) completionReason: success
CLI_EXIT=0
FLOW_OUTPUT=journal-backed-file-input-64beb20

$ sqlite3 -header -column /tmp/flows-pr144-64beb20.EEXq6V/runs/01M1HWRGW4HKF4M628QVH2109Z.sqlite3 "select seq, entry_type, step_id, json_extract(payload,'$.completionReason') as completionReason from entries order by seq;"
seq  entry_type            step_id     completionReason
1    run.spawned
2    step.attempt.started  complete-2
3    step.completed        complete-2  success
4    run.completed                     success

Real unchanged v1/default path:

$ node sdk/dist/cli.js run testdata/hello-deterministic.flow.yaml --data-dir /tmp/flows-pr144-v1-64beb20.W5hBVu
WARNING [unprovable_effects] Step "greet" command "echo" resolves, but its effects cannot be proven before execution.
WARNING [unprovable_effects] Step "shout" command "echo" resolves, but its effects cannot be proven before execution.
RUN 01M1HWT9GK44HGYX38GCQ54CXN completed (2 steps) completionReason: success
CLI_EXIT=0

Full integrated SDK gate is honestly red and remains delegated to an independent gate owner:

$ cd sdk && ./node_modules/.bin/vitest run --exclude tests/live-kernel.test.ts
Test Files  3 failed | 21 passed | 1 skipped (25)
Tests  34 failed | 344 passed | 3 skipped (381)

The failures are the inherited preflight throw-vs-result, #138 foreign-field vs #133 output/agent, and dependency-preflight expectation conflicts. I did not edit those judging gates. PR remains draft; missing authoritative research source and unrepaired #136/#137/#138/#139 exact heads are still blockers.

kjgbot added 2 commits September 2, 2026 22:29
# Conflicts:
#	sdk/package.json

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
# Conflicts:
#	sdk/src/validate.ts

Session-Id: 01a062de-3f73-7621-8286-72efe45639aa
@kjgbot

kjgbot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Superseding the earlier 64beb20 checkpoint: current exact product head is 9404a4e00026c081b85f86215e5bd94f766d5f2b.

# exact ancestry
#133 54361d7e0cbf5affa819395f61cdbf3295fd443f included
#134 5f2c0b9a22a7cab916980d49b5992f3cab041761 included
#136 3f129ba1ef955252c1a71efff0473384b6a47370 MISSING
#137 78812c31d3a4e54bebd9d3e37054af14df61fc68 MISSING
#138 e164e4239b0aa9e8b2dd58ed126263d206ad29d0 included
#139 e6210a2fc666df6dc8c777c009712ddf99efa877 included
#140 0987e3830584d6efc3c784a7d32a98d5d660a256 included
$ bun run --cwd surface build && bun run --cwd surface test
Test Files  1 passed (1)
Tests  7 passed (7)

$ cd sdk && ./node_modules/.bin/tsc --noEmit --pretty false && ./node_modules/.bin/tsc -p tsconfig.type-tests.json --pretty false && ./node_modules/.bin/tsc -p tsconfig.tests.json --pretty false && ./node_modules/.bin/vitest run tests/authored-flow.test.ts tests/direct-input.test.ts tests/gate-contract.test.ts tests/spec-parity.test.ts tests/validate.test.ts --reporter=dot --maxWorkers=1 --minWorkers=1
Test Files  5 passed (5)
Tests  92 passed (92)

$ node sdk/dist/cli.js run sdk/tests/fixtures/direct-input.flow.ts --input /tmp/flows-pr144-input-9404a4e.json --data-dir /tmp/flows-pr144-9404a4e.RZWT5w
RUN 01M1HX713Y36NPDCBQFSZT243H completed (2 steps) completionReason: success
CLI_EXIT=0
FLOW_OUTPUT=journal-backed-file-input-9404a4e

$ cd sdk && ./node_modules/.bin/vitest run --exclude tests/live-kernel.test.ts
Test Files  3 failed | 21 passed | 1 skipped (25)
Tests  38 failed | 348 passed | 3 skipped (389)

The red full-suite result is the independent gate reconciliation scope; it is not hidden or claimed green. Hosted exact-head checks: packed-consumer pass, linux-x64-artifact pass; CodeRabbit skipped because the PR remains draft.

@kjgbot
kjgbot force-pushed the feat/v2-direct-input branch from 0987e38 to 6384600 Compare September 3, 2026 10:39
kjgbot pushed a commit that referenced this pull request Sep 4, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR

Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1

Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1
@kjgbot

kjgbot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Do not rebase this. Its purpose has been overtaken, and merging it as-is would revert main.

This PR composed the #132 stack so the pieces could be integrated together. Every constituent has now landed on main independently — #134, #136, #137, #138, #139, plus #151/#152/#153/#154/#158/#159. So the composition is already done, in main, commit by commit.

What is left here is a branch whose tree is behind the thing it was composing.

The numbers

$ git diff --stat origin/main origin/feat/v2-research-migration
169 files changed, 2696 insertions(+), 21189 deletions(-)

$ git diff --name-status origin/main origin/feat/v2-research-migration | awk '{print $1}' | sort | uniq -c
  10 A
  70 D
  89 M

21,189 deletions against 2,696 insertions, and 70 files that exist on main are absent here — including things that landed hours ago, e.g. testdata/json-schema-bound-cases.json (768 lines, came in with #139) and testdata/tick-heartbeat.*.

Merging this would delete them. Rebasing its 47 commits would replay work already in main and invite exactly the silent-revert class we have been bitten by repeatedly on this stack: a branch that moved or dropped something upstream later changed merges clean and takes the upstream change out with it, with no conflict marker.

What is genuinely unique here, and worth keeping

Ten files main does not have. Three are review notes for #140; the substantive seven are a direct-input / direct-run feature:

sdk/src/direct-input.ts
sdk/src/cli/direct-run.ts
sdk/src/authored-flow-loader.ts
sdk/tests/direct-input.test.ts
sdk/tests/fixtures/direct-input.flow.ts
sdk/tests/fixtures/direct-output-control.flow.ts
sdk/tests/fixtures/pre-journal-side-effect.flow.ts

That is real work and it is not on main.

Recommendation

Close this PR and open a fresh, small one that adds only those seven files on top of current main (f1314b1). It would be reviewable on its own terms — a feature PR rather than a 47-commit integration branch — and it carries none of the revert risk.

I have not done that: deciding whether the direct-input work ships now, and under what shape, is a scope call rather than a mechanical rebase, and this PR's stated purpose no longer exists. Happy to extract it on request.

The CONFLICTING status here is therefore not something to fix. It is the correct signal that the branch has been superseded.

kjgbot pushed a commit that referenced this pull request Sep 4, 2026
… extracting

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR

Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1

Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1
@kjgbot

kjgbot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded, not abandoned.

This PR existed to compose the #132 stack. Every constituent has since landed on main independently — #134, #136, #137, #138, #139, plus #151–#154 and #158/#159 — so the composition is done, commit by commit, in main.

What remains here is a branch whose tree is behind the thing it was composing:

169 files changed, 2696 insertions(+), 21189 deletions(-)
  10 A   70 D   89 M

70 files that exist on main are absent here, including testdata/json-schema-bound-cases.json (768 lines, landed with #139). Merging would delete them. Its CI is green only because green means "this tree's tests pass", not "this tree is current".

Rebasing its 47 commits would replay work already in main while inviting the silent-revert failure this stack has hit repeatedly: a branch that moved or dropped something upstream later changed merges clean and takes the upstream change out with it, no conflict marker.

The unique work is not lost. Ten files here are not on main; the substantive ones are the direct-input / direct-run feature:

sdk/src/direct-input.ts
sdk/src/cli/direct-run.ts
sdk/src/authored-flow-loader.ts
sdk/tests/direct-input.test.ts
+ 3 fixtures

That is #140's subject, and #140 is still open. So the right home for it is a rebase of #140 onto current main, not a 47-commit integration branch.

Reopen if you disagree — but as it stands merging this would undo several hours of merged work.

@kjgbot kjgbot closed this Sep 4, 2026
kjgbot pushed a commit that referenced this pull request Sep 4, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR

Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1

Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant