Skip to content

feat(dev-harness): fake-backed V1 live-session broker (reload, restart, controls, evidence, owned teardown) - #14362

Merged
Git-on-my-level merged 25 commits into
mainfrom
task/msd-harness-v1-live-session-pr1
Sep 18, 2026
Merged

Git-on-my-level merged 25 commits into
mainfrom
task/msd-harness-v1-live-session-pr1

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

What changed and why

V1 PR1: a fake-backed live Flutter broker (LiveSession, decode_request, validate_live_evidence, full-identity teardown/stop_owned_broker) plus lifecycle order live → services → device. CLI mobile-session live does not spawn flutter run; tests inject fake_flutter.py. Also folds the spike's iOS .app directory hasher (clean cherry-pick). Platform-alias / start --json stdout purity did not apply cleanly on this base and stays on the simulator-lane package.

Product invariants affected

none

How it was verified

  • python3 scripts/check_spine_contracts.py → Spine contracts: 0 pending markers; 8 protected files (marker deletions only).
  • bash scripts/dev-harness/run-tests.sh and make preflight (OMI_PR_BODY_FILE=.local/pr-body-v1-pr1.md) → 347 passed, 6 skipped. The skips are existing Windows skipifs in test_python_resolver.py. No new skips.
  • Fake-backed spine + builder tests exercise reload/restart/controls/logs/screenshot/status/stop and real child processes for mid-op death and mismatched-identity teardown. No real flutter run start is exercised in this PR.
  • make preflight with this body: 16 checks passed in 124.98s.

Protected tests require controls profile localDev. The real app reports local_dev (spike .local/v2-machine.jsonl). This PR implements localDev as the tests demand. Two other contract/docs mismatches go to the architect with the sign-in design question: LIVE_SESSIONS.md still names make setup-backend (wheels are make lane-backend); readiness still wants a signed-in fixture principal that nothing currently produces.

Tests

  • Spine: scripts/dev-harness/tests/spine/test_live_session.py, test_live_revision.py — all @pending("V1") markers retired because those tests now pass.
  • Builder regressions: scripts/dev-harness/tests/test_live_builder_regressions.py — the six lazy holes (spawn+wait_ready, fault RPC sent, lifecycle order, distinct reload error codes, verify contacts broker then exit 2, close-one-keeps-the-other) plus two real-child cases (flutter child dies mid-reload → blocked never success; teardown refuses a live PID whose start/marker/boot_id do not match).
  • Hasher: test_file_sha256_hashes_an_ios_app_bundle_directory.

Remaining pending (not spine markers; out of this PR):

  • Real flutter run on a device / simulator (dispatch refuses with exit 2).
  • Live journey adapter (fast --session contacts status then exit 2).
  • Android adb reverse, physical devices, any latency claim, sign-in.
  • Platform vocabulary aliases and start --json stdout purity (cherry-pick 3f76814d77 conflicts on mobile_session.py).

Failure class (fixes)

Failure-Class: none

The hasher commit is a fix: of an iOS .app IsADirectoryError; it is not a recurring failure-class instance.


Part of the mobile self-driving program (Harness lane, V1 PR1). Stacked on #14310, which carries the contract tests this satisfies. Implemented by Cursor cursor-grok-4.6-high against tests written by Codex gpt-6-astra, after two rounds of builder review of that contract. Coordinator verification on the head (with the updated base merged in): python3 scripts/check_spine_contracts.py passes with 0 pending markers and the protected test files show only marker-line deletions; bash scripts/dev-harness/run-tests.sh 357 passed, 6 skipped, 0 expected failures. The module signals no process itself: stop_owned_broker refuses unless the observed identity equals the recorded one in full, and the terminator is injected; the CLI live operations still refuse to spawn (exit 2), so nothing in this PR can start or stop a real Flutter process. Draft until the architect's conformance review. Not exercised here: a real flutter run start, the journey adapter, Android, physical devices, sign-in, any latency claim.

🤖 Generated with Claude Code

Review in cubic

Git-on-my-level and others added 15 commits September 17, 2026 13:42
Add strict Python/Dart pending contracts and introducing-commit protection.
Reserve the live-session CLI, wire, ownership/attachment seams and failing
builder acceptance tests. Add live attribution before freezing evidence v1.

Verification:
- bash scripts/dev-harness/run-tests.sh: 287 passed, 7 existing skips,
  40 strict xfailed (24 pending V1 markers), Python 3.11.15.
