provenance: track agent phase, use task_local + thread_local

Split TASK_PROVENANCE into TASK_AGENT (task_local, set once per agent
run) and TASK_PHASE (thread_local, updated between steps). Provenance
now reports "agent:surface-observe:observe" instead of just
"agent:surface-observe", making it possible to identify which pipeline
phase created a node.

Priority: task_local agent + thread_local phase > POC_PROVENANCE env
var > "manual".

Also includes memory_search catchup throttle and pipelining fixes
from the surface-observe refactor.
This commit is contained in:
ProofOfConcept 2026-03-27 15:11:17 -04:00
parent b1efdf0b9a
commit 85302c11d4
5 changed files with 79 additions and 53 deletions

View file

@ -237,9 +237,9 @@ pub fn call_api_with_tools_sync(
.enable_all()
.build()
.map_err(|e| format!("tokio runtime: {}", e))?;
let prov = format!("agent:{}", agent);
let agent_name = format!("agent:{}", agent);
rt.block_on(
crate::store::TASK_PROVENANCE.scope(prov,
crate::store::TASK_AGENT.scope(agent_name,
call_api_with_tools(agent, prompts, temperature, bail_fn, log))
)
}).join().unwrap()