# Pi native session approval reproduction

Environment: Linux, Chromium web client, 1280x800, light theme, real Pi 1.7.0. Each commit runs its own dev server and fresh T3 database with T3CODE_DEV_SEED=0. Pi is enabled with launchArgs="--approve" to load the trusted project extension. No model response is needed: these are real Pi extension slash commands.

Copy approval-probe.ts into a synthetic project's .pi/extensions directory. Register the project using `node apps/server/src/bin.ts project add --base-dir .t3 --title "Pi approval probe" <project>`.
Start its first turn using `node apps/server/src/bin.ts thread start --base-dir .t3 --provider pi --model default --title "Pi approval probe" <project> /askconfirm --json`.

Browser driver actions, identical on both commits:
1. Open the returned thread directly in the paired browser. Hide the sidebar and thread details to omit machine metadata. Start recording with the first confirmation pending.
2. Click More approval options, then Always allow this session. Observe confirm=true and native session filename.
3. Type /askconfirm in the contenteditable textbox and click Submit message. Observe automatic confirm=true in the same native session.
4. Type /freshsession and click Submit message. This calls real Pi ctx.newSession(). The subsequent probe notify uses the old ctx and produces the same stale-context error as the reported reproduction.
5. Type /askconfirm and click Submit message.
6. Base: observe automatic confirm=true in a different native session, with no new approval request. Head: observe Waiting for approval, click Decline, and observe confirm=false in a different native session.

The two stills were captured after completion; each was verified pixel-identical to another screenshot taken at least 500ms earlier. The recordings include the initial grant, same-session reuse, session replacement, and final confirmation behavior. The extension reports only the session filename, not the private directory.

Base: 6d49f5ec95f402cc6b88980af924cdaf732140b8
Head: 76a38898d9ef4702b3401bad04ecc1722ee6dad6
