Clarified URL as issue and began analysis
Public
Clarified URL as issue and began analysis
Agent
Pi
Model
Claude Opus 4.5 (latest)
Started
Jan 19, 12:43 PM
Messages14
Downloads0
Identified URL as an issue, not a PR.
UnderstandChecked for linked PRs related to the issue.
UnderstandStarted analyzing the issue content.
UnderstandYou are given one or more GitHub PR URLs: https://github.com/badlogic/pi-mono/issues/842
For each PR URL, do the following in order:
packages/*/CHANGELOG.md files. Report whether an entry exists. If missing, state that a changelog entry is required before merge and that you will add it if the user decides to merge. Follow the changelog format rules in AGENTS.md. Verify:
### Breaking Changes, ### Added, ### Fixed, etc.)Fixed foo ([#123](https://github.com/badlogic/pi-mono/pull/123) by [@user](https://github.com/user))### Breaking Changes, not just ### FixedOutput format per PR: PR: Changelog:
If no issues are found, say so under Bad and Ugly.
>gh issue view 842 --json title,body,comments,labels,state --repo badlogic/pi-mono{"body":"### What happened?\n\nRunning `pi --resume` and pressing <kbd>Escape</kbd> leaves the app in an unusable state.\n\n### Steps to reproduce\n\n1. Run `pi --resume`\n2. Press <kbd>Escape</kbd>\n\n\n### Expected behavior\n\nThe app exits or a new session is started. Instead, \"No session selected\" is printed and the app stops responding to keys. The only way out is to SIGINT <kbd>Ctrl+C</kbd> and restart the app.\n\n### Version\n\n0.49.1","comments":[],"labels":[{"id":"LA_kwDOPbFNk88AAAACHWTBxw","name":"bug","description":"Something isn't working","color":"d73a4a"}],"state":"OPEN","title":"Soft lock in \"pi --resume\""}>gh pr view 842 --json title,body,comments,commits,files,state,author,labels,headRefName,baseRefName --repo badlogic/pi-mono 2>/dev/null || echo "NOT_A_PR"NOT_A_PRThis is an issue, not a PR. Let me search for any related PR that might address this issue.
>gh pr list --search "842" --state all --repo badlogic/pi-mono --json number,title,state,body 2>/dev/null[]>gh pr list --search "resume escape" --state all --repo badlogic/pi-mono --json number,title,state,body 2>/dev/null[{"body":"For hot-swapping sessions from inside `pi` or if you decide to resume after opening `pi`\r\n\r\n(something i do a lot with CC)","number":117,"state":"CLOSED","title":"Add /resume slash command"},{"body":"Hey @badlogic - rewrote the hooks implementation to match what you outlined in #118. This should replace #142.\r\n\r\nBasically just implemented your sketch directly:\r\n\r\n```typescript\r\nimport type { HookAPI } from \"@mariozechner/pi-coding-agent/hooks\";\r\n\r\nexport default function(pi: HookAPI) {\r\n const checkpoints = new Map<number, string>();\r\n\r\n pi.on(\"turn_start\", async (event, ctx) => {\r\n const { stdout } = await ctx.exec(\"git\", [\"stash\", \"create\"]);\r\n if (stdout.trim()) checkpoints.set(event.turnIndex, stdout.trim());\r\n });\r\n\r\n pi.on(\"branch\", async (event, ctx) => {\r\n const choice = await ctx.ui.select(\"Restore?\", [\"All\", \"Conversation\", \"Code\"]);\r\n if (choice !== \"Conversation\") {\r\n const ref = checkpoints.get(event.targetTurnIndex);\r\n if (ref) await ctx.exec(\"git\", [\"stash\", \"apply\", ref]);\r\n }\r\n return { skipConversationRestore: choice === \"Code\" };\r\n });\r\n\r\n pi.on(\"agent_end\", () => checkpoints.clear());\r\n}\r\n```\r\n\r\n\r\nConfig is just paths now:\r\n\r\n```json\r\n{\r\n \"hooks\": [\"~/.pi/hooks/checkpointing.ts\", \".pi/hooks/auto-format.ts\"],\r\n \"hookTimeout\": 30000\r\n}\r\n```\r\n\r\n\r\nThe previous PR (#142) had hooks export an object with named methods and config was objects with `id/path/events/enabled`. Also had `ctx.storage` for persisted state and a ctx.git helper.\r\n\r\nThis version is simpler - factory function pattern means state just lives in closures, `ctx.exec()` handles everything including git, UI is just `ctx.ui.select(title, options)` returning the string directly, and branch handlers can return `{ skipConversationRestore }`. TypeScript files load via jiti so no `package.json` needed. Ended up deleting ~500 lines (`storage.ts`, git-context.ts` and tests).\r\n\r\nOne thing worth noting: hooks init once at startup, not on every session change. Otherwise closure state gets wiped when `subscribeToAgent()` runs again (`resume`, `reset`, `compaction`). Checkpointing needs that state to persist across `/branch`. Hooks can clear their own state on `agent_end` if needed.\r\n\r\nEvents: `agent_start`, `agent_end`, `turn_start`, `turn_end`, `branch`\r\n\r\nAlso kept your escape hatch idea for non-TS users.\r\n\r\nLet me know if this is what you had in mind.","number":147,"state":"CLOSED","title":"Feat/hooks implementation v2"}]There's no PR linked to issue #842. The URL given is an issue, not a PR. Let me confirm this is an issue and understand the problem better so I can provide a proper analysis.
>gh issue view 842 --repo badlogic/pi-mono --web 2>&1 | head -5 || true(no output)