fix idle timer: daemon agent calls were resetting user activity

The daemon's claude -p subprocesses inherit hooks config, so every
agent LLM call triggered UserPromptSubmit → signal_user(), making the
idle timer think Kent was always active. The daemon was petting its
own tail.

Fix: set POC_AGENT=1 env var on all daemon claude subprocesses, and
return early from poc-hook when it's set.
This commit is contained in:
ProofOfConcept 2026-03-06 00:16:03 -05:00
parent ea30a2dca4
commit 9e52fd5b95
2 changed files with 10 additions and 0 deletions

View file

@ -140,6 +140,13 @@ fn main() {
.filter(|p| !p.is_empty())
.map(PathBuf::from);
// Daemon agent calls set POC_AGENT=1 — skip all signaling.
// Without this, the daemon's claude -p calls trigger hooks that
// signal "user active", keeping the idle timer permanently reset.
if std::env::var("POC_AGENT").is_ok() {
return;
}
match hook_type {
"UserPromptSubmit" => {
signal_user();

View file

@ -59,6 +59,9 @@ fn call_model(agent: &str, model: &str, prompt: &str) -> Result<String, String>
cmd.env("CLAUDE_CONFIG_DIR", dir);
}
// Tell hooks this is a daemon agent call, not interactive
cmd.env("POC_AGENT", "1");
let start = std::time::Instant::now();
let result = unsafe {