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:
parent
b1efdf0b9a
commit
85302c11d4
5 changed files with 79 additions and 53 deletions
|
|
@ -339,6 +339,11 @@ fn run_one_agent_inner(
|
|||
}
|
||||
log("\n=== CALLING LLM ===");
|
||||
|
||||
// Set initial phase for provenance tracking
|
||||
if let Some(first_phase) = step_phases.first() {
|
||||
crate::store::set_phase(first_phase);
|
||||
}
|
||||
|
||||
// Bail check: if the agent defines a bail script, run it between steps.
|
||||
// The script receives the pid file path as $1, cwd = state dir.
|
||||
let bail_script = def.bail.as_ref().map(|name| {
|
||||
|
|
@ -349,9 +354,10 @@ fn run_one_agent_inner(
|
|||
let state_dir_for_bail = state_dir.clone();
|
||||
let pid_path_for_bail = pid_path.clone();
|
||||
let bail_fn = move |step_idx: usize| -> Result<(), String> {
|
||||
// Update phase
|
||||
// Update phase in pid file and provenance tracking
|
||||
if step_idx < step_phases.len() {
|
||||
write_pid(&step_phases[step_idx]);
|
||||
crate::store::set_phase(&step_phases[step_idx]);
|
||||
}
|
||||
// Run bail script if defined
|
||||
if let Some(ref script) = bail_script {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue