Conversation
Pi core awaits session_shutdown handlers with no timeout, so real quits block on the exit-summary LLM round trip (bounded only by the 10s PI_MEMORY_EXIT_SUMMARY_TIMEOUT_MS from #26/#28). This adds a third way: PI_MEMORY_EXIT_SUMMARY=detached (alias: background) hands the prepared summary to a detached worker process and returns immediately, so quitting is instant and no shutdown timeout is needed. - shutdown handler: resolve branch/gate/model/key and build the prompt as today, then spawn the worker and return; falls back to the inline path if spawning fails or the summary cannot be prepared - worker entry: this same file executed directly with --exit-summary-worker <payload.json> (import.meta.main); reads a 0600 temp-file payload, deletes it, runs the LLM call, appends the daily log, and refreshes qmd (honors PI_MEMORY_QMD_UPDATE) - refactor: extract generateExitSummary pre-flight into prepareExitSummaryRequest, shared by both paths; inline behavior and its ExitSummaryResult semantics are unchanged - default remains inline; disable values unchanged Tests: bun test test/unit.test.ts — 182 pass / 0 fail before, 188 / 0 after (mode parsing, spawn hand-off payload, trivial-session skip, spawn-failure fallback, worker write/empty-drop). Signed-off-by: Jin <JinRMoriarty@outlook.com>
💡 Codex ReviewLine 1681 in 9b7c812 When detached mode successfully spawns or skips a summary, this early return bypasses the Lines 545 to 546 in 9b7c812 If the detached worker exits before consuming the payload—for example because startup or module loading fails—this write can asynchronously emit ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Follow-up to #40. Replaces the temporary JSON payload file with a one-shot stdin pipe, so API keys, conversation prompts, and model metadata are never persisted to disk. Adds fallback behavior when pipe setup is unavailable and tests for no temp-file leakage.