fix(hive-claude): don't scan model-authored assistant/user content for CLI failure markers
This commit is contained in:
parent
25540755f4
commit
50d801b6c9
2 changed files with 90 additions and 28 deletions
|
|
@ -152,12 +152,14 @@ fn build_command(program: &str, config: &Config, attach: &Attach) -> Command {
|
|||
async fn pump_stdout(stdout: ChildStdout, sink: &impl Sink, sentinels: &Sentinels) {
|
||||
let mut lines = BufReader::new(stdout).lines();
|
||||
while let Ok(Some(line)) = lines.next_line().await {
|
||||
sentinels.scan_line(&line);
|
||||
if let Ok(event) = serde_json::from_str::<serde_json::Value>(&line) {
|
||||
// JSON stdout: classify with the model-content gate so an
|
||||
// `assistant`/`user` message quoting a marker can't trip it.
|
||||
sentinels.scan_stdout_json(&event, &line);
|
||||
sink.on_event(&event);
|
||||
} else {
|
||||
sentinels.scan_rate_limit_text(&line);
|
||||
// Non-JSON stdout is CLI text, not conversation — trust all markers.
|
||||
sentinels.scan_cli_line(&line);
|
||||
sink.on_stdout_line(&line);
|
||||
}
|
||||
}
|
||||
|
|
@ -170,8 +172,8 @@ async fn pump_stderr(stderr: ChildStderr, sink: &impl Sink, sentinels: &Sentinel
|
|||
let mut lines = BufReader::new(stderr).lines();
|
||||
let mut tail: VecDeque<String> = VecDeque::with_capacity(STDERR_TAIL_LINES);
|
||||
while let Ok(Some(line)) = lines.next_line().await {
|
||||
sentinels.scan_line(&line);
|
||||
sentinels.scan_rate_limit_text(&line);
|
||||
// stderr is always CLI output — trust all markers.
|
||||
sentinels.scan_cli_line(&line);
|
||||
sink.on_stderr_line(&line);
|
||||
if tail.len() >= STDERR_TAIL_LINES {
|
||||
tail.pop_front();
|
||||
|
|
|
|||
Loading…
Reference in a new issue