Tasks: the-loop diagnoses its own failures and files the bug itself
The last spec artifact. A DAG derived from the design and testing plan.
Task list
[x] 1. Write the failing tests for the pure core (redact + selfdiagnosis units)
- Scrubber masks (home, username, hostname, paths, e-mails, tokens, sensitive env values); keyword defang defeats
control.parse_command; candidate policy; fingerprint normalization; dossier allow-list drops unknown and known-sensitive fields; config parsing (absent/false/invalid → disabled or refusal); retry/abandon and rolling-day-cap arithmetic. - Depends on: none
- Requirements: R1.1–3, R2.1, R3.3, R4.1–2, R5.4, R6.2
- Test:
T1,T8(red)
- Scrubber masks (home, username, hostname, paths, e-mails, tokens, sensitive env values); keyword defang defeats
[x] 2. Write the failing integration scenarios (pipeline + watcher + verb)
- End-to-end with fake agent and fake
gh: log record → labeled issue argv; dry run prints and posts nothing; concurrent scan skipped under the lock; watcher scans on interval and stops with its daemon; no-arming assertions on the composed body and argv. Gherkin docstrings withRequirement:links. - Depends on: none
- Requirements: R1.4–6, R2.2, R3.1–4, R4.3, R5.1–3, R6.1, R6.3
- Test:
T2,T8(red)
- End-to-end with fake agent and fake
[x] 3. Capture the red run as evidence
- Depends on: 1, 2
- Requirements: (process —
tdd.mode: standard) - Test:
evidence/red.md
[x] 4.
redact.py— the scrubber and the keyword defang- Depends on: 3
- Requirements: R4.2, R6.2
- Test:
T1(green:test_redact.py)
[x] 5.
core/selfdiagnosis.py— policy, fingerprint, dossier, state, compose, post- Everything up to but excluding the thread:
SelfDiagnosisConfig.from_mapping,_is_candidate,fingerprint,_dossier, the synthetic-Criticagent run,_compose,_create_issue(comments.py contract), the state file with flock and atomic replace,scan()with dedup/retry/abandon/rate-cap. - Depends on: 4
- Requirements: R1.1–3, R1.6, R3, R4, R5, R6.1–2
- Test:
T1,T2,T8(green)
- Everything up to but excluding the thread:
[x] 6.
start_watcher+ the two daemon wiring points- Daemon thread on
stop_event.wait(interval);poller/daemon.py _run_lockedandwebhook/daemon.py build_receiver/cleanupstart and stop it;Nonewhen disabled. - Depends on: 5
- Requirements: R1.4, R2.1
- Test:
T2 -k watcher,T8 -k disabled(green)
- Daemon thread on
[x] 7.
the-loop diagnosecommandcommands/diagnose_cmd.py+ registration import;--dry-runworks while disabled; refusal names the config key; page underdocs/cli/commands/diagnose.md(P1/P2 gate).- Depends on: 5
- Requirements: R1.5, R2.2
- Test:
T2 -k dry_run,T12(docs parity)
[x] 8. The
selfDiagnosisconfig section, both schema copies, dogfood yaml, docs.the-loop/cli-config.schema.json+ byte-copycli/the_loop/schemas/…;.the-loop/cli-config.yamlblock (enabled: false, commented); config reference pagedocs/config/cli/self-diagnosis-options.md(P3/P4/P5 gates).- Depends on: 5
- Requirements: R2.1, R2.3
- Test:
T12(schema parity, configschema guard, docs parity)
[x] 9. Event types, state registry, observability reference
eventlog.EVENT_TYPES+=diagnosis.detected|posted|deferred|failed;state.GENERATED_PATHS+= the self-diagnosis state file;skills/the-loop/reference/observability.mdmirrors the new types;docs/cli/state.mdif it enumerates the layout.- Depends on: 5
- Requirements: NFR (observability, state locality)
- Test:
T12
[x] 10. Run the full suite and the repo's own gates
- Depends on: 6, 7, 8, 9
- Requirements: all
- Test:
T12,T13
[x] 11. Manual dry run on this repo's own log, human-read for redaction quality
- Depends on: 10
- Requirements: R4 (judgement)
- Test:
T11→evidence/dry-run.md
[x] 12. Capability doc, decision record, user-facing docs
- New
docs/capabilities/self-diagnosis.md+ index row;decision-090(opt-in self-diagnosis: detection over the event log, allow-list redaction, never-armed issues), indexed indecisions.md; README/docs-site touchpoint if the change makes either wrong; execution log## Capability docs+## Documentation. - Depends on: 10
- Requirements: R1–R6 (the record of them)
- Test:
T12 — pytest cli/tests/test_docs_parity.py,T13
- New