Skip to content

chore: cut over to Pi 0.76.0#58

Open
fitchmultz wants to merge 9 commits into
mainfrom
chore/pi-0.76.0-cutover
Open

chore: cut over to Pi 0.76.0#58
fitchmultz wants to merge 9 commits into
mainfrom
chore/pi-0.76.0-cutover

Conversation

@fitchmultz
Copy link
Copy Markdown
Owner

Summary

  • bump Pi dev dependencies and lockfile to @earendil-works/* 0.76.0
  • update lifecycle automation for exact --session-id relaunch and real Pi failure-patch evidence
  • rehydrate branch-backed browser state on session_tree and tighten public tool schema strictness
  • add real Pi pipeline, session_tree, schema, and lifecycle regression coverage
  • refresh README/docs/changelog/support-matrix guidance for the Pi 0.76 cutover

Verification

  • pi --version -> 0.76.0
  • local @earendil-works/pi-coding-agent -> 0.76.0
  • npm run docs
  • npm run verify
  • npm run verify -- lifecycle --timeout-ms 300000
  • npm run verify -- package-pi
  • npm run verify -- real-upstream
  • interactive isolated Pi smoke: pi --no-extensions --no-skills -e . --session-dir --model zai/glm-5.1; opened https://example.com with sessionMode=fresh, snapshot -i verified Example Domain, closed session, cleaned temp/tmux artifacts

Notes

  • During final verification, a full-suite run exposed two existing flakes; this branch stabilizes them by serializing env-patched fake-upstream tests and removing a wall-clock assertion from the inherited-stdio subprocess regression.

@fitchmultz
Copy link
Copy Markdown
Owner Author

Addressed the review blockers in 5962232.

Summary:

  • Split branch-visible session_tree restore state from runtime-owned cleanup registries for managed sessions and Electron launch records; quit cleanup now closes all owned sessions/launches even after branch switches, and fresh-session ordinals stay monotonic.
  • Added regression coverage for branch-switch cleanup ownership, Electron cleanup ownership, fresh ordinal allocation, persisted JSONL failure patching for prose and caller-requested --json, strict schema rejection through the real Pi pipeline, and inherited-stdio quick fallback latency.
  • Updated docs/changelog to scope lifecycle harness evidence correctly and point branch rehydration/cleanup evidence to focused harness tests.

Verification:

  • npm run docs
  • npm run typecheck
  • npx tsx --test test/agent-browser.resume-state.test.ts test/agent-browser.extension-ref-guards.test.ts test/agent-browser.pi-pipeline.test.ts test/agent-browser.process.test.ts
  • npm run verify
  • npm run verify -- lifecycle --timeout-ms 300000

@fitchmultz
Copy link
Copy Markdown
Owner Author

Addressed the second review lifecycle/resource ownership findings in fd16b1d.

Summary:

  • Serialized electron.status/probe/cleanup and session_tree restore through the managed-session queue where they touch managed state.
  • Made Electron status/probe/cleanup record scope coherent: status and cleanup use branch-visible + runtime-owned records; probe by launchId uses the same owned scope while default probe remains current-managed-session scoped.
  • On non-quit shutdown/reload, close off-branch owned managed sessions before clearing process-local ownership; preserve only the current branch-visible active managed session for reload continuity.
  • Track successful managed-session closes independently from partial Electron process/profile cleanup, and untrack owned sessions on successful explicit close commands.

Regression coverage added:

  • explicit Electron cleanup waits for in-flight managed commands
  • session_tree waits for in-flight managed commands and branch-restored state remains authoritative
  • off-branch Electron launchId status/probe/cleanup visibility
  • reload closes off-branch owned managed sessions
  • partial Electron cleanup does not double-close an already-closed managed session
  • explicit close of an owned session is not repeated on quit

Verification:

  • npm run typecheck
  • npx tsx --test test/agent-browser.resume-state.test.ts test/agent-browser.extension-ref-guards.test.ts test/agent-browser.pi-pipeline.test.ts test/agent-browser.process.test.ts
  • npm run docs
  • npm run verify
  • npm run verify -- lifecycle --timeout-ms 300000
  • git diff --check

@fitchmultz
Copy link
Copy Markdown
Owner Author

Addressed the latest lifecycle/resource-state review findings in ab2f313:

  • Explicit --session <current-wrapper-managed> close now clears the live managed state, untracks ownership, clears page/ref state, and rotates the next auto call to a fresh wrapper-owned session.
  • electron.cleanup managed-session cleanup steps, including partial host cleanup, now clear the live managed state and are honored during branch restore.
  • Wrapper-owned explicit commands are serialized with managed-session work; independent explicit-session commands can still run concurrently, but stale completions no longer overwrite branch-restored or queued managed state.
  • /reload now preserves the current branch-visible active Electron launch/session and only cleans off-branch owned Electron resources; quit still cleans all owned Electron launches/sessions.
  • Added regression coverage for explicit close restore/live behavior, Electron cleanup restore/live behavior, explicit-session/session_tree races, explicit close vs slow implicit work, active Electron reload preservation, and off-branch Electron reload cleanup.

Fresh verification:

  • npm run typecheck
  • npm run docs
  • npx tsx --test test/agent-browser.runtime.test.ts test/agent-browser.resume-state.test.ts test/agent-browser.extension-ref-guards.test.ts test/agent-browser.extension-electron-discovery.test.ts
  • npm run verify
  • npm run verify -- lifecycle --timeout-ms 300000
  • git diff --check

Also swept tmux sessions and project-created browser processes after lifecycle validation.

@fitchmultz
Copy link
Copy Markdown
Owner Author

Fixed the two remaining Electron reload/ownership findings in 397a6e3:

  • /reload now preserves the current branch-visible active Electron launch and its isolated temp userDataDir; generic temp cleanup removes other secure-temp children but leaves active branch profile dirs intact until electron.cleanup or quit.
  • Targeted electron.cleanup still uses the merged branch+runtime record map for lookup, but branch-visible state is updated only from selected cleanup result records. Unrelated runtime-owned off-branch launches are no longer promoted into the current branch and remain eligible for reload cleanup.
  • Added regression coverage for both cases:
    • active Electron reload preservation now asserts the profile directory survives reload and is removed on quit;
    • targeted cleanup from an empty branch with two off-branch launches now proves the unrelated launch is still cleaned on reload.

Fresh verification:

  • npm run docs
  • npm run typecheck
  • npx tsx --test test/agent-browser.runtime.test.ts test/agent-browser.resume-state.test.ts test/agent-browser.extension-ref-guards.test.ts test/agent-browser.extension-electron-discovery.test.ts
  • npm run verify
  • npm run verify -- lifecycle --timeout-ms 300000
  • git diff --check

Cleanup sweep after validation found no lingering tmux sessions, lifecycle/browser processes, or Electron fixture processes.

@fitchmultz
Copy link
Copy Markdown
Owner Author

Fixed the remaining partial off-branch reload cleanup bug in 624929b:

  • Non-quit shutdown now adds userDataDir paths from partial Electron cleanup results to the temp-cleanup preserve list when the user-data-dir step is skipped or failed.
  • Successful off-branch cleanup is unchanged: removed/already-gone profile dirs are not preserved.
  • Added a regression where off-branch reload cleanup kills the tracked process but a live debug-port probe keeps cleanup partial; the test asserts the managed session close ran, the process was removed, and the skipped profile directory still exists after generic temp cleanup.
  • Updated Electron lifecycle docs/changelog to call out partial off-branch profile preservation.

Fresh verification:

  • npm run docs
  • npm run typecheck
  • npx tsx --test test/agent-browser.runtime.test.ts test/agent-browser.resume-state.test.ts test/agent-browser.extension-ref-guards.test.ts test/agent-browser.extension-electron-discovery.test.ts
  • npm run verify
  • npm run verify -- lifecycle --timeout-ms 300000
  • git diff --check

Cleanup sweep after validation found no lingering tmux sessions, lifecycle/browser processes, or Electron fixture processes.

@fitchmultz
Copy link
Copy Markdown
Owner Author

Addressed the high-severity Electron profile cleanup finding in 7e3c0aa. Partial Electron cleanup now durably protects skipped/failed userDataDir profiles across reload, quit, repeated temp cleanup, and process-exit cleanup. Added regression coverage for quit partial cleanup and protected temp-root process-exit cleanup; npm run verify and lifecycle verification passed.

@fitchmultz
Copy link
Copy Markdown
Owner Author

Fixed the remaining stale-prune ownership bug in 06fb9aa. Protected Electron profile child names are now persisted in the temp-root ownership marker, and stale temp-root pruning preserves those protected children while pruning unprotected spills. Added a two-process regression covering prior-process protection + aged marker + new-process stale prune. Verification: npm run docs, npm run typecheck, targeted temp/ref-guard tests, npm run verify, and lifecycle verification all passed. I also observed two unrelated concurrent-suite flakes during full verify and reran the failing files successfully before the final full verify pass.

@fitchmultz
Copy link
Copy Markdown
Owner Author

Added the remaining managed-session fresh ordinal fix in 118de23.

What changed:

  • explicit wrapper-managed close now advances and persists the generated fresh-session ordinal before rotating the inactive next session
  • electron.cleanup close steps do the same for the current managed session
  • branch/session_tree restore reserves the post-close generated fresh name and keeps the ordinal advanced so a later close cannot rotate back to the just-closed name
  • restore scanning now tracks the max observed generated fresh rank from auto and close rows

Regression coverage now covers:

  • repeated explicit close in the current process
  • restored explicit-close rows, including closing the restored generated session and verifying the next auto call is a third generated name
  • live electron.cleanup rotation with exact invocation/session progression
  • restored electron.cleanup rows with the same no-reuse check

Verification:

  • npm run typecheck && npx tsx --test test/agent-browser.runtime.test.ts test/agent-browser.resume-state.test.ts test/agent-browser.extension-ref-guards.test.ts
  • npm run verify
  • git diff --check

Independent reviewer re-check found no actionable findings.

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