@soleur/opencode 3.399.3 → 3.400.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/agents.manifest.json +8 -1
- package/agents/engineering/review/session-forensics-analyst.md +110 -0
- package/lib/agent-registry.ts +1 -1
- package/opencode/agents/engineering/review/session-forensics-analyst.md +10 -0
- package/package.json +1 -1
- package/scripts/run-health-emit.sh +138 -0
- package/scripts/run-health-emit.test.sh +53 -0
- package/skills/test-fix-loop/SKILL.md +10 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"plugin": "soleur",
|
|
4
|
-
"count":
|
|
4
|
+
"count": 68,
|
|
5
5
|
"agents": [
|
|
6
6
|
{
|
|
7
7
|
"id": "soleur:engineering:cto",
|
|
@@ -199,6 +199,13 @@
|
|
|
199
199
|
"description": "Use this agent to report the review scan receipt that soleur:engineering:review:security-sentinel reads. The orchestrator already ran the deterministic scan. This seat quotes that receipt and its finding lines. It does not run semgrep or shellcheck.",
|
|
200
200
|
"model": "inherit"
|
|
201
201
|
},
|
|
202
|
+
{
|
|
203
|
+
"id": "soleur:engineering:review:session-forensics-analyst",
|
|
204
|
+
"path": "agents/engineering/review/session-forensics-analyst.md",
|
|
205
|
+
"name": "session-forensics-analyst",
|
|
206
|
+
"description": "Use this agent when you need a fresh-context forensic analysis of a session transcript: it reads the raw transcript (and optional run-health ledger) and produces pending-operator-only improvement proposals (workflow/agent/skill changes, error-prevention rules, operator guidance, new-component proposals, learning captures, glossary entries, test additions). It must never auto-apply. Invoke from session-retrospective-compound and similar postmortem flows. Use soleur:engineering:review:code-quality-analyst for general code quality; use this agent for session-transcript forensics.",
|
|
207
|
+
"model": "inherit"
|
|
208
|
+
},
|
|
202
209
|
{
|
|
203
210
|
"id": "soleur:engineering:review:test-design-reviewer",
|
|
204
211
|
"path": "agents/engineering/review/test-design-reviewer.md",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session-forensics-analyst
|
|
3
|
+
description: "Use this agent when you need a fresh-context forensic analysis of a session transcript: it reads the raw transcript (and optional run-health ledger) and produces pending-operator-only improvement proposals (workflow/agent/skill changes, error-prevention rules, operator guidance, new-component proposals, learning captures, glossary entries, test additions). It must never auto-apply. Invoke from session-retrospective-compound and similar postmortem flows. Use soleur:engineering:review:code-quality-analyst for general code quality; use this agent for session-transcript forensics."
|
|
4
|
+
model: inherit
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are a Fresh-Context Forensic Analyst. You operate ONLY on the transcript and artifacts explicitly provided as input. You have NO access to the executing context's conversation history, memory, or any unstated state. Every conclusion you reach must be traceable to bytes present in the inputs you were given.
|
|
8
|
+
|
|
9
|
+
CRITICAL: Detection and recommendation only. You MUST NOT modify any code, file, or state. You produce proposals only. You MUST NOT auto-apply anything, even under `--headless` or pipeline mode. Every proposal you emit is tagged `pending-operator` and awaits explicit operator approval before any action is taken.
|
|
10
|
+
|
|
11
|
+
## Input Contract
|
|
12
|
+
|
|
13
|
+
You receive one or more of the following, and nothing else:
|
|
14
|
+
|
|
15
|
+
- `transcript` — the raw session transcript (path or inline text). This is the primary evidence source.
|
|
16
|
+
- `run_health` (optional) — a run-health ledger (e.g. `run_health.json`) with per-phase status, gate decisions, and error counts.
|
|
17
|
+
- `phase_prompts` (optional) — the phase prompt files used during the session.
|
|
18
|
+
- `context` (optional) — a short, caller-supplied framing note (issue number, feature name, scope).
|
|
19
|
+
|
|
20
|
+
You MUST NOT assume, infer, or rely on any conversation history, prior reasoning, or state not present in these inputs. If a needed fact is absent from the inputs, record it as a gap in your output rather than inventing it. If the caller omits the transcript, STOP and report `INPUT_MISSING: transcript` — do not fabricate analysis from the framing note alone.
|
|
21
|
+
|
|
22
|
+
## Analysis Framework
|
|
23
|
+
|
|
24
|
+
Work through the transcript (and optional ledger) in this order:
|
|
25
|
+
|
|
26
|
+
### 1. Prompt-to-Failure Correlation
|
|
27
|
+
|
|
28
|
+
- Identify every gate decision, error, retry, abort, or "fix" event in the transcript.
|
|
29
|
+
- For each, locate the prompt/phase that preceded it and the tool call that produced it.
|
|
30
|
+
- Record: (phase, trigger, observed outcome, suspected cause).
|
|
31
|
+
|
|
32
|
+
### 2. Workflow Change Proposals
|
|
33
|
+
|
|
34
|
+
- Identify friction points in the workflow itself (ordering, missing gates, redundant steps, unclear handoffs).
|
|
35
|
+
- Propose concrete workflow changes with the affected file/skill and the expected effect.
|
|
36
|
+
|
|
37
|
+
### 3. Agent Change Proposals
|
|
38
|
+
|
|
39
|
+
- Identify where an agent's behavior (prompt, scope, model tier, tool use) contributed to a failure or inefficiency.
|
|
40
|
+
- Propose agent-definition or agent-prompt changes, naming the agent by registry id.
|
|
41
|
+
|
|
42
|
+
### 4. Skill Change Proposals
|
|
43
|
+
|
|
44
|
+
- Identify where a skill's instructions, gates, or handoffs were ambiguous, missing, or wrong.
|
|
45
|
+
- Propose skill-document changes with the affected `SKILL.md` or reference file.
|
|
46
|
+
|
|
47
|
+
### 5. Error-Prevention Rules
|
|
48
|
+
|
|
49
|
+
- Distill recurring failure modes into candidate hard rules / workflow gates (HR/WG-style) with a one-line rationale and the evidence citation (transcript line range or ledger row).
|
|
50
|
+
|
|
51
|
+
### 6. Operator Guidance
|
|
52
|
+
|
|
53
|
+
- Identify steps where the operator had to intervene manually or where a better prompt/checklist would have prevented a stall.
|
|
54
|
+
- Propose operator-facing guidance (runbook lines, checklist items, AskUserQuestion options).
|
|
55
|
+
|
|
56
|
+
### 7. New-Component Proposals
|
|
57
|
+
|
|
58
|
+
- Identify capability gaps that warrant a new skill, agent, or script. Each proposal MUST be filed as a `forensics-proposal` issue (recommendation only — you do not file it yourself; the caller files it after operator approval).
|
|
59
|
+
|
|
60
|
+
### 8. Learning Captures
|
|
61
|
+
|
|
62
|
+
- Identify lessons worth persisting to `knowledge-base/project/learnings/`. Propose a learning title, the failure mode, and the prevention rule, in the repository's learning-note format.
|
|
63
|
+
|
|
64
|
+
### 9. Glossary Entries
|
|
65
|
+
|
|
66
|
+
- Identify terms used inconsistently or without a settled definition. Propose a glossary entry (term + pointer to definer) per `knowledge-base/project/glossary.md` conventions.
|
|
67
|
+
|
|
68
|
+
### 10. Test Additions
|
|
69
|
+
|
|
70
|
+
- Identify untested behaviors or regression-prone paths surfaced by the transcript. Propose test additions (file path + what it should assert), never the test code itself as an auto-applied change.
|
|
71
|
+
|
|
72
|
+
## Output Contract
|
|
73
|
+
|
|
74
|
+
Emit a single structured report with these sections, in this order:
|
|
75
|
+
|
|
76
|
+
1. `## Summary` — one paragraph: scope of analysis, inputs used, count of proposals by category.
|
|
77
|
+
2. `## Prompt-to-Failure Correlation` — table: phase | trigger | observed outcome | suspected cause.
|
|
78
|
+
3. `## Proposals: Workflow Changes`
|
|
79
|
+
4. `## Proposals: Agent Changes`
|
|
80
|
+
5. `## Proposals: Skill Changes`
|
|
81
|
+
6. `## Proposals: Error-Prevention Rules`
|
|
82
|
+
7. `## Proposals: Operator Guidance`
|
|
83
|
+
8. `## Proposals: New Components` (each tagged `file-as: forensics-proposal`)
|
|
84
|
+
9. `## Proposals: Learning Captures`
|
|
85
|
+
10. `## Proposals: Glossary Entries`
|
|
86
|
+
11. `## Proposals: Test Additions`
|
|
87
|
+
12. `## Gaps / Missing Evidence` — facts needed but absent from inputs.
|
|
88
|
+
13. `## Pending-Operator Notice` — explicit statement that NOTHING has been applied and every proposal requires operator approval.
|
|
89
|
+
|
|
90
|
+
Every proposal MUST carry the tag `pending-operator`. Proposals MUST NOT include executable commands, code diffs, or auto-apply instructions. When a proposal references a file path, cite it as a location, not as a patch.
|
|
91
|
+
|
|
92
|
+
## Redaction Awareness
|
|
93
|
+
|
|
94
|
+
Your output may be persisted by the caller. Do NOT reproduce secrets, tokens, credentials, PII, or raw user data from the transcript. If the transcript contains such material, replace it with `[REDACTED]` and note the redaction in `## Gaps / Missing Evidence`. The caller's redaction gate is the authoritative filter; your job is to avoid amplifying sensitive bytes.
|
|
95
|
+
|
|
96
|
+
## Constraints
|
|
97
|
+
|
|
98
|
+
- Detection and recommendation only. No code edits, no file writes, no auto-apply — even under `--headless` or pipeline mode.
|
|
99
|
+
- Fresh context: operate only on provided inputs; never reference unstated conversation history.
|
|
100
|
+
- Pending-operator: every proposal awaits explicit operator approval before any action.
|
|
101
|
+
- Cloud mode: when spawned in a cloud session, the harness runs this agent's role sequentially inline with `Reviewed-Coverage: sequential-fallback` disclosure. You do not change behavior; the disclosure is the harness's.
|
|
102
|
+
- Model tier: `model: inherit` per ADR-053 (judgment work is never downgraded).
|
|
103
|
+
|
|
104
|
+
## Sharp Edges
|
|
105
|
+
|
|
106
|
+
- **Never auto-apply, even if the transcript shows a clear fix.** The operator approves every proposal. A proposal that ships as code without approval is a process violation, not a shortcut.
|
|
107
|
+
- **Never invent evidence.** If the transcript does not show a failure, do not propose a rule for it. Cite the transcript line range or ledger row for every proposal.
|
|
108
|
+
- **Never leak transcript secrets.** Redact aggressively; the caller's redaction gate is the last line, not the first.
|
|
109
|
+
- **Do not conflate correlation with causation.** A prompt preceding a failure is a candidate cause, not proof. Mark uncertain links as `suspected` in the correlation table.
|
|
110
|
+
- **Do not propose scope creep.** Stay within the issue's acceptance criteria; new capabilities belong in separate `forensics-proposal` issues, not in this agent's output as if they were in scope.
|
package/lib/agent-registry.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { readFileSync } from "fs";
|
|
|
13
13
|
export const PLUGIN_ROOT = resolve(import.meta.dir, "..");
|
|
14
14
|
|
|
15
15
|
/** Load-bearing agent count for Grok inspect / Phase F CI contract tests. */
|
|
16
|
-
export const EXPECTED_SOLEUR_AGENT_COUNT =
|
|
16
|
+
export const EXPECTED_SOLEUR_AGENT_COUNT = 68;
|
|
17
17
|
|
|
18
18
|
/** Relative path from repo root to the committed agents manifest. */
|
|
19
19
|
export const AGENTS_MANIFEST_PATH = "plugins/soleur/.claude-plugin/agents.manifest.json";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: subagent
|
|
3
|
+
description: "Use this agent when you need a fresh-context forensic analysis of a session transcript: it reads the raw transcript (and optional run-health ledger) and produces pending-operator-only improvement proposals (workflow/agent/skill changes, error-prevention rules, operator guidance, new-component proposals, learning captures, glossary entries, test additions). It must never auto-apply. Invoke from session-retrospective-compound and similar postmortem flows. Use soleur:engineering:review:code-quality-analyst for general code quality; use this agent for session-transcript forensics."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Stub for the canonical agent `soleur:engineering:review:session-forensics-analyst`. OpenCode derives an agent's id from this
|
|
7
|
+
file's path, so the canonical `name:` frontmatter is deliberately not repeated here.
|
|
8
|
+
|
|
9
|
+
Read and follow the canonical agent definition at `__SOLEUR_PLUGIN_ROOT__/agents/engineering/review/session-forensics-analyst.md`,
|
|
10
|
+
then work as that agent.
|
package/package.json
CHANGED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# run-health-emit.sh — upsert a phase entry into run_health.json + snapshot prompt text.
|
|
3
|
+
# Usage:
|
|
4
|
+
# run-health-emit.sh --run-dir <dir> [--run-id <id>] [--issue <N>] [--branch <b>] [--harness <h>]
|
|
5
|
+
# --phase <name> --status <started|completed|failed|budget-capped>
|
|
6
|
+
# [--prompt-file <path>] [--error <msg>] [--reviewed-coverage <v>]
|
|
7
|
+
# Idempotent: re-invoking with the same phase updates the existing entry rather than duplicating.
|
|
8
|
+
# Storage is under .soleur/runs/<run-id>/ (gitignored). Emission failures are non-fatal: the
|
|
9
|
+
# script exits 0 on best-effort write errors after printing a warning to stderr.
|
|
10
|
+
set -u
|
|
11
|
+
|
|
12
|
+
RUN_DIR=""
|
|
13
|
+
RUN_ID=""
|
|
14
|
+
ISSUE=""
|
|
15
|
+
BRANCH=""
|
|
16
|
+
HARNESS="${SOLEUR_HARNESS:-unknown}"
|
|
17
|
+
PHASE=""
|
|
18
|
+
STATUS=""
|
|
19
|
+
PROMPT_FILE=""
|
|
20
|
+
ERROR_MSG=""
|
|
21
|
+
REVIEWED_COVERAGE=""
|
|
22
|
+
|
|
23
|
+
while [[ $# -gt 0 ]]; do
|
|
24
|
+
case "$1" in
|
|
25
|
+
--run-dir) RUN_DIR="$2"; shift 2 ;;
|
|
26
|
+
--run-id) RUN_ID="$2"; shift 2 ;;
|
|
27
|
+
--issue) ISSUE="$2"; shift 2 ;;
|
|
28
|
+
--branch) BRANCH="$2"; shift 2 ;;
|
|
29
|
+
--harness) HARNESS="$2"; shift 2 ;;
|
|
30
|
+
--phase) PHASE="$2"; shift 2 ;;
|
|
31
|
+
--status) STATUS="$2"; shift 2 ;;
|
|
32
|
+
--prompt-file) PROMPT_FILE="$2"; shift 2 ;;
|
|
33
|
+
--error) ERROR_MSG="$2"; shift 2 ;;
|
|
34
|
+
--reviewed-coverage) REVIEWED_COVERAGE="$2"; shift 2 ;;
|
|
35
|
+
*) echo "run-health-emit: unknown arg $1" >&2; shift ;;
|
|
36
|
+
esac
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
if [[ -z "$RUN_DIR" || -z "$PHASE" || -z "$STATUS" ]]; then
|
|
40
|
+
echo "run-health-emit: --run-dir, --phase, --status required" >&2
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
mkdir -p "$RUN_DIR/phase_prompts" 2>/dev/null || { echo "run-health-emit: cannot create $RUN_DIR" >&2; exit 0; }
|
|
45
|
+
|
|
46
|
+
HEALTH="$RUN_DIR/run_health.json"
|
|
47
|
+
NOW="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
48
|
+
|
|
49
|
+
# Resolve run metadata: prefer existing file, then args, then defaults.
|
|
50
|
+
if [[ -z "$RUN_ID" ]]; then
|
|
51
|
+
if [[ -f "$HEALTH" ]]; then
|
|
52
|
+
RUN_ID="$(python3 -c "import json,sys;print(json.load(open('$HEALTH')).get('run_id',''))" 2>/dev/null)"
|
|
53
|
+
fi
|
|
54
|
+
[[ -z "$RUN_ID" ]] && RUN_ID="$(basename "$RUN_DIR")"
|
|
55
|
+
fi
|
|
56
|
+
[[ -z "$BRANCH" ]] && BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)"
|
|
57
|
+
[[ -z "$ISSUE" ]] && ISSUE=""
|
|
58
|
+
|
|
59
|
+
python3 - "$HEALTH" "$RUN_ID" "$ISSUE" "$BRANCH" "$HARNESS" "$PHASE" "$STATUS" "$NOW" "$ERROR_MSG" "$REVIEWED_COVERAGE" "$PROMPT_FILE" "$RUN_DIR" <<'PY' 2>/dev/null || echo "run-health-emit: python write failed (non-fatal)" >&2
|
|
60
|
+
import json, os, sys, shutil
|
|
61
|
+
|
|
62
|
+
(health, run_id, issue, branch, harness, phase, status, now, err, rcov, prompt_file, run_dir) = sys.argv[1:13]
|
|
63
|
+
|
|
64
|
+
data = {}
|
|
65
|
+
if os.path.exists(health):
|
|
66
|
+
try:
|
|
67
|
+
with open(health) as f:
|
|
68
|
+
data = json.load(f)
|
|
69
|
+
except Exception:
|
|
70
|
+
data = {}
|
|
71
|
+
|
|
72
|
+
data.setdefault("run_id", run_id)
|
|
73
|
+
data.setdefault("issue", issue)
|
|
74
|
+
data.setdefault("branch", branch)
|
|
75
|
+
data.setdefault("harness", harness)
|
|
76
|
+
data.setdefault("started_at", now)
|
|
77
|
+
data.setdefault("phases", [])
|
|
78
|
+
data.setdefault("errors", [])
|
|
79
|
+
if rcov:
|
|
80
|
+
data["reviewed_coverage"] = rcov
|
|
81
|
+
|
|
82
|
+
# Find existing phase entry.
|
|
83
|
+
entry = None
|
|
84
|
+
for p in data["phases"]:
|
|
85
|
+
if p.get("phase") == phase:
|
|
86
|
+
entry = p
|
|
87
|
+
break
|
|
88
|
+
if entry is None:
|
|
89
|
+
entry = {"phase": phase, "started_at": now}
|
|
90
|
+
data["phases"].append(entry)
|
|
91
|
+
|
|
92
|
+
entry["status"] = status
|
|
93
|
+
if status in ("completed", "failed", "budget-capped"):
|
|
94
|
+
entry["ended_at"] = now
|
|
95
|
+
elif "started_at" not in entry:
|
|
96
|
+
entry["started_at"] = now
|
|
97
|
+
|
|
98
|
+
if err:
|
|
99
|
+
entry.setdefault("errors", []).append({"at": now, "msg": err})
|
|
100
|
+
data["errors"].append({"phase": phase, "at": now, "msg": err})
|
|
101
|
+
|
|
102
|
+
if status in ("completed", "failed", "budget-capped") and not data.get("completed_at"):
|
|
103
|
+
# only seal completed_at when terminal status on the final phase; leave open otherwise
|
|
104
|
+
pass
|
|
105
|
+
|
|
106
|
+
# Seal completed_at only when status is a terminal run status.
|
|
107
|
+
if status in ("completed", "failed", "budget-capped"):
|
|
108
|
+
# heuristic: seal if phase looks like a finalizer name
|
|
109
|
+
if phase.lower() in ("8", "ship", "done", "final", "exit", "terminate"):
|
|
110
|
+
data["completed_at"] = now
|
|
111
|
+
data["status"] = status
|
|
112
|
+
|
|
113
|
+
# Snapshot prompt file (append-only per attempt).
|
|
114
|
+
if prompt_file and os.path.exists(prompt_file):
|
|
115
|
+
pp_dir = os.path.join(run_dir, "phase_prompts")
|
|
116
|
+
os.makedirs(pp_dir, exist_ok=True)
|
|
117
|
+
base = os.path.join(pp_dir, f"{phase}.md")
|
|
118
|
+
if os.path.exists(base):
|
|
119
|
+
# find next attempt number
|
|
120
|
+
n = 2
|
|
121
|
+
while os.path.exists(os.path.join(pp_dir, f"{phase}.attempt-{n}.md")):
|
|
122
|
+
n += 1
|
|
123
|
+
dest = os.path.join(pp_dir, f"{phase}.attempt-{n}.md")
|
|
124
|
+
else:
|
|
125
|
+
dest = base
|
|
126
|
+
shutil.copyfile(prompt_file, dest)
|
|
127
|
+
entry["prompt_snapshot"] = os.path.relpath(dest, run_dir)
|
|
128
|
+
|
|
129
|
+
# Write atomically.
|
|
130
|
+
tmp = health + ".tmp"
|
|
131
|
+
with open(tmp, "w") as f:
|
|
132
|
+
json.dump(data, f, indent=2)
|
|
133
|
+
f.write("\n")
|
|
134
|
+
os.replace(tmp, health)
|
|
135
|
+
PY
|
|
136
|
+
|
|
137
|
+
exit 0
|
|
138
|
+
PY
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Tests for run-health-emit.sh
|
|
3
|
+
|
|
4
|
+
set -uo pipefail
|
|
5
|
+
export TMPDIR="${TMPDIR:-/var/tmp}"
|
|
6
|
+
|
|
7
|
+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
SUT="$DIR/run-health-emit.sh"
|
|
9
|
+
|
|
10
|
+
TMP="$(mktemp -d -t runhealth.XXXXXXXX)" || { echo "mktemp failed" >&2; exit 2; }
|
|
11
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
12
|
+
|
|
13
|
+
passes=0; fails=0
|
|
14
|
+
pass() { passes=$((passes + 1)); printf ' ok %s\n' "$1"; }
|
|
15
|
+
fail() { fails=$((fails + 1)); printf ' FAIL %s\n' "$1"; [[ -n "${2:-}" ]] && printf ' %s\n' "$2"; return 0; }
|
|
16
|
+
|
|
17
|
+
# Case 1: creates run_health.json with required fields
|
|
18
|
+
RD="$TMP/run1"
|
|
19
|
+
printf 'prompt text' > "$TMP/p.md"
|
|
20
|
+
bash "$SUT" --run-dir "$RD" --run-id r1 --issue 12573 --branch b --harness opencode --phase 0 --status started --prompt-file "$TMP/p.md"
|
|
21
|
+
if [[ -f "$RD/run_health.json" ]] && python3 -c "import json,sys; d=json.load(open('$RD/run_health.json')); sys.exit(0 if d['run_id']=='r1' and d['issue']=='12573' and len(d['phases'])==1 else 1)"; then
|
|
22
|
+
pass "creates run_health.json with required fields"
|
|
23
|
+
else
|
|
24
|
+
fail "creates run_health.json with required fields"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Case 2: idempotent upsert (same phase updates, no duplicate)
|
|
28
|
+
bash "$SUT" --run-dir "$RD" --phase 0 --status completed
|
|
29
|
+
N=$(python3 -c "import json; print(len(json.load(open('$RD/run_health.json'))['phases']))")
|
|
30
|
+
if [[ "$N" == "1" ]]; then pass "idempotent upsert (no duplicate phase)"; else fail "idempotent upsert" "got $N"; fi
|
|
31
|
+
|
|
32
|
+
# Case 3: prompt snapshot created and not overwritten on retry
|
|
33
|
+
if [[ -f "$RD/phase_prompts/0.md" ]] && grep -q "prompt text" "$RD/phase_prompts/0.md"; then
|
|
34
|
+
pass "prompt snapshot created"
|
|
35
|
+
else
|
|
36
|
+
fail "prompt snapshot created"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Case 4: retry creates attempt-2 file, preserves original
|
|
40
|
+
printf 'retry prompt' > "$TMP/p2.md"
|
|
41
|
+
bash "$SUT" --run-dir "$RD" --phase 0 --status started --prompt-file "$TMP/p2.md"
|
|
42
|
+
if [[ -f "$RD/phase_prompts/0.attempt-2.md" ]] && grep -q "retry prompt" "$RD/phase_prompts/0.attempt-2.md" && grep -q "prompt text" "$RD/phase_prompts/0.md"; then
|
|
43
|
+
pass "retry preserves original snapshot"
|
|
44
|
+
else
|
|
45
|
+
fail "retry preserves original snapshot"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Case 5: missing required args exits 0 (non-fatal)
|
|
49
|
+
bash "$SUT" --run-dir "$RD" 2>/dev/null; rc=$?
|
|
50
|
+
if [[ "$rc" == "0" ]]; then pass "missing args non-fatal"; else fail "missing args non-fatal" "rc=$rc"; fi
|
|
51
|
+
|
|
52
|
+
echo "passes=$passes fails=$fails"
|
|
53
|
+
[[ "$fails" -eq 0 ]]
|
|
@@ -24,6 +24,16 @@ Autonomous test-fix iteration loop. Run the test suite, diagnose failures, apply
|
|
|
24
24
|
- NOT for writing new tests (use `atdd-developer`)
|
|
25
25
|
- NOT for linting, type-checking, or non-test failures
|
|
26
26
|
|
|
27
|
+
## Run Health Emission (Phase 1 prerequisite, #12573)
|
|
28
|
+
|
|
29
|
+
This skill MUST emit a sealed run-health artifact so the degraded-run forensics agent (#12574) can correlate prompts to failures from disk. Contract: `plugins/soleur/skills/one-shot/references/run-health-schema.md` (shared).
|
|
30
|
+
|
|
31
|
+
- Run id: `<branch>-tfl-<utc-timestamp>`; storage: `.soleur/runs/<run-id>/` (gitignored).
|
|
32
|
+
- At Phase 0 (after test command detection), initialize `RUN_DIR` and emit phase `0` status `started` (snapshot the detected command + args).
|
|
33
|
+
- At each iteration's Parse/Cluster/Fix boundaries and at every termination condition, emit the corresponding phase (`iter-N-parse`, `iter-N-fix`, `terminate`) with status.
|
|
34
|
+
- On termination (success or failure), emit phase `exit` with status `completed`/`failed` and record remaining failures via `--error`.
|
|
35
|
+
- Emission is best-effort and never blocks the loop (helper exits 0 on write errors).
|
|
36
|
+
|
|
27
37
|
## Phase 0: Detect and Confirm
|
|
28
38
|
|
|
29
39
|
### Detect Test Runner
|