Skip to content

P5 O10 M7: actions to their executing side (RL4), with their ledgers - #246

Merged
SSFSKIM merged 21 commits into
masterfrom
p5-o10-m7
Oct 28, 2026
Merged

SSFSKIM merged 21 commits into
masterfrom
p5-o10-m7

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 28, 2026

Copy link
Copy Markdown
Owner

P5 O10 M7: remote actions (RL4) reach the side that runs them, and each side keeps its own once-only ledger (docs/doperpowers/plans/2026-10-27-p5-o10-endpoint.md, Plan of Work M7).

What it does

  • The endpoint checks every action before authorizing it (src/endpoint/freshness.ts). It refuses an action as stale or malformed, as expired past the op horizon, or as replayed when the device has sent that nonce in the last 120 s. Authorization (M5) runs only after these checks.
  • Routing (actions.ts, lane-a.ts) depends on which side runs the action:
    • sminos (lane A) goes over RL10. Before the first copy of an op is sent, the endpoint asks sminos who owns it (query). If another sender owns it, the endpoint refuses op-conflict and sends nothing. If sminos doesn't answer, the endpoint refuses unavailable. Results are routed by nonce. Inline failures carry only their code.
    • The engine host (lane B) goes through host.op, which claims the op in <userData>/supervisor/ops.jsonl and fsyncs it before running. It checks the context and the answer's digest again in the same turn as the claim.
    • The endpoint's own actions (endpoint.grant, endpoint.state) run under <stateDir>/ops.jsonl.
    • Any other executor is refused no-ledger.
  • Queries (queries.ts) are answered only after M5's query check against the binding the executor stored. An answer with no binding is refused grade. not-received is sent only after a tombstone has taken.
  • The shared op ledger (src/shared/host/op-ledger.ts):
    • It fsyncs its file and directory before serving any record.
    • It cuts a torn tail and compacts to KEPT_S at open.
    • After a failed write it closes and answers unavailable until its process restarts. It logs one line when that happens, and endpoint.detail shows opLedgers.
  • The request digest. requestDigestOf (src/shared/host/request-digest.ts) gives lane B the same digest shape as lane A: AskUserQuestion hashes {questions}, and ExitPlanMode hashes its input.

Wire and engine host

  • This PR adds host.op and host.opQuery, both main-only and graded internal. WIRE_MINOR goes from 0 to 1. M8 takes 2. Under P5 DL 44, whichever of M7 and O2 lands second re-bumps.
  • This PR changes src/engine-host/, so it ran e2e:supervisor on a Mac, hosted, as well as class 1a.
  • tsconfig.web.json and tsconfig.e2e.json gain rewriteRelativeImportExtensions, as the node program already has, because shared host code now imports org-protocol.

Tracker

  • e780160 (the hub-link replacement-window flake) can close. test/endpoint/hub-link.local.test.ts now waits for the twin's close instead of its welcome, every wait on the hub is bounded, and the fixed sleeps are gone. The test is test-only and deterministic: 5×10 runs green, plus 2×10 with a 200 ms slow client.

Decision Log residue for P5 (under O10)

  • Ownership of a lane A op. sminos's binding is the one authority on who owns a lane A op. The endpoint queries before forwarding the first copy and keeps no ownership table.
  • Op ledgers fail closed. After a failed write a ledger stays closed until its process restarts, and this shows in daemon.status and the log. The architect agreed.
  • Web-cards and lane A ops. A web-cards asker of a lane A session op is refused grade, because sminos's binding names no RPC. If O13 needs the RPC name, it is an additive change in O12.
  • Lane B digest. Lane B's digest has lane A's shape. A question's hash matches lane A's only for input already in normalized form. This is carried to O13.
  • Fresh lane B sessions. A fresh lane B session can't be acted on remotely before its first turn. This is a limitation for O7 and O13.
  • Inline lane A outcomes. A failed or refused lane A outcome reaches the device as its code only. The full outcome comes back through a binding-checked query.

Files outside src/endpoint/ and apps/org-protocol/

  • Engine host: src/engine-host/{ipc.ts, ipc.test.ts, ops.ts, ops.test.ts, supervisor-files.ts}
  • Shared host code: src/shared/host/{op-ledger, request-digest}.ts and their tests
  • IPC schema and wire: src/shared/ipc/{schema/host.ts, names/host.ts, grades/host.ts, wire.ts, wire-manifest.json, schema.test.ts}
  • Tests: test/endpoint/{actions, lane-a, grades, hub-link.local}.test.ts
  • Config: tsconfig.web.json, tsconfig.e2e.json
  • The O10 spec: §B, §H, and the M7 Decision Log entries; M7 is ticked.

Validation Evidence

  • Review. doperpowers:reviewer-high ran six rounds, and every finding was reproduced by a probe before it was fixed:

    • Round 1, 3 Important: lane A results routed by opId alone; a ledger left writable after a failed append; the web-cards query name.
    • Round 2, 3: nonce ownership lost when a channel closed; a reseal dropping a result sent under an earlier nonce; a reopened ledger not fsynced.
    • Round 3, 3: ownership not surviving an endpoint restart; an unconfirmed copy promoted to owner; the closed-ledger status cleared by a late done.
    • Round 4, 2: an unbound loose refusal leaking its diagnostic; the copy cap bypassed.
    • Round 5, 1: a loose refusal under a bound nonce.
    • Round 6: "correct — No material findings".
  • Gates:

  • Focused tests, one file at a time:

    Test file Passed
    test/endpoint/actions.test.ts 34/34
    lane-a.test.ts 2/2
    op-ledger.test.ts 18/18
    ops.test.ts 12/12
    request-digest.test.ts 5/5
    json-wire 7
    wire 23
    schema 194
    ipc 50
    grades 31
    status 3
    conversation.local 1
    hub-link.local 10/10 ×5

    All six pnpm typecheck programs pass. eslint is clean on every touched file.

Residue

  • The engine host's closed ledger is reported only when an action or query reaches it. The endpoint learns that the engine host's ledger closed only on the next host.op or host.opQuery; there is no separate probe. A periodic health read could surface it sooner, but it isn't needed for correctness.
  • Inline lane A failures lose sminos's message on the device. A device that wants the message must run the authorized query. If phone UX needs messages inline, sminos's rpc-result would have to carry the binding (an O12 change).

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…the shared op ledger, the context and an answer's digest rechecked at the claim; WIRE_MINOR 1 (O10 M7)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…re authorization, lane B through host.op, lane A through RL10 with its launch, the endpoint's own under ops.jsonl; queries against the stored binding (O10 M7)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…uches no directory at start); §B and §H as built (O10 M7)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…s reopened

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…rade`

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…tion, ExitPlanMode)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ving it, and names why it is closed

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…very nonce its copies used

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…he engine host’s through its unavailable answers

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…a welcome the endpoint may pre-empt (tracker e780160)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… a first copy goes down

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…nswer while it is

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…nly; every copy meets the cap, again after sminos is asked

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… alone, bound or not

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ner authority, fail-closed ledgers, the digest, the fresh lane B limit; M7 ticked

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

# Conflicts:
#	docs/doperpowers/plans/2026-10-27-p5-o10-endpoint.md
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

# Conflicts:
#	docs/doperpowers/plans/2026-10-27-p5-o10-endpoint.md
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-10-28T02:20:33.757307Z 48ace4f PR opened
ℹ️ 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.

@SSFSKIM
SSFSKIM merged commit 96eeed0 into master Oct 28, 2026
SSFSKIM added a commit that referenced this pull request Oct 28, 2026
…rs); the hub-link replacement-window flake row closed

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 28, 2026
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
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