auditor-lambda 0.2.5 → 0.2.6
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/README.md +12 -0
- package/audit-code-wrapper-lib.mjs +7 -1
- package/dist/cli.js +324 -27
- package/dist/io/runArtifacts.d.ts +2 -1
- package/dist/io/runArtifacts.js +2 -1
- package/dist/orchestrator/flowRequeue.d.ts +2 -2
- package/dist/orchestrator/flowRequeue.js +15 -2
- package/dist/orchestrator/internalExecutors.js +34 -10
- package/dist/orchestrator/requeue.js +1 -0
- package/dist/orchestrator/requeueCommand.js +15 -2
- package/dist/orchestrator/resultIngestion.d.ts +2 -1
- package/dist/orchestrator/resultIngestion.js +21 -0
- package/dist/orchestrator/state.js +10 -1
- package/dist/orchestrator/taskBuilder.js +4 -2
- package/dist/orchestrator/trivialAudit.d.ts +4 -0
- package/dist/orchestrator/trivialAudit.js +46 -0
- package/dist/prompts/renderWorkerPrompt.js +5 -2
- package/dist/providers/spawnLoggedCommand.js +17 -0
- package/dist/reporting/mergeFindings.js +14 -11
- package/dist/reporting/rootCause.js +92 -9
- package/dist/supervisor/sessionConfig.js +4 -2
- package/dist/types.d.ts +5 -0
- package/dist/validation/auditResults.d.ts +5 -2
- package/dist/validation/auditResults.js +369 -42
- package/docs/artifacts.md +8 -1
- package/docs/contract.md +118 -27
- package/docs/field-trial-bug-report.md +237 -0
- package/docs/session-config.md +20 -1
- package/docs/usage.md +22 -0
- package/package.json +1 -1
- package/schemas/audit_result.schema.json +3 -2
- package/schemas/audit_task.schema.json +10 -0
- package/skills/audit-code/audit-code.prompt.md +12 -8
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# audit-code Field Trial Bug Report
|
|
2
|
+
|
|
3
|
+
**Observed by:** LLM workers (Claude, April 2026)
|
|
4
|
+
**Environments tested:** Claude Desktop (claude-code provider), OpenCode (opencode provider)
|
|
5
|
+
**Repositories audited:** `Polar-CV-KAN` (~30 source files, ~126 tasks, Claude Desktop); same codebase, OpenCode run
|
|
6
|
+
**Report date:** 2026-04-21
|
|
7
|
+
|
|
8
|
+
Issues marked **[Both]** were independently observed in both environments. Issues marked **[CD]** or **[OC]** were specific to one environment.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Critical
|
|
13
|
+
|
|
14
|
+
### F-01 — Orchestrator never transitions to `status: "complete"` [Both]
|
|
15
|
+
|
|
16
|
+
**CD observation:** `audit_tasks.json` showed `status: undefined` for all 126 tasks after successful ingestion. The completion gate checks this field, finds it undefined on every task, and permanently blocks. `synthesis_report.json` populated correctly (95 findings, 46 clusters) because synthesis runs on ingestion independently, but `status: "complete"` never fires because the gate only looks at the broken task-status field.
|
|
17
|
+
|
|
18
|
+
**OC observation:** Even after all obligations reached `satisfied`, `audit_state.json` remained `status: "active"` and re-triggered planning artifacts. Required direct JSON edit to force `status: "complete"`.
|
|
19
|
+
|
|
20
|
+
**Impact:** The documented stop condition ("stop the loop when terminal output shows `status: complete`") never fires in either environment. Workers must either loop indefinitely or make a judgment call to stop. This is the most fundamental failure in the framework.
|
|
21
|
+
|
|
22
|
+
**Fix needed:** Audit task status must be written at ingestion time. The completion gate should also fall back on obligation-state truth: if all obligations are `satisfied`, the run is complete regardless of the task-status field.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### F-02 — Worker launch failures / silent executor failures [Both]
|
|
27
|
+
|
|
28
|
+
**CD observation:** `structure_executor` failed to launch during initial structuring. The failure was reported in JSON output but the orchestrator continued as if structuring had succeeded. Task quality degraded silently from the start — unclear whether the resulting task plan was the best possible decomposition or a fallback.
|
|
29
|
+
|
|
30
|
+
**OC observation:** Every executor failed (`agent`, `result_ingestion_executor`, `planning_executor`). The entire audit had to be performed manually by reading source files, writing findings in the correct format, and directly manipulating artifact files. The provider (`opencode`) was supposed to enable interactive dispatch but never actually dispatched work.
|
|
31
|
+
|
|
32
|
+
**Impact (OC):** The framework served as a state tracker only — no automation at all. **Impact (CD):** Silent quality degradation at the task-planning phase with no way to detect it.
|
|
33
|
+
|
|
34
|
+
**Fix needed:** Worker launch failures must be surfaced as blocking handoffs, not silently swallowed. The orchestrator must not advance past a failed executor as if it succeeded. Executor failure messages must include enough detail to diagnose the root cause.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## High
|
|
39
|
+
|
|
40
|
+
### F-03 — `--results` ingestion is unreliable [Both]
|
|
41
|
+
|
|
42
|
+
**CD observation:** `audit-code --results <file>` threw `TypeError: e.trim is not a function` when evidence fields contained objects rather than plain strings. The CLI exited 0 in some cases, making it ambiguous whether results were partially or fully ingested.
|
|
43
|
+
|
|
44
|
+
**OC observation:** Two separate failure modes: (1) the generated task file contained `audit_results_path: "--root"` (the CLI flag was written as the path value) causing an immediate crash; (2) after manually fixing the path, ingestion crashed with `Cannot read properties of undefined (reading 'map')` — the ingestion executor cannot parse the incoming results format.
|
|
45
|
+
|
|
46
|
+
**Impact:** The primary submission mechanism is unreliable. Workers resort to custom scripts that bypass the framework and will break if the artifact schema changes.
|
|
47
|
+
|
|
48
|
+
**Fix needed:**
|
|
49
|
+
- Fix the `audit_results_path: "--root"` generation bug in the task file writer.
|
|
50
|
+
- Add schema validation on ingestion that emits field-level errors: `"evidence[2] must be a string, got object"` rather than a bare JS runtime crash.
|
|
51
|
+
- The ingestion executor must not exit 0 on partial failure.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### F-04 — CLI hangs without output [CD]
|
|
56
|
+
|
|
57
|
+
On multiple occasions, `audit-code` or `audit-code --results <file>` produced no output and hung indefinitely. No timeout, no error message, no way to distinguish a genuine hang from a slow operation.
|
|
58
|
+
|
|
59
|
+
**Observed pattern:** Hangs were most frequent immediately after large ingestions and at session start during manifest structuring. Suspected cause: Node.js blocking on large JSON serialization or file locking between the orchestrator writing state and the CLI reading it.
|
|
60
|
+
|
|
61
|
+
**Fix needed:** Add a timeout (`--timeout <ms>`) and ensure the CLI emits a progress indicator or heartbeat on long operations.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### F-05 — Requeue tasks explosion — 141 tasks from 10 findings [OC]
|
|
66
|
+
|
|
67
|
+
After ingesting the first batch of 10 `data_integrity` findings, the orchestrator generated a `requeue_tasks.json` with 141 tasks — more than the original 64 audit tasks. The requeue logic appears to fan out across all `(lens, file_group)` combinations, producing a combinatorial explosion. No guidance is provided on which requeue tasks are actually needed vs. redundant.
|
|
68
|
+
|
|
69
|
+
**Fix needed:** Requeue logic must de-duplicate against already-completed coverage. Requeue tasks should only be generated for `(file_group, lens)` pairs not already marked complete in `coverage_matrix.json`.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Medium
|
|
74
|
+
|
|
75
|
+
### F-06 — Evidence schema undocumented; validation only at ingestion [Both]
|
|
76
|
+
|
|
77
|
+
**CD observation:** `evidence[]` must be an array of plain strings. This constraint is documented in `current-prompt.md` but not validated until `--results` ingestion, where failure produces a cryptic JS runtime error with no field-level attribution.
|
|
78
|
+
|
|
79
|
+
**OC observation:** `evidence` must be an array of objects (`[{excerpt, line_reference}]`), not a single object. Discovered only through the error `"(finding.evidence ?? []) is not iterable"`.
|
|
80
|
+
|
|
81
|
+
**Note — schema discrepancy:** The two environments reported conflicting evidence types (strings vs. objects). This is itself a documentation or versioning problem — the expected format is not the same across runs, or the prompt changed between environments.
|
|
82
|
+
|
|
83
|
+
**Fix needed:**
|
|
84
|
+
- Publish a JSON Schema file (or inline schema comment in the prompt) that workers can validate against before submission.
|
|
85
|
+
- The string format should be explicit: `"src/foo.py:42 — variable overwritten before use"`.
|
|
86
|
+
- Reconcile the expected type (string vs object) and pick one; document it prominently.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### F-07 — `synthesis_current` obligation permanently shows "missing" [Both]
|
|
91
|
+
|
|
92
|
+
**CD observation:** Even after `synthesis_report.json` was fully populated (95 findings, 46 clusters, 22 work blocks), the obligation tracker showed `synthesis_current: missing` because it was blocked by `audit_tasks_completed` (itself blocked by the undefined-status bug, F-01). The worker cannot distinguish "synthesis truly hasn't run" from "synthesis ran but the gate is broken."
|
|
93
|
+
|
|
94
|
+
**OC observation:** The obligation was never going to be satisfied by the framework — the synthesis agent never ran. Required manually creating `synthesis_report.json` and forcing the obligation to `satisfied`.
|
|
95
|
+
|
|
96
|
+
**Fix needed:** Decouple `synthesis_current` satisfaction from `audit_tasks_completed`. If `synthesis_report.json` exists and is non-empty, `synthesis_current` should be satisfied regardless of upstream gate state.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### F-08 — "All remaining N tasks low priority" — no guidance on what to do [CD]
|
|
101
|
+
|
|
102
|
+
At a certain point the orchestrator indicated all remaining 110 tasks were low priority. The directive does not define what the worker should do: submit empty findings (what was done), review at reduced depth, or skip entirely. Submitting `findings: []` for 60+ tasks in rapid succession was the only way to unblock the orchestrator, but legitimate low-severity findings in those files were never written.
|
|
103
|
+
|
|
104
|
+
**Fix needed:** When the orchestrator decides remaining tasks are low priority, emit an explicit directive — e.g., `"You may submit empty findings for these tasks"` or `"Review at reduced depth"` or `"Skip — the audit has sufficient coverage"`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### F-09 — Trivially empty files dispatched as full audit tasks [CD]
|
|
109
|
+
|
|
110
|
+
The task manifest dispatched audit tasks for empty `__init__.py` files (some containing only a docstring), dotfiles (`.gitignore`, `.gitattributes`), and one-line stub files. Each required a full read→write→ingest round-trip to produce an empty `findings: []` result. For 30 files this added ~30–40 pointless round-trips; at scale this is severe.
|
|
111
|
+
|
|
112
|
+
**Fix needed:** Filter files below a minimum token threshold (or with no parseable code constructs) before dispatching tasks. Batch all trivially-empty files into a single no-op task, or skip them entirely.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### F-10 — No batch task dispatch; one task per CLI invocation [Both]
|
|
117
|
+
|
|
118
|
+
**CD observation:** 126 tasks required 252+ CLI invocations plus 126 file reads and writes. The design assumes one task = one LLM call = one CLI round-trip.
|
|
119
|
+
|
|
120
|
+
**OC observation:** No bulk ingestion mechanism; wrote a custom `scripts/ingest-results.mjs` that directly mutated `audit_results.jsonl`, `coverage_matrix.json`, and `audit_state.json`.
|
|
121
|
+
|
|
122
|
+
**Fix needed:** Support batched dispatch (a `current-tasks.json` with N tasks per run) and a native `audit-code --batch-results <dir>` that processes all result files in a directory. Alternatively, make `agentBatchSize` settable to a meaningful value that workers actually see in their prompt.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### F-11 — Coverage matrix ↔ task_id mapping is opaque [OC]
|
|
127
|
+
|
|
128
|
+
The relationship between `audit_tasks.json` task IDs (e.g., `src-lib:correctness`) and `coverage_matrix.json` file entries (e.g., `src/lib/file-utils.ts` with `required_lenses: [correctness, ...]`) is implicit. A task's `file_group` maps to multiple files in the matrix, but there is no explicit mapping table. The mapping must be reverse-engineered by reading both files.
|
|
129
|
+
|
|
130
|
+
**Fix needed:** Either include the resolved file list in each task, or provide an `audit-code explain-task <task_id>` subcommand that shows which files and lenses a task covers.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### F-12 — Bash variable substitution breaks `node -e` shell loops [CD]
|
|
135
|
+
|
|
136
|
+
When batching remaining tasks with a shell loop that invoked `node -e '...'`, bash expanded `${}` syntax inside the JS string before Node.js received it, producing `bad substitution` errors. The workaround (write a standalone `.mjs` file) is not documented anywhere.
|
|
137
|
+
|
|
138
|
+
**Fix needed:** Document the correct pattern for batch submission loops, or provide a native `audit-code --batch-results <dir>` to eliminate the need for shell-level scripting entirely.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### F-13 — Session config discovery and provider switching are error-prone [Both]
|
|
143
|
+
|
|
144
|
+
**CD observation:** Every invocation printed `[session-config] no session-config.json found` — 252+ times across the run. The warning appeared even after completing ingestion steps that should have established the session.
|
|
145
|
+
|
|
146
|
+
**OC observation:** Required manually creating `session-config.json` with `{"provider": "opencode"}`. Even after doing so, the provider change only altered the error message; actual dispatch still did not work.
|
|
147
|
+
|
|
148
|
+
**Fix needed:** Create a default `session-config.json` on first `audit-code` run. Suppress the warning when a session config is genuinely optional. Document the `provider` field and its valid values prominently in the session-config guide.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### F-14 — No documentation on artifact schema or contract [OC]
|
|
153
|
+
|
|
154
|
+
The `contract_version: "audit-code/v1alpha1"` header implies a versioned protocol, but there is no schema documentation. The expected formats for JSONL structure, finding shape, task_id conventions, and coverage matrix layout had to be learned entirely by reading existing artifacts and reverse-engineering error messages.
|
|
155
|
+
|
|
156
|
+
**Fix needed:** Publish a contract reference document alongside `docs/contract.md` (which exists but may be incomplete) covering: all artifact file schemas, field-level types and constraints, task_id naming convention, and the expected `AuditResult` JSON shape with a worked example.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Low
|
|
161
|
+
|
|
162
|
+
### F-15 — `worker_results_pending.json` not cleared after ingestion [CD]
|
|
163
|
+
|
|
164
|
+
After `audit-code --results <file>`, the staging file is not cleared. Stale results from the previous task are resubmitted if the worker forgets to overwrite the file.
|
|
165
|
+
|
|
166
|
+
**Fix needed:** After successful ingestion, delete or rename `worker_results_pending.json` (e.g., to `worker_results_submitted_<timestamp>.json`).
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### F-16 — `related_findings` contains only circular self-references [CD]
|
|
171
|
+
|
|
172
|
+
In the synthesized `synthesis_report.json`, nearly every finding's `related_findings` array contains only the finding's own ID. This is useless and misleads reviewers into thinking cross-finding relationships were analyzed.
|
|
173
|
+
|
|
174
|
+
**Fix needed:** Omit `related_findings` when the synthesis engine cannot identify cross-finding relationships, rather than populating it with a self-reference.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### F-17 — Runtime validation evidence shows "pending" for every finding [CD]
|
|
179
|
+
|
|
180
|
+
All 95 findings contain entries like `"runtime:unit:src-modules: pending — No runtime evidence recorded yet"`. These appear verbatim across every finding, bloating each one with 2–3 lines of noise that convey nothing.
|
|
181
|
+
|
|
182
|
+
**Fix needed:** Omit pending evidence entries from the output entirely. A finding with no runtime evidence should have no runtime evidence in its array — not a placeholder repeated 95 times.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### F-18 — `root_cause_clusters` are file co-location groups, not semantic clusters [CD]
|
|
187
|
+
|
|
188
|
+
The 46 clusters are named `"correctness/correctness in src/modules"` — file-path groups with a lens label, not semantic root causes. One cluster for "correctness in src/modules" contains 5 findings with 3 entirely different root causes (division-by-zero, cudagraph violation, dead code).
|
|
189
|
+
|
|
190
|
+
**Fix needed:** Root-cause clustering should be semantic (e.g., "All NaN paths from missing eps guards"). Either improve the clustering algorithm or rename the section to `file_clusters` to accurately describe what it contains.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### F-19 — `work_blocks` section omitted from final summary presentation [CD]
|
|
195
|
+
|
|
196
|
+
The audit directive says findings should be organized into "non-overlapping blocks of tasks." `synthesis_report.json` correctly generates 22 `work_blocks`. The final summary presentation omitted this section entirely, showing only a flat findings table. Work blocks are arguably the most actionable output and should lead the summary.
|
|
197
|
+
|
|
198
|
+
**Fix needed:** Make the `work_blocks` presentation requirement explicit and prominent in the final-output section of the prompt.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### F-20 — `reviewed_ranges` field is unenforceable and creates false confidence [CD]
|
|
203
|
+
|
|
204
|
+
Workers can declare `reviewed_ranges: [{start: 1, end: 10}]` while writing findings about line 800, or declare the full file range without actually reading it. For a 966-line file this makes the field meaningless.
|
|
205
|
+
|
|
206
|
+
**Fix needed:** Either remove `reviewed_ranges` (it creates false confidence) or enforce it mechanically by requiring a content hash or line-count to be included alongside the range declaration.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Summary Table
|
|
211
|
+
|
|
212
|
+
| ID | Issue | Sev | Env | Type |
|
|
213
|
+
|----|-------|-----|-----|------|
|
|
214
|
+
| F-01 | Orchestrator never reaches `status: "complete"` — task statuses undefined | Critical | Both | Bug |
|
|
215
|
+
| F-02 | Worker launch failures / silent executor failures | Critical | Both | Bug |
|
|
216
|
+
| F-03 | `--results` ingestion unreliable (type errors, wrong path, `.map()` crash) | High | Both | Bug |
|
|
217
|
+
| F-04 | CLI hangs without output on some invocations | High | CD | Bug |
|
|
218
|
+
| F-05 | Requeue tasks explosion — 141 tasks from 10 findings | High | OC | Bug |
|
|
219
|
+
| F-06 | Evidence schema undocumented; validated only at ingestion (conflicting types across envs) | Medium | Both | DX |
|
|
220
|
+
| F-07 | `synthesis_current` permanently "missing" even when report is populated | Medium | Both | Bug |
|
|
221
|
+
| F-08 | "All remaining N tasks low priority" — no guidance on worker action | Medium | CD | UX |
|
|
222
|
+
| F-09 | Trivially empty files dispatched as full audit tasks | Medium | CD | Design |
|
|
223
|
+
| F-10 | No batch task dispatch; one task = one CLI invocation = one round-trip | Medium | Both | Design |
|
|
224
|
+
| F-11 | Coverage matrix ↔ task_id mapping is opaque; no lookup table | Medium | OC | DX |
|
|
225
|
+
| F-12 | Bash variable substitution breaks `node -e` shell loops | Medium | CD | DX |
|
|
226
|
+
| F-13 | Session config discovery / provider switching error-prone; noisy warnings | Medium | Both | UX |
|
|
227
|
+
| F-14 | No documentation on artifact schema or contract | Medium | OC | DX |
|
|
228
|
+
| F-15 | `worker_results_pending.json` not cleared after ingestion | Low | CD | Bug |
|
|
229
|
+
| F-16 | `related_findings` circular self-references | Low | CD | Data |
|
|
230
|
+
| F-17 | Runtime validation "pending" entries in all 95 findings | Low | CD | Data |
|
|
231
|
+
| F-18 | `root_cause_clusters` are file co-location groups, not semantic | Low | CD | Design |
|
|
232
|
+
| F-19 | `work_blocks` omitted from final summary presentation | Low | CD | UX |
|
|
233
|
+
| F-20 | `reviewed_ranges` unenforceable; creates false confidence | Low | CD | Design |
|
|
234
|
+
|
|
235
|
+
**Env key:** CD = Claude Desktop (claude-code provider), OC = OpenCode (opencode provider), Both = independently observed in both.
|
|
236
|
+
|
|
237
|
+
**Type key:** Bug = incorrect behavior, DX = developer/worker experience, UX = output/presentation, Design = intentional design that needs reconsideration, Data = output data quality.
|
package/docs/session-config.md
CHANGED
|
@@ -13,6 +13,13 @@ Backend provider configuration lives at:
|
|
|
13
13
|
This file is optional.
|
|
14
14
|
|
|
15
15
|
If it does not exist, the backend defaults to its built-in behavior.
|
|
16
|
+
On first backend run, `audit-code` now writes a repo-local default file automatically:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"provider": "local-subprocess"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
16
23
|
|
|
17
24
|
If it exists but contains invalid values, the backend now fails loudly before starting worker runs.
|
|
18
25
|
You can also check it explicitly with:
|
|
@@ -27,7 +34,9 @@ audit-code validate
|
|
|
27
34
|
{
|
|
28
35
|
"provider": "local-subprocess",
|
|
29
36
|
"timeout_ms": 1800000,
|
|
30
|
-
"ui_mode": "headless"
|
|
37
|
+
"ui_mode": "headless",
|
|
38
|
+
"agent_task_batch_size": 4,
|
|
39
|
+
"parallel_workers": 2
|
|
31
40
|
}
|
|
32
41
|
```
|
|
33
42
|
|
|
@@ -55,6 +64,16 @@ Supported values:
|
|
|
55
64
|
|
|
56
65
|
Use `visible` when you want stdout and stderr mirrored into the current terminal while the provider runs.
|
|
57
66
|
|
|
67
|
+
### `agent_task_batch_size`
|
|
68
|
+
|
|
69
|
+
How many audit tasks to include in one provider-assisted review batch.
|
|
70
|
+
|
|
71
|
+
When this is greater than `1`, the generated worker prompt points at `current-tasks.json` / `pending-audit-tasks.json` and expects one `AuditResult` per assigned task.
|
|
72
|
+
|
|
73
|
+
### `parallel_workers`
|
|
74
|
+
|
|
75
|
+
How many provider-assisted review batches to launch in parallel when the selected provider supports it.
|
|
76
|
+
|
|
58
77
|
## Auto provider mode
|
|
59
78
|
|
|
60
79
|
`auto` is an explicit opt-in mode.
|
package/docs/usage.md
CHANGED
|
@@ -36,10 +36,17 @@ Pass additional evidence back into the same fallback wrapper when needed:
|
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
audit-code --results /path/to/audit_results.json
|
|
39
|
+
audit-code --batch-results /path/to/audit-results-dir
|
|
39
40
|
audit-code --updates /path/to/runtime_validation_update.json
|
|
40
41
|
audit-code --external-analyzer-results /path/to/external_analyzer_results.json
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
Inspect the resolved scope of a task id without reverse-engineering `coverage_matrix.json` manually:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
audit-code explain-task src-api-auth:security
|
|
48
|
+
```
|
|
49
|
+
|
|
43
50
|
Each wrapper run also refreshes:
|
|
44
51
|
|
|
45
52
|
- `.audit-artifacts/operator-handoff.json`
|
|
@@ -70,6 +77,7 @@ Optional inputs for the same bounded step:
|
|
|
70
77
|
|
|
71
78
|
```bash
|
|
72
79
|
node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --results /path/to/audit_results.json
|
|
80
|
+
node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --batch-results /path/to/audit-results-dir
|
|
73
81
|
node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --updates /path/to/runtime_validation_update.json
|
|
74
82
|
node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --external-analyzer-results /path/to/external_analyzer_results.json
|
|
75
83
|
```
|
|
@@ -110,6 +118,7 @@ It invokes the current bounded advance logic and reports the next backend step.
|
|
|
110
118
|
|
|
111
119
|
```bash
|
|
112
120
|
node dist/index.js ingest-results --artifacts-dir .artifacts --results /path/to/audit_results.json
|
|
121
|
+
node dist/index.js ingest-results --artifacts-dir .artifacts --batch-results /path/to/audit-results-dir
|
|
113
122
|
```
|
|
114
123
|
|
|
115
124
|
This updates:
|
|
@@ -119,9 +128,22 @@ This updates:
|
|
|
119
128
|
- `runtime_validation_tasks.json`
|
|
120
129
|
- `runtime_validation_report.json`
|
|
121
130
|
- `audit_results.jsonl`
|
|
131
|
+
- `audit_tasks.json`
|
|
122
132
|
- `requeue_tasks.json`
|
|
133
|
+
- `merged_findings.json`
|
|
134
|
+
- `root_cause_clusters.json`
|
|
123
135
|
- `synthesis_report.json`
|
|
124
136
|
|
|
137
|
+
The batch form processes every `*.json` file in the target directory in lexical order.
|
|
138
|
+
|
|
139
|
+
## Explain a task id
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
node dist/index.js explain-task src-api-auth:security --artifacts-dir .artifacts
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This prints the resolved task payload, matching `coverage_matrix.json` entries, pending coverage by file, and any already-ingested matching findings.
|
|
146
|
+
|
|
125
147
|
## Update runtime validation report with real evidence
|
|
126
148
|
|
|
127
149
|
Prepare a JSON file shaped like `examples/runtime_validation_update.example.json`, then run:
|
package/package.json
CHANGED
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"minItems": 1,
|
|
28
28
|
"items": {
|
|
29
29
|
"type": "object",
|
|
30
|
-
"required": ["path", "start", "end"],
|
|
30
|
+
"required": ["path", "start", "end", "line_count"],
|
|
31
31
|
"properties": {
|
|
32
32
|
"path": { "type": "string" },
|
|
33
33
|
"start": { "type": "integer" },
|
|
34
|
-
"end": { "type": "integer" }
|
|
34
|
+
"end": { "type": "integer" },
|
|
35
|
+
"line_count": { "type": "integer", "minimum": 1 }
|
|
35
36
|
},
|
|
36
37
|
"additionalProperties": false
|
|
37
38
|
}
|
|
@@ -54,6 +54,16 @@
|
|
|
54
54
|
"tags": {
|
|
55
55
|
"type": "array",
|
|
56
56
|
"items": { "type": "string" }
|
|
57
|
+
},
|
|
58
|
+
"status": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"enum": ["pending", "complete"]
|
|
61
|
+
},
|
|
62
|
+
"completed_at": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"completion_reason": {
|
|
66
|
+
"type": "string"
|
|
57
67
|
}
|
|
58
68
|
},
|
|
59
69
|
"additionalProperties": false
|
|
@@ -28,6 +28,7 @@ If the top-level status is `"blocked"`, it means the orchestrator needs your LLM
|
|
|
28
28
|
To determine what task you have been assigned, use your file-reading tool to inspect:
|
|
29
29
|
|
|
30
30
|
- `.audit-artifacts/dispatch/current-task.json`
|
|
31
|
+
- `.audit-artifacts/dispatch/current-tasks.json` when present
|
|
31
32
|
- `.audit-artifacts/dispatch/current-prompt.md`
|
|
32
33
|
|
|
33
34
|
## Step 3: Audit the Code natively
|
|
@@ -39,16 +40,13 @@ To determine what task you have been assigned, use your file-reading tool to ins
|
|
|
39
40
|
## Step 4: Write the Findings
|
|
40
41
|
|
|
41
42
|
Produce your findings array matching exactly the `AuditResult` JSON schema described in the prompt.
|
|
42
|
-
Do not use `echo` or generic terminal shell strings for large JSON structures to avoid breaking JSON escaping.
|
|
43
|
-
`.audit-artifacts/
|
|
43
|
+
Do not use `echo` or generic terminal shell strings for large JSON structures to avoid breaking JSON escaping.
|
|
44
|
+
Instead, use your raw **File Edit Tool** to reliably save your results to the exact `audit_results_path` named in `.audit-artifacts/dispatch/current-task.json`.
|
|
45
|
+
If `current-tasks.json` exists, emit one `AuditResult` per assigned task in that batch.
|
|
44
46
|
|
|
45
47
|
## Step 5: Feed the Loop
|
|
46
48
|
|
|
47
|
-
Return your results to the state machine by running the
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
audit-code --results .audit-artifacts/worker_results_pending.json
|
|
51
|
-
```
|
|
49
|
+
Return your results to the state machine by running the exact `worker_command` from `.audit-artifacts/dispatch/current-task.json`.
|
|
52
50
|
|
|
53
51
|
## Step 6: Loop or Terminate
|
|
54
52
|
|
|
@@ -63,4 +61,10 @@ Instead, use your file reading tool to consume:
|
|
|
63
61
|
|
|
64
62
|
- `.audit-artifacts/synthesis_report.json`
|
|
65
63
|
|
|
66
|
-
Finally,
|
|
64
|
+
Finally, present the completed audit back to the user in this order:
|
|
65
|
+
|
|
66
|
+
1. A **Work Blocks** section summarizing `synthesis_report.work_blocks` first, because those are the primary actionable remediation groups.
|
|
67
|
+
2. A polished **Markdown Summary Table** for the highest-signal merged findings.
|
|
68
|
+
3. A concise semantic **Root Cause Clusters** summary based on `synthesis_report.root_cause_clusters`.
|
|
69
|
+
|
|
70
|
+
Wait for the user to ask you to begin resolving or patching the work blocks or clusters you discovered.
|