Revert output tool hacks (AST scanning + silent success)

These were wrong approaches — replacing with proper closure-based
output tool that writes directly to shared Subconscious state.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 20:07:20 -04:00
parent 68fbcc351f
commit d167b11283
2 changed files with 5 additions and 29 deletions

View file

@ -245,13 +245,11 @@ fn output(args: &serde_json::Value) -> Result<String> {
anyhow::bail!("invalid output key: {}", key);
}
let value = get_str(args, "value")?;
// Write to disk if output dir is set (subprocess agents),
// otherwise just return success (forked agents extract from AST)
if let Ok(dir) = std::env::var("POC_AGENT_OUTPUT_DIR") {
let path = std::path::Path::new(&dir).join(&key);
std::fs::write(&path, &value)
.with_context(|| format!("writing output {}", path.display()))?;
}
let dir = std::env::var("POC_AGENT_OUTPUT_DIR")
.map_err(|_| anyhow::anyhow!("no output directory set"))?;
let path = std::path::Path::new(&dir).join(key);
std::fs::write(&path, value)
.with_context(|| format!("writing output {}", path.display()))?;
Ok(format!("{}: {}", key, value))
}