Repository navigation
[AI-2531] Nudge a Pi session once, not on every restart or resume - #1212
realtonyyoung wants to merge 2 commits into
Conversation
Pi re-fires session_start for the same file and keeps what the extension is handed, so the nudges sit behind the durable once-per-session claim, keyed on the file like the memory lease. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoNudge Pi sessions once across restarts and resumes
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
pi.exec discards all stdout from a hook it times out, so a claim taken before a stalled POST was spent on nudges that never arrived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing: live runs against real Pi 0.85.1 show the premise of AI-2531 doesn't hold, and this change regresses. The kcap extension keeps the injected text only in its per-process cache (cleared on every session shutdown) and Pi never persists it into the session file, so re-emitting the nudge on each session_start is the agent's only copy, not a duplicate. Measured system prompt per turn — main: fresh 1 nudge, restart+resume 1, 1, in-process switch 1; this PR: fresh 1, then 0, 0, 0. Details on AI-2531. 🤖 Generated with Claude Code |
Closes #785 — AI-2531
What & why
Pi re-fires
session_startfor the same session file on every restart, reload and resume, and the kcap extension keeps whatever stdout hands it, so the SessionStart nudges (work items, plans, harness, first-run) piled up one copy per restart. They now sit behindNudgeLease, the durable once-per-session claim the Kiro fix introduced, keyed on the session file path so a resume is deduped and a fork (new file) is nudged afresh — the same identity the memory lease already uses.Where to look
Unlike Kiro, the claim is awaited (bounded by the hook budget) at the output site rather than deferred to a second write: it starts beside the memory fetch and overlaps the lifecycle POST, so it has almost always resolved, and Pi's extension reads stdout as one fragment. The claim is only taken when the extension declares it reads stdout (
--memory-contract >= 1), so an olderkcap.tscannot spend it on output it discards.Verification
A_resumed_session_is_not_nudged_again(startup → resume → reload on one file) andAn_extension_that_discards_stdout_does_not_spend_the_claimdrive the real hook; both fail against the unfixedPiHookCommandand pass with it.A_forked_session_file_is_nudged_afreshcovers the fork arm.Pi*77 (+2 skipped),*Nudge*68,NudgeLeaseTests6.🤖 Generated with Claude Code