loop-engineering icon indicating copy to clipboard operation
loop-engineering copied to clipboard

loop-context: summary and status ignore --similarity-threshold

Open lhy-dcf opened this issue 3 weeks ago • 0 comments

Describe the bug

loop-context --summary --json --similarity-threshold 0.5 ignores the explicit threshold when grouping errors. --status has the same omission. The library API and --inject honor it, so the same run gets inconsistent failure-pattern summaries depending on the CLI operation.

Steps to reproduce

On main 68ccc887, use two failed attempts with errors connection timeout in worker alpha and connection timeout in worker beta (different actions). Their normalized Jaccard similarity is about 0.732.

Run the built CLI with this ledger on stdin and --summary --json --similarity-threshold 0.5.

Expected behavior

One error group with count 2 at threshold 0.5; two groups at the default 0.85 or threshold 1. Human-readable --status should use the same grouping threshold as the circuit-breaker decision shown below it.

Actual behavior

The CLI exits 0 but returns two groups regardless of 0.5. Both summary/status call summarizeAttempts(ledger) and omit the parsed value, while buildContextInjection already passes breaker.similarityThreshold.

Environment

Windows, Node 22.16.0; loop-context 1.5.0 at current main. Local synthetic CLI subprocess repro, no model or private data.

Proposed scope

Pass the already validated threshold to the two summary calls; add subprocess coverage for explicit/default grouping across summary and status. No new flag, grouping algorithm or breaker policy. Searched issues and all-state PRs for summary/similarity/threshold and found no matching fix. AI-assisted investigation with reproduction executed locally.

lhy-dcf avatar Nov 08 '26 05:11 lhy-dcf