- make preflight: 16 checks passed, using supported PYTHON selection.
- make mobile-verify fast --paths harness/session contract inputs with an
  absolute evidence directory: 20 executed, 20 passed, no failures/skips.
- bash app/test.sh: 2014 passed, 5 skipped, one unchanged UTC+7
  search_rank_grouping_test failure; affected baseline inputs match main.
- Real module CLI refusals exit 2 without traceback; regression covered.
- Dart SDK probe proves ext. prefix required; marker-removal formatter
  probe proves no incidental Dart diff.

Runtime is intentionally unimplemented. App UI must repair current invalid
VM extension names before live acceptance; unsupported journeys block.
Simulator/emulator latency and detached-process acceptance remain V1 work.
make setup installed hooks but full backend wheel sync stalled; isolated
Python 3.11 harness dependencies ran the owner checks without any skip flag.

Failure-Class: none
The check protects files under the spine roots and their registry, so it only
needs to run when those change. A repo-wide trigger would run it, and its
full-history requirement, on every unrelated contributor PR.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
V1 must refuse live journey execution until a shared executable adapter exists;
B1 addressability alone cannot attach Dart integration tests. Pure admission
contracts remain valid with injected supported IDs.

Verification: harness 287 passed, 7 skipped, 40 strict xfailed;
make preflight passed 20 checks.
…lities

Coordinator turn-4 review authorizes the V1 fixture correction. Exact before/after digests pin the revised oracle; immutable revision records do not permit builder assertion edits. Active tests reject missing/tampered records and prove the fake machine response. Verification: full harness 289 passed, 7 skipped, 40 strict xfailed; UTC app 2020 passed; spine 24 pending/7 protected; make preflight 16 passed. No live device acceptance claimed.
Track retained marker occurrences rather than counts so retiring a second test cannot restore the first test's retired marker. The active regression covers this swap and legitimate continued retirement. Verification: full harness 290 passed, 7 skipped, 40 strict xfailed; spine 24 pending/7 protected; make preflight 16 passed. Dart sources unchanged after the earlier UTC app 2020-pass run.
…rges

A squash can introduce a corrected contract and its review records in the same commit. Absorb only the revision prefix ending at that introducing file's exact digest, preserving immutable records and later marker-only edits. Active temp-repo regression covers multiple corrections in one squash and rejects restoring old or altered assertions. Verification: harness 291 passed, 7 skipped, 40 strict xfailed; B1 make preflight 20 passed; final B1 journeys 20/20. Dart unchanged after UTC app 41 opt-in and 2051 ordinary passed.
LiveSession speaks the Flutter machine wire against an injected child, records BrokerIdentity in live.json, and refuses real flutter run from CLI dispatch.

Co-authored-by: Cursor <[email protected]>
…lease

Lifecycle order is live teardown, then services, then device detach; recover still has generation 1 while teardown runs.

Co-authored-by: Cursor <[email protected]>
The fake-backed broker now satisfies those spine tests; only whole pending-marker lines were deleted.

Co-authored-by: Cursor <[email protected]>
…esses

A dead flutter child mid-reload is blocked, never success; teardown will not signal a live PID whose start time, marker, or boot id does not match.

Co-authored-by: Cursor <[email protected]>
file_sha256 raised IsADirectoryError on a simulator .app; identity is now the sorted tree of regular files.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level changed the base branch from task/msd-spine-a-live-session to main September 17, 2026 17:05
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Architect conformance review: does not conform

Reviewed at immutable ref ae0c476ab144dae7b86d41c543e1e478a6090ddf. No builder files were
edited by the review; the probes load the reviewed source into ignored local fixtures with
no app, device or production access. Thirteen adversarial probes reject this head.

The fake-backed boundary this PR chose is valid — that design decision is accepted. The
implementation is not yet faithful to the contract, and the original tests were not
sufficient to show it. Retiring 24 original V1 markers plus four round-2 markers therefore
does not establish completion.

Required changes, all in scripts/dev-harness/dev_harness/live_session.py:

  1. Source and generation ownership (352–386, 404–406, 449–454, 624–644, 713–728). Pin the
    lease identity, generation and requested source before starting work, including the
    initial compile, and recheck after readiness as well as after daemon completion. Today
    start stamps whatever source exists after compile, and reload ignores edits made during
    its readiness round trips. Status and logs bypass generation checking, and supplying a
    new generation lets an old child act for a recovered lease. Error receipts must keep the
    original operation generation and the last proven loaded identity — never borrow the
    latest lease.
  2. Cleanup (356–376, 423–442). Release the worktree claim when factory creation fails, and
    always close and reap an acquired child even before app.start; the current close skips
    children with no appId. Do not swallow a failure to close or reap and then announce
    stopped or release ownership anyway — a failed teardown must preserve retryable
    ownership. Early-child cleanup, factory cleanup and failed-reap ownership loss all
    reproduce.
  3. RPC concurrency (407–409, 536–547). The mutation lock serializes writes but a read
    control can consume and discard the restart reply; reproduced with a paused reload reader
    plus state. Either refuse VM reads busy while another RPC owns stdio, or use one reader
    with response demultiplexing. Cached status and logs stay available either way.
  4. Truthful time bounds (505–508, 542–543, 713–728). Each event currently gets a fresh full
    timeout, and receipts hard-code elapsed_ms=0 with both UTC timestamps taken after the
    work. Use one monotonic deadline and a remaining budget across compile, RPC and
    readiness, and measure the operation rather than the serialization. New pending contracts
    inject a monotonic clock and a progress-event storm.
  5. Secret handling (532–534, 744–746). Raw app logs are retained, and filtering the literal
    fixture string private-vm-auth is not sanitization — the probe gets a different
    authenticated VM URL back out of logs. Sanitize by URL and credential shape before
    storage or response, bound the retained logs, and honor a caller limit/cursor. Never
    report a test sentinel check as the production boundary.
  6. Readiness negotiation (549–585). capabilities is fetched and then ignored. Validate the
    negotiated version and the required methods, and fail closed on malformed or error
    responses.

Two things the review credits explicitly: stop_owned_broker compares the whole observed
identity and fails closed on mismatch, which is correct; and the mobile_session lifecycle
ordering (live teardown → service down → device detach, with recover incrementing the
generation only after teardown and down succeed) conforms.

One claim needs narrowing rather than fixing: "nothing reachable from the CLI signals a real
process" is too broad, because existing session stop/reset/recover still reach real service
and device lifecycle commands and recover now calls cmd_down. Claim no new live-process
adapter
instead.

The oracle had one defect of its own, and it is the architect's, not yours: the readiness
profile expectation was localDev where the real wire spelling is local_dev. The spine now
corrects it, and the probes above were run with that correction so it could not mask these
findings.

The new tests are tests/spine/test_live_conformance.py and test_live_negotiation.py,
riding on #14327. Return for review after these are fixed. This PR stays a draft until then.

The architect's thirteen probes rejected attributing a compile to source observed after launch, announcing stopped after a failed reap, and grepping one fixture secret. Keep one monotonic RPC deadline and actually validate negotiated capabilities.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Rework pushed for a second conformance pass — 87f2a8d72d

All six required changes from the architect's review are addressed, each with a named test:

  1. Source and generation pinning — source stamped and child_generation bound before the
    factory and the compile, rechecked after drain and after readiness.
    test_start_cannot_attribute_a_build_to_source_observed_only_after_launch,
    test_source_change_during_post_reload_readiness_does_not_advance_loaded_identity,
    test_new_lease_generation_cannot_adopt_old_child_even_with_new_request_generation.
  2. Cleanup — factory failure releases the worktree claim, close always reaps an acquired
    child, and a failed reap does not set stopped.
    test_factory_failure_does_not_leave_a_live_worktree_claim,
    test_close_reaps_child_even_when_no_app_start_event_arrived,
    test_failed_reap_keeps_ownership_and_close_can_retry.
  3. RPC concurrency — VM reads take the stdio lock and get busy; cached status and logs stay
    available. test_read_control_cannot_steal_an_inflight_restart_response.
  4. Truthful time bounds — one monotonic deadline with a remaining budget per receive, and
    elapsed_ms from that clock. test_progress_events_cannot_reset_the_absolute_rpc_deadline,
    test_operation_elapsed_time_measures_work_not_receipt_serialization.
  5. Sanitizing by shape rather than by the literal fixture string.
    test_vm_auth_urls_are_sanitized_by_shape_not_one_fixture_secret.
  6. Capability negotiation validated — version plus required methods, failing closed on
    malformed or error responses. test_start_cannot_ignore_capability_negotiation.

The over-broad CLI claim is narrowed in the PR body as the review asked: no new live-process
adapter
, since stop/reset/recover still reach real service and device lifecycle commands.

Harness suite 372 passed / 6 skipped / 0 xfailed. make preflight 16 checks.
check_spine_contracts.py was not modified.

One thing the second pass should probe. This branch now shows 0 pending markers on the
V1 spine
: 11 markers covering 13 cases were retired this round, on the new conformance and
negotiation oracles. Last round, retiring 28 markers did not establish completion, and the
review was right about that. Retiring the rest may be correct now, but the builder has been
asked to state which of the six defect classes it believes is provably closed versus merely
tested, and that distinction — not the marker count — is what should decide this pass.

Still deliberately out of scope and not claimed: real flutter run, the live journey adapter,
the V8 evidence-freeze suite, and the mechanism suite's fixture pending strings.

Staying a draft until the architect's verdict.

🤖 Generated with Claude Code

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Architect conformance review, round 2: still does not conform

Reviewed at 87f2a8d72d23b16f34f21cb3da1595f621852166. The rework is called substantive —
the unchanged 59 V1 tests pass and the earlier review cases are included — and four of the six
original classes are now closed or honestly bounded. Six additional cases reproduce what
remains.

The framing to take from this: zero pending markers establishes only that these bodies
passed.
That is why the marker count was not the thing being judged.

Three required changes in scripts/dev-harness/dev_harness/live_session.py:

  1. Generation at publication (lines 482, 606, 925). _assert_generation checks admission,
    not completion. Rolling the lease during ext.omi.controls.state leaves start, reload and
    restart all returning ok, with reload and restart advancing loaded_source and
    loaded_sequence. Revalidate the pinned lease and child generation after the asynchronous
    daemon and readiness work and before publication. A stale completion must be blocked, keep
    its original operation generation, and preserve the last proven loaded identity and sequence
    (null/zero for an initial start). Source-hash rechecks do not substitute. The rework's own
    comment claiming generation is rechecked after readiness is incorrect — it rechecks source
    there, not the lease generation.
    Extend the same boundary to screenshot and control
    completion.
  2. Readiness refusal and cached state (538–541, 733–772, 886–901). Non-empty strings such as
    "false" satisfy all(readiness.get(...)), so malformed readiness becomes ready.
    Validate booleans and response shape, including explicit RPC errors. A capabilities error
    during post-reload readiness escapes and the request's finally restores the previous
    ready state, and cached status then reports ready despite a failed negotiation. Keep it
    blocked, preserve loaded attribution, and record the failed operation.
  3. Credential-shape redaction (39–41, 136–150, 696–703).
    Authorization: Bearer <token> becomes Authorization=<redacted> <token> — the credential
    is retained and returned by logs. The probe injects a real app.log event through the fake
    transport and reads the logs API, not just the helper. Redact complete authorization values
    before retention. One added regex example is not a general secrecy proof.

Per-class assessment: source/generation admission and source rechecks are real fixes but
publication is not closed; cleanup conforms within PR1's injected process contract,
which is not proof of OS reaping or boot recovery; RPC concurrency gives a structural
single-reader argument for the request path, backed by the paused-reader test, but is not a
claim about arbitrary direct concurrent calls; time bounds are tested and structurally bounded
for receives that honor their timeout, with no latency claim; secrets are fixed for VM URL shape
but not for the authorization header; negotiation rejects unsupported and missing
capabilities but not malformed state or failed post-reload readiness.

Note that required change 1 is the same distinction as #14394's — fencing at admission versus at
publication — in a different subsystem. Worth reading both.

Separate integration finding, and it is the architect's to fix, not yours. The two round-7
review files were introduced on this builder history with formatter changes rather than only
marker removal, so checker.allowed(original, builder) is false for test_live_conformance.py
and test_live_negotiation.py (true for test_live_session.py and test_live_revision.py).
That is not an assertion-weakening finding, but the checker rejects conflicting
introductions once both histories are reachable, and restoring current worktree bytes does not
erase the history. A spine-owned formatting revision preserving every marker and assertion has
to land before #14327 integrates. New acceptance: test_live_commit_fences.py.

🤖 Generated with Claude Code

… redaction

_assert_generation only covered admission, so a lease roll during
ext.omi.controls.state still published ok and advanced loaded identity.
Recheck lease and child generation after daemon/readiness work, refuse
non-boolean readiness, and redact complete Authorization values before
logs are retained.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Round 3 pushed — fenced at publication, not only admission

All three remaining required changes are addressed at d2eaf05e24b7. The round-7 oracle files
are untouched, which matters because the formatting conflict on those is the architect's to
resolve and restoring bytes would not have erased the history anyway.

Publication generation. _assert_generation still admits the request; after the daemon and
readiness work, start, reload, restart, screenshot and controls now recheck the pinned lease and
child generation before writing loaded identity or returning ok. A lease roll during
ext.omi.controls.state returns blocked with stale-session, keeps generation 1 rather
than 2
, and leaves the last proven loaded source and sequence (null/0 on an initial start).
The review was right that the old comment was wrong: the post-readiness check was source-hash
only, and the new one is the generation.

Worth noting for the record: the pattern is borrowed from #14394 — capture the token before
the await, refuse to publish after N+1, keep the original operation generation. The review
flagged that these two PRs had the identical admission-versus-publication defect in different
subsystems, and they now express the boundary the same way rather than each inventing one.

Readiness. signedIn, routed and captureIdle must be boolean True, so the string
"false" is no longer ready. State and wait_ready RPC errors and non-object results fail
closed. A capabilities error during post-reload readiness is caught so the finally cannot
restore ready; cached status reports blocked and loaded attribution is unchanged.

Authorization redaction. Authorization: Bearer <token> no longer becomes
Authorization=<redacted> <token>. Complete authorization values, and leftover Bearer
tokens, are redacted before _logs retention. The probe goes through a fake-transport
app.log event and the logs API rather than only the helper, which is what the review asked
for after noting that one regex example is not a general secrecy proof.

Harness suite 380 passed, 6 skipped. make preflight 16 checks. No new failure class was
defined despite this being the same class as #14394's, pending the coordinator's call.

Still a draft, awaiting the architect's fourth pass.

🤖 Generated with Claude Code

Git-on-my-level and others added 5 commits September 18, 2026 07:31
Take main for the architect-owned spine checker, formatted round-7 oracles,
mobile_session.py, and PENDING_CONTRACTS.md. Keep the V1 live_session
implementation and pending-marker retirements on session/revision oracles.

Co-authored-by: Cursor <[email protected]>
…assed T7 markers

Keep main's port-claim mobile_session.py; put back V1 live teardown on
stop/reset/recover. The formatted round-7 oracles now pass, so remove only
the pending-marker lines.

Co-authored-by: Cursor <[email protected]>
The merge commit ran dart format without package:flutter_lints resolved and
rewrote main's files. Restore origin/main bytes so the V1 PR does not carry
unrelated UI diffs.

Co-authored-by: Cursor <[email protected]>
Name the session and holder pid immediately. The same overlap that used to look like a controls-extension miss is a held lease.

Co-authored-by: Cursor <[email protected]>
Git-on-my-level and others added 3 commits September 18, 2026 12:13
…now pass

Merging origin/main imported strict xfails for lease-roll, negotiation, and auth-redaction fences this branch already implements.

Co-authored-by: Cursor <[email protected]>
Finding 2 of the adversarial review reproduced: a fake reporting
readiness.signedIn as the string "false" was classified not-ready and
fell through to the wait_ready recovery path, which then observed real
booleans and published ok. _is_ready now raises LiveError
(malformed-response) for present-but-non-boolean flags, so start blocks
instead of self-healing; start/reload/restart wrap it and surface
blocked/malformed-response. The stringy-false regression test's expected
error_code moves unready -> malformed-response; blocked-stays-blocked is
unchanged. The satisfied V1 pending marker on the boolean probe is
retired. Findings 1, 3 and 4 did not reproduce at this head (probes
re-run verbatim; evidence in PR comment).

Failure-Class: new
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Adversarial re-verification complete (probes re-run verbatim at head; owner suite 422 passed / 6 skipped):

Finding Verdict
1. Lease roll during readiness advances loaded identity Stale — all three variants (start/reload/restart) pass at this head; generation is checked before publication (live_session.py:489+)
2. Malformed readiness ("false" strings) self-heals to ok Reproduced → FIXED — _is_ready now raises LiveError("malformed-response") on present-but-non-boolean flags; start catches and surfaces blocked/malformed-response instead of falling into the wait_ready recovery path. Fail-closed.
3. Negotiation error restores cached ready state Stale — probe passes
4. Authorization header retained in logs Stale — redaction probe passes

The satisfied @pending("V1") marker on the boolean probe is retired (permitted edit). The stringy-false regression test's expected error code moves unready → malformed-response; blocked-stays-blocked is unchanged. New head: bf297a479ed1.

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review September 18, 2026 12:14
@Git-on-my-level
Git-on-my-level merged commit 716af85 into main Sep 18, 2026
38 checks passed
@Git-on-my-level
Git-on-my-level deleted the task/msd-harness-v1-live-session-pr1 branch September 18, 2026 12:14
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