Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

Bump app to v2.4.138, Bump CLI to v0.3.309 — pi-agent: hide cloud JWT from bash subshells (issue #2436's cousin) — release-app release-cli

Louis Beaumontbfdd43ac0b15
diff --git a/Cargo.lock b/Cargo.lock
index c8843d2d8..e39ade10d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6870,7 +6870,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"anyhow",
"audiopipe",
@@ -6931,7 +6931,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio-eval"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"anyhow",
"clap",
@@ -6946,7 +6946,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -6959,7 +6959,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"anyhow",
"async-trait",
@@ -6992,7 +6992,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -7040,7 +7040,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"anyhow",
"chrono",
@@ -7066,7 +7066,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"anyhow",
"arc-swap",
@@ -7139,7 +7139,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"anyhow",
"chrono",
@@ -7157,7 +7157,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -7215,7 +7215,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.308"
+version = "0.3.309"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/Cargo.toml b/Cargo.toml
index 47a715bf4..eeb022aee 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ exclude = ["apps/screenpipe-app-tauri/src-tauri", "crates/screenpipe-integration
resolver = "2"
[workspace.package]
-version = "0.3.308"
+version = "0.3.309"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/screenpipe/screenpipe"
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index dd3e279d1..68ded203c 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.4.137"
+version = "2.4.138"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md b/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md
index 95131270d..7888900bb 100644
--- a/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md
+++ b/crates/screenpipe-core/assets/skills/screenpipe-api/SKILL.md
@@ -17,6 +17,12 @@ curl -H "Authorization: Bearer $SCREENPIPE_LOCAL_API_KEY" "http://localhost:3030
The `$SCREENPIPE_LOCAL_API_KEY` env var is already set in your environment. Without it you get 403. The only exception is `/health` (no auth needed).
+> ⚠️ **Use `$SCREENPIPE_LOCAL_API_KEY` — not `$SCREENPIPE_API_KEY`.** They are different env vars for different APIs:
+> - `SCREENPIPE_LOCAL_API_KEY` (short `sp-<uuid>`) authenticates to `localhost:3030` (this skill).
+> - `SCREENPIPE_API_KEY` (long JWT) authenticates to `https://api.screenpi.pe` (cloud LLM, not this skill).
+>
+> Sending the JWT to `localhost:3030` will return `unauthorized` and lead you down a dead-end debugging path. If you only see one of these env vars, use that one — but if `SCREENPIPE_LOCAL_API_KEY` is missing, the local server will reject every request you make regardless. Don't substitute the JWT for it.
+
## Context Window Protection
API responses can be large. Always write curl output to a file first (`curl ... -o /tmp/sp_result.json`), check size (`wc -c /tmp/sp_result.json`), and if over 5KB read only the first 50-100 lines. Extract what you need with `jq`. NEVER dump full large responses into context.
diff --git a/crates/screenpipe-core/src/agents/bash_env.rs b/crates/screenpipe-core/src/agents/bash_env.rs
index 3ecdfa5db..068ca218f 100644
--- a/crates/screenpipe-core/src/agents/bash_env.rs
+++ b/crates/screenpipe-core/src/agents/bash_env.rs
@@ -47,6 +47,17 @@ pub const WRAPPER_SCRIPT: &str = r#"# screenpipe — auto-injected by pi-agent b
#
# Regenerated on every pi-agent spawn from screenpipe-core::agents::bash_env.
+# Hide the cloud-LLM JWT (SCREENPIPE_API_KEY) from the agent's bash. The
+# pi-coding-agent reads it from auth.json directly and does NOT need it
+# in the env. Leaving it exposed bit a real user (justinspillers,
+# 2026-05-05): the agent saw an env var named "SCREENPIPE_API_KEY", used
+# it on localhost:3030, the server 401'd (it's a JWT, not the local
+# sp-<uuid8> token), and the agent burned 30+ tool calls hunting a
+# phantom auth bug before concluding — wrongly — that "the local API
+# needs a full JWT token". Unset it here so the only auth-shaped name
+# the agent can see is SCREENPIPE_LOCAL_API_KEY, which is correct.
+unset SCREENPIPE_API_KEY
+
_sp_auth_key() {
# accept either name so we don't depend on which spawn path set it
printf '%s' "${SCREENPIPE_LOCAL_API_KEY:-${SCREENPIPE_API_AUTH_KEY:-}}"
@@ -182,6 +193,20 @@ mod tests {
assert!(WRAPPER_SCRIPT.contains("SCREENPIPE_API_AUTH_KEY"));
}
+ #[test]
+ fn wrapper_script_unsets_cloud_token_env_var() {
+ // The agent must not see SCREENPIPE_API_KEY (cloud JWT) — it's
+ // distinct from SCREENPIPE_LOCAL_API_KEY (local sp-<uuid>) and
+ // exposing both has caused real users' agents to send the JWT
+ // to localhost:3030 and chase phantom auth bugs (justinspillers,
+ // 2026-05-05 — feedback log shows the agent burning 30+ tool
+ // calls before concluding "API needs full JWT" — wrong).
+ assert!(
+ WRAPPER_SCRIPT.contains("unset SCREENPIPE_API_KEY"),
+ "wrapper must unset SCREENPIPE_API_KEY in pi-agent subshells"
+ );
+ }
+
#[test]
fn wrapper_script_injects_only_for_localhost_3030() {
// Smoke check the three matched forms; any new alias needs a line here.