Skip to content

docs(example): add dual runtime tutorial - #96

Open
ben-ranford wants to merge 7 commits into
feat/62-session-agent-bridgefrom
feat/64-dual-runtime-tutorial
Open

ben-ranford wants to merge 7 commits into
feat/62-session-agent-bridgefrom
feat/64-dual-runtime-tutorial

Conversation

@ben-ranford

@ben-ranford ben-ranford commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a compiled local-checkout tutorial that runs one application session through real line and JSONL agent hosts.

Validation

  • printf 'inc\n' | go run ./cmd/stave-dual-runtime
  • GO=go go test -race ./examples/dualruntime -count=1
  • GO=go make ci → exit 0; log: /tmp/stave-issue64-bc629e1-make-ci.log

Release Notes

Unreleased local-checkout tutorial API and command; no published release contract changes.

Scope firewall

Only the dual-runtime tutorial command, example tests, adoption documentation, and generated inventories are changed. No transport, adapter, or framework changes.

Closes #64

@ben-ranford ben-ranford added area:core Semantic, action, state, replay, and public core contracts documentation Improvements or additions to documentation priority:p2 Normal milestone priority labels Sep 13, 2026
@ben-ranford ben-ranford self-assigned this Sep 13, 2026
@ben-ranford ben-ranford added this to the v1.1.0 milestone Sep 13, 2026
@ben-ranford
ben-ranford force-pushed the feat/64-dual-runtime-tutorial branch from bc629e1 to ca66611 Compare September 13, 2026 08:32
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 12:19
@ben-ranford
ben-ranford requested a lite review from Copilot September 13, 2026 12:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T15:53:43.875556Z 7d22f39 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca66611973

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/dualruntime/dualruntime.go Outdated
Comment thread examples/dualruntime/dualruntime.go Outdated
Comment thread examples/dualruntime/dualruntime.go Outdated
Comment thread examples/dualruntime/dualruntime.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved critical and moderate correctness issues remain in the tutorial and its tests.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds an unreleased local-checkout tutorial for running a counter application through line and JSONL agent hosts.

Changes:

  • Adds the dual-runtime tutorial application and lifecycle tests.
  • Adds the stave-dual-runtime command.
  • Updates adoption documentation and generated inventories.
File summaries
File Summary and review findings
scripts/rigor/generated/public-api.txt Updates the public API inventory.
scripts/rigor/generated/dependency-inventory.json Updates the dependency inventory.
examples/dualruntime/dualruntime.go Adds the tutorial implementation. Findings: critical (1) human input bypasses the registered action and authorization boundary; moderate (3) rendering may race event application, and the action is not idempotent; moderate (1) the reducer should match the action ID; nit (3) use typed action registration.
examples/dualruntime/dualruntime_test.go Adds runtime parity and lifecycle tests. Moderate (1): concurrent agent requests can make the sequence assertion flaky.
docs/client-adoption.md Adds adoption guidance. Nits: add source/output links (3), correct configuration guidance (2), add a changelog entry (3), link security and validation resources (1), and correct the one-session claim (1).
cmd/stave-dual-runtime/main.go Adds the tutorial command entry point.
Review details

Suppressed comments (4)

docs/client-adoption.md:27

  • This refers to security and stale-target contract tests but does not link either resource, despite the tutorial's stated requirement to direct adopters to those contracts. Link the security guide and the relevant agent target-validation tests here.
and the existing security and stale-target contract tests before adapting the

docs/client-adoption.md:21

  • This says the command shows one application session used by both hosts, but main selects exactly one branch with -agent, and the test constructs humanApp and agentApp separately. As written it only demonstrates equal hashes from two sessions; either compose both hosts around one Application/session or revise this claim and the acceptance wording.
The unreleased `examples/dualruntime` package and `stave-dual-runtime` command
show one application session used by both hosts. From a local checkout run the
human line host with `printf 'inc\n' | go run ./cmd/stave-dual-runtime`, or the
JSONL host with `printf '{"jsonrpc":"2.0","id":1,"method":"stave.initialize"}\n{"jsonrpc":"2.0","id":2,"method":"stave.initialized"}\n{"jsonrpc":"2.0","id":3,"method":"stave.action.invoke","params":{"callId":"inc","actionId":"example.increment.v1"}}\n' | go run ./cmd/stave-dual-runtime -agent`.

examples/dualruntime/dualruntime.go:57

  • This condition increments for every ActionInvoked event, regardless of ActionID; any additional action or directly submitted action event would mutate the counter. Match the payload's action ID to example.increment.v1 (and keep unrelated actions out of this reducer branch).
	if ev.Kind == event.ActionInvoked || (ev.Kind == event.Text && ev.Payload.(event.TextPayload).Text == "inc") {

examples/dualruntime/dualruntime_test.go:67

  • The agent server runs non-control requests concurrently, so the snapshot and action lines have no ordering guarantee. Because invoke enqueues ActionInvoked asynchronously, the snapshot can observe sequence 2 and make the hard-coded "sequence":1 assertion flaky; serve the handshake/snapshot separately before invoking or synchronize on the request-specific response.
	in := strings.NewReader("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"stave.initialize\"}\n{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"stave.initialized\"}\n{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"stave.snapshot\",\"params\":{\"mode\":\"full\"}}\n{\"jsonrpc\":\"2.0\",\"id\":4,\"method\":\"stave.action.invoke\",\"params\":{\"callId\":\"inc\",\"actionId\":\"example.increment.v1\"}}\n")
  • Files reviewed: 4/6 changed files
  • Comments generated: 7
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/dualruntime/dualruntime.go Outdated
Comment thread examples/dualruntime/dualruntime.go Outdated
Comment thread examples/dualruntime/dualruntime.go Outdated
Comment thread docs/client-adoption.md
Comment thread docs/client-adoption.md Outdated
Comment thread docs/client-adoption.md Outdated
Comment thread examples/dualruntime/dualruntime.go Outdated
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 14:02
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 14:03
@ben-ranford

Copy link
Copy Markdown
Owner Author

Also addressed the four suppressed findings in 11aef5c: the reducer matches the registered action ID, the test separates handshake/snapshot from invoke, the guide links security and target-validation contracts, and its wording describes alternative hosts using the same application definition with separate sessions for parity tests. Full make ci passes. Copilot follow-up is blocked by the confirmed account quota.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11aef5cc6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/dualruntime/dualruntime.go Outdated
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 14:54
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 14:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b188c45757

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/dualruntime/dualruntime.go
Comment thread examples/dualruntime/dualruntime.go Outdated
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 15:21
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 15:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06b107cb41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/dualruntime/dualruntime.go Outdated
@ben-ranford
ben-ranford force-pushed the feat/64-dual-runtime-tutorial branch from 06b107c to 7d22f39 Compare September 13, 2026 15:49
@ben-ranford
ben-ranford marked this pull request as draft September 13, 2026 15:49
@ben-ranford
ben-ranford marked this pull request as ready for review September 13, 2026 15:49
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Semantic, action, state, replay, and public core contracts documentation Improvements or additions to documentation priority:p2 Normal milestone priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants