Skip to content

feat: preserve history selection in portable context - #77

Merged
johnnyhuy merged 2 commits into
mainfrom
agent/issue-76-history-context-origin
Nov 14, 2026
Merged

johnnyhuy merged 2 commits into
mainfrom
agent/issue-76-history-context-origin

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Copied context, Markdown exports and cross-root handoff drafts now retain the Pi session, source archive, selected entry and archive tip. The handoff explains when to Resume, when to Resume in new fork, and when readable history can only be used as context.

Part of #4.
Closes #76.

Verification

  • bun install --frozen-lockfile passed.
  • mise exec -- bun run lint passed.
  • bun run typecheck passed within mise run build.
  • mise exec -- bun run test:unit passed, 103 tests across 10 files.
  • mise exec -- bun run test:integration passed, 102 tests across 13 files.
  • mise run build passed, including all gates and the production bundle.
  • git diff --check passed.

Proof

$ mise exec -- bun run test:unit
 Test Files  10 passed (10)
      Tests  103 passed (103)

$ mise exec -- bun run test:integration
 Test Files  13 passed (13)
      Tests  102 passed (102)

$ mise exec -- bun run test:e2e
 Error: Library not loaded: @rpath/Electron Framework.framework/Electron Framework
 Error: Electron failed to install correctly
 Test Files  7 failed (7)
      Tests  63 skipped (63)

Local app launch and screenshot capture are blocked by the incomplete Electron runtime installation. Hosted macOS Playwright capture and native Markdown download succeeded on commit 45d647b. All 63 Electron tests passed.

$ mise run test:e2e  # hosted macOS
 prepares ancestor context in another root without starting Pi and sends only after review passed
 copies only the selected history path as portable context without launching Pi passed
 copies readable legacy history with source identifiers and no unsafe resume instruction passed
 Test Files  7 passed (7)
      Tests  63 passed (63)

A prepared handoff draft retaining the source archive and exact entry identifiers

The screenshot shows the new saved-selection section in the actual destination composer at native window dimensions. It was downloaded, visually reviewed, copied to .tmp/proof/ and uploaded directly to this PR. No scratch captures are committed.

The artefact contains history-handoff/history-context-identifiers.png, history-handoff/prepared-history-context.md, history-summary/selected-history.md and history-summary/legacy-history-context.md under Users/runner/work/pidex/pidex/test-results/.

The real downloaded Markdown records the selected ancestor separately from the archive tip.

## Saved selection

- Pi session `source`.
- Selected entry `old-answer`.
- Archive tip at export `new-tip`.

Its continuation guidance says to select old-answer and choose Resume in new fork. The test also compares the complete downloaded file with the native clipboard text, allowing only their export timestamps to differ.

New unit cases

  • identifies the exact saved archive tip and explains that the snapshot can advance.
  • distinguishes a selected ancestor or alternate branch from the archive tip.
  • preserves readable history identifiers without promising unsafe continuation.
  • records an empty archive without inventing an entry or offering continuation.
  • keeps backticks and line breaks in archive identifiers inside readable inline code.

Component coverage checks clipboard content, reads the actual download Blob, and checks the prepared draft while preserving both roots' drafts. Electron coverage checks native clipboard text for the archive tip, an alternate branch and an ancestor; saves the real Markdown download; compares it with copied context; and checks legacy recovery guidance. Source archives must remain unchanged and export must not launch Pi. The cross-root test captures the prepared draft in the native window and verifies that only a later reviewed Send starts a new session.

The identifiers describe the saved selection at export time. They do not relocate an archive, add an importer or guarantee that the source remains present or unchanged. The parent remains open for further recovery slices.

johnnyhuy and others added 2 commits November 15, 2026 02:35
Include saved archive and entry identifiers in copied context, Markdown downloads and cross-root handoff drafts. Explain which selection needs a fork and when readable history cannot safely resume.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy marked this pull request as ready for review November 14, 2026 19:44
@johnnyhuy
johnnyhuy merged commit 68db2f4 into main Nov 14, 2026
15 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-76-history-context-origin branch November 14, 2026 19:44
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.

Preserve exact history selection in portable context

1 participant