Commit 1fea1f636d63

Vincent Demeester <vincent@sbr.pm>
2026-06-22 13:02:21
feat(pi): fix pir startup and adopt pi-coding-agent v2.5.0
Made the pir wrapper self-contained by exporting PASSAGE_DIR and PASSAGE_IDENTITIES_FILE, since the Emacs daemon does not inherit session variables and pass-run fell back to the wrong store, failing to decrypt the TPM-backed secrets on startup. Bumped emacs-overlay to pull pi-coding-agent 20260615 (v2.5.0/2.5.1), which requires Pi CLI >= 0.79.1. Removed the thinking-hide advice now that v2.5.0 batches history replay and avoids the O(n^2) re-render, trusted project-local .pi resources by default, and added an activity-phase hook to notify when a session goes idle.
1 parent 0255609
Changed files (3)
dots
config
emacs
pkgs
my
scripts
bin
dots/config/emacs/init.el
@@ -3202,12 +3202,25 @@ the appropriate file in ~/.local/share/imapfilter-rules/"
   (pi-coding-agent-executable '("pir"))
   (pi-coding-agent-context-warning-threshold 70)
   (pi-coding-agent-context-error-threshold 90)
+  ;; Trust project-local .pi resources (prompts, skills, settings, themes,
+  ;; extensions) by default — frontend equivalent of --approve (v2.5.0).
+  (pi-coding-agent-project-trust-policy 'approve)
   :config
-  ;; Hide thinking blocks — improves rendering performance significantly
-  ;; (avoids O(n²) re-rendering of growing thinking text on each delta)
-  (advice-add 'pi-coding-agent--display-thinking-start :override #'ignore)
-  (advice-add 'pi-coding-agent--display-thinking-delta :override #'ignore)
-  (advice-add 'pi-coding-agent--display-thinking-end :override #'ignore)
+  ;; NOTE: thinking blocks are visible by default since v2.5.0, which also
+  ;; batches history replay and avoids the O(n²) re-render that previously
+  ;; forced us to hide thinking. Re-enable the advice below only if long
+  ;; chats become sluggish again.
+  ;; Notify when a Pi session goes idle (task finished) so background work
+  ;; surfaces without watching the buffer (v2.5.0 activity phase hooks).
+  (add-hook 'pi-coding-agent-activity-phase-functions
+            (lambda (chat-buffer _input-buffer old-phase new-phase reason)
+              (when (and (eq reason 'phase-change)
+                         (equal new-phase "idle")
+                         (not (equal old-phase "idle"))
+                         (buffer-live-p chat-buffer)
+                         (not (eq chat-buffer (window-buffer (selected-window)))))
+                (alert "Pi session idle" :title "pi-coding-agent"
+                       :buffer chat-buffer))))
   ;; Remove ispell from completion in pi input buffer (conflicts with corfu)
   (add-hook 'pi-coding-agent-input-mode-hook
             (lambda ()
pkgs/my/scripts/bin/pir
@@ -3,6 +3,11 @@
 # Usage: pir [args...]
 # Model/provider controlled by ~/.pi/agent/modes.json
 
+# Ensure passage finds its store and identities even when launched from
+# environments that don't inherit session variables (e.g. the Emacs daemon).
+export PASSAGE_DIR="${PASSAGE_DIR:-$HOME/.local/share/passage}"
+export PASSAGE_IDENTITIES_FILE="${PASSAGE_IDENTITIES_FILE:-$PASSAGE_DIR/identities}"
+
 exec pass-run -q \
   -e GOOGLE_CLOUD_PROJECT=redhat/google/osp/project \
   -e GOOGLE_CLOUD_LOCATION=redhat/google/osp/location \
flake.lock
@@ -376,11 +376,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1781757484,
-        "narHash": "sha256-HyqwTvPNhuR2ZNoHhkMQ+Tk22u9+g3EUxMAW3kK43HA=",
+        "lastModified": 1782104113,
+        "narHash": "sha256-5PH6bR6RXRItrzkAgW30niID2BTdFjeW9MpcfdYQcd8=",
         "owner": "nix-community",
         "repo": "emacs-overlay",
-        "rev": "cb3beb2e3882334176dbb38b9f38944d49f46099",
+        "rev": "60912b9120486acb3eb3823bf811d6676e4b9a8c",
         "type": "github"
       },
       "original": {