Skip to content

reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities

27.1 KB
Raw Blame

id: 01-03 phase: 01 plan: 03 type: execute wave: 1 depends_on: [] requirements: [RESIL-03, PERF-02] files_modified:

  • lib/parallel.sh
  • reconftw.cfg autonomous: true must_haves: truths:
    • "D-11: Default PARALLEL_JOB_TIMEOUT_SECONDS=0 (disabled, opt-in) — parallel_funcs behavior is identical to today, no jobs killed by the timeout path; zero risk of an in-flight scan getting killed by an aggressive default"
    • "D-13: When PARALLEL_JOB_TIMEOUT_SECONDS>0 and a single parallel_funcs child exceeds the threshold, _timeout_kill_job sends SIGTERM, polls kill -0 once per second up to PARALLEL_KILL_GRACE_SECONDS, then SIGKILL if still alive — aligns with Unix shutdown semantics and protects against tools that ignore TERM"
    • "D-14: On timeout kill, the persisted status (.status_=FAIL) and reason (.status_reason_=timeout) are written so _parallel_emit_job_output renders FAIL badge with (timeout) on the console; failed++ → RECON_PARTIAL_RUN=true via existing aggregator"
    • "D-12: Timeout kill logic is inserted INSIDE the existing batch-flush heartbeat loop at lib/parallel.sh:432-465 AND the final-wait heartbeat at :537-569 — extends the existing kill -0 ${batch_pids[$idx]} poll with now - batch_starts[$idx] > PARALLEL_JOB_TIMEOUT_SECONDS check; two-loop symmetry preserved"
    • "D-14: _parallel_emit_job_output's reason-render conditional is widened to also print reason: timeout (or inline parenthetical) for FAIL badges, alongside the existing SKIP/CACHE rendering"
    • "D-15: Timeout applies uniformly to BOTH local and axiom-distributed jobs — parallel batch wrapper is the same code path for both; no special-casing for axiom"
    • "D-16: reconftw.cfg:387-388 ships DNS_BRUTE_TIMEOUT=6h and DNS_RESOLVE_TIMEOUT=4h (was 0); _run_dns_with_heartbeat is NOT modified (already respects 0=disabled and accepts h-suffix durations honored by timeout/gtimeout)"
    • "D-17: When the DNS hard timeout trips, the existing _run_dns_with_heartbeat already returns non-zero and emits a clear log line; existing WARN badge from end_func is sufficient surfacing; JSONL log carries reason=dns_hard_timeout so downstream tools (Phase 4 tests, AI report) can distinguish"
    • "D-11: reconftw.cfg ships PARALLEL_JOB_TIMEOUT_SECONDS=0 (disabled by default) with doc comment listing 3600/600 examples, and PARALLEL_KILL_GRACE_SECONDS=10" artifacts:
    • path: "lib/parallel.sh" provides: "_timeout_kill_job helper + timeout kill check inside both heartbeat loops + reason rendering for FAIL badges"
    • path: "reconftw.cfg" provides: "Four config lines — DNS_BRUTE_TIMEOUT/DNS_RESOLVE_TIMEOUT default value changes plus PARALLEL_JOB_TIMEOUT_SECONDS/PARALLEL_KILL_GRACE_SECONDS new knobs" key_links:
    • from: "lib/parallel.sh heartbeat loop (line ~445 batch-flush, ~549 final-wait)" to: "_timeout_kill_job" via: "if PARALLEL_JOB_TIMEOUT_SECONDS > 0 and job_dur > threshold" pattern: "PARALLEL_JOB_TIMEOUT_SECONDS.*_timeout_kill_job"
    • from: "timeout_kill_job" to: "$called_fn_dir/.status + .status_reason_" via: "printf FAIL + printf timeout (reuses end_func persistence pattern)" pattern: "printf "FAIL\\n".*status_.*printf "timeout"
    • from: "_parallel_emit_job_output reason render" to: "console badge" via: "widened conditional to include FAIL alongside SKIP/CACHE" pattern: "badge == "FAIL".*reason"

Add `PARALLEL_JOB_TIMEOUT_SECONDS` enforcement so stuck tools no longer stall a parallel batch, and set non-zero DNS timeout defaults so a hung resolver does not block a run indefinitely. Closes RESIL-03 and PERF-02.

Purpose: Today, the heartbeat loop at lib/parallel.sh:432-465 polls alive PIDs every PARALLEL_HEARTBEAT_SECONDS but provides no kill mechanism for stuck jobs. A single hung tool stalls the entire batch barrier-sync. Separately, DNS_BRUTE_TIMEOUT=0 and DNS_RESOLVE_TIMEOUT=0 at reconftw.cfg:387-388 ship as disabled; _run_dns_with_heartbeat (modules/utils.sh:1434) already supports non-zero durations but the defaults never trigger.

Output: New private helper _timeout_kill_job in lib/parallel.sh; timeout-check inserted in both heartbeat loops (batch-flush at :432-465 and final-wait at :537-569); reason rendering for FAIL badges widened in _parallel_emit_job_output; four config lines in reconftw.cfg (two value changes for DNS, two new parallel knobs). No CLI flag added (env-var/cfg override is sufficient for v1 per CONTEXT §Established Patterns).

@$HOME/.claude/get-shit-done/workflows/execute-plan.md @$HOME/.claude/get-shit-done/templates/summary.md @.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/01-resilient-resume-timeout-safety/01-CONTEXT.md @.planning/phases/01-resilient-resume-timeout-safety/01-PATTERNS.md @.planning/codebase/CONVENTIONS.md

From lib/parallel.sh:

  • Source guard at :6: [[ -n "$_PARALLEL_SH_LOADED" ]] && return 0. Preserved as-is.
  • PARALLEL_HEARTBEAT_SECONDS init at :15: PARALLEL_HEARTBEAT_SECONDS="${PARALLEL_HEARTBEAT_SECONDS:-20}". Pattern for new knob init.
  • _throttle_jobs() at :33-42. Sibling style for new _timeout_kill_job helper. NOTE: sibling helpers in this file (_throttle_jobs, _parallel_live_break, _parallel_emit_job_output) currently use the bare name() { declaration form, which contradicts CONVENTIONS.md §Function Naming (function name() {). Those pre-date the rule; new code in this plan follows the project-wide rule.
  • _parallel_emit_job_output() at :172-300. Reads .status_<fn> (:204) and .status_reason_<fn> (:224). Currently renders reason for SKIP/CACHE only — three locations to widen (summary mode at :261-263, tail mode at :279-281, full mode similar).
  • Batch-flush heartbeat loop at :432-465. Iterates alive PIDs, computes job_dur=$((now - batch_starts[$idx])) (:445). Insertion site for timeout check inside the if kill -0 branch (:443).
  • Final-wait heartbeat loop at :537-569. Structurally identical to batch-flush; second insertion site at the same relative position.

From modules/core.sh:

  • Status persistence pattern at :1505-1509: printf "%s\n" "$badge" >"${called_fn_dir}/.status_${fn}" 2>/dev/null || true; printf "%s\n" "$reason_code" >"${called_fn_dir}/.status_reason_${fn}" 2>/dev/null || true. _timeout_kill_job reuses this exact write pattern with FAIL + timeout values.

From modules/utils.sh:

  • _run_dns_with_heartbeat() at :1434-1452. Already supports 0=disabled via _dns_timeout_enabled. Already passes h-suffix durations through to timeout/gtimeout via the existing "$TIMEOUT_CMD" -k 10s "$timeout_value" "$@" call at :1444. NO CODE CHANGE here for PERF-02 — only the cfg defaults flip from 0 to 6h/4h.

From reconftw.cfg:

  • DNS timeout block at :386-389 — three lines around PERMUTATIONS_LIMIT and DNS_HEARTBEAT_INTERVAL_SECONDS. The two value-change lines (:387, :388) are the modification sites.
  • Parallelization block at :302-312 — group PARALLEL_MODE through PARALLEL_TRACE_SLOW_SECONDS. Insertion site for the two new knobs is immediately after :312.
Task 1: _timeout_kill_job helper + timeout enforcement in both heartbeat loops lib/parallel.sh - lib/parallel.sh (entire file overview, paying attention to :1-50 source guard + knob inits, :33-42 _throttle_jobs analog, :172-300 _parallel_emit_job_output reason render, :432-465 batch-flush heartbeat, :537-569 final-wait heartbeat) - .planning/phases/01-resilient-resume-timeout-safety/01-PATTERNS.md (anchor "lib/parallel.sh — heartbeat-loop timeout enforcement" — exact insertion site, helper signature, two-loop symmetry rule, FAIL-reason-render widening) - .planning/phases/01-resilient-resume-timeout-safety/01-CONTEXT.md (D-11 default 0, D-12 enforcement point inside heartbeat, D-13 TERM-then-KILL grace, D-14 FAIL reason=timeout reuse, D-15 axiom uniformity) - .planning/codebase/CONVENTIONS.md (Function Naming: `function name() {` form is the project-wide rule; only lib/ui.sh and lib/common.sh are listed exceptions; lib/parallel.sh is NOT exempt) - modules/core.sh :1505-1509 (status persistence pattern reused verbatim by _timeout_kill_job) Step A — Define `_timeout_kill_job` helper in lib/parallel.sh. Place it BETWEEN the existing `_throttle_jobs` function (closes at :42) and the existing `_parallel_live_break` function (`:44`). Declare using the canonical `function _timeout_kill_job() { ... }` form per CONVENTIONS.md §Function Naming (the project-wide rule; only lib/ui.sh and lib/common.sh are exempt). Add a single-line note immediately above the declaration: `# Uses 'function' keyword per CONVENTIONS.md §Function Naming; sibling helpers in this file that omit it predate the rule and are a Phase 5 DOCS-01 followup, not a precedent for new code.`
Helper signature: `_timeout_kill_job <pid> <func_name> <duration_sec>`.
Body steps:
1. `local pid="$1" func_name="$2" duration_sec="$3"` — local-declare all positional args (CONVENTIONS.md §Variable Naming).
2. `local grace="${PARALLEL_KILL_GRACE_SECONDS:-10}"; [[ "$grace" =~ ^[0-9]+$ ]] || grace=10` — defensive integer coercion mirroring the existing pattern at `:434` (`[[ "$hb" =~ ^[0-9]+$ ]] || hb=20`-style).
3. `kill -TERM "$pid" 2>/dev/null || true` — D-13 first signal. The `2>/dev/null || true` is mandatory (PID may exit between check and kill) — pattern at `:443`.
4. Poll loop: `local i; for ((i=0; i<grace; i++)); do kill -0 "$pid" 2>/dev/null || break; sleep 1; done`. Exits early if the process honored TERM.
5. `kill -KILL "$pid" 2>/dev/null || true` — D-13 fallback for tools that ignore TERM. Idempotent — no-op if process already exited.
6. Persist FAIL status reusing modules/core.sh:1505-1509 pattern verbatim: `if [[ -n "${called_fn_dir:-}" ]]; then printf "FAIL\n" >"${called_fn_dir}/.status_${func_name}" 2>/dev/null || true; printf "timeout\n" >"${called_fn_dir}/.status_reason_${func_name}" 2>/dev/null || true; fi`. The downstream `_parallel_emit_job_output` reads these files at :203-209/:223-224 and renders the badge accordingly.
7. Emit structured log via `log_json "ERROR" "${func_name}" "Job timed out" "reason=timeout" "duration_sec=${duration_sec}"`. The `log_json` function is defined in modules/core.sh:680 and is no-op when STRUCTURED_LOGGING != true. The `lib/parallel.sh` is sourced before modules/core.sh per CONVENTIONS.md §Import / Sourcing Order, but at RUNTIME (when this helper is invoked by parallel_funcs called from inside a module function), log_json is already defined globally — safe to call.

Step B — Insert the timeout check inside the BATCH-FLUSH heartbeat loop (lib/parallel.sh:432-465). Locate the existing `if kill -0 "${batch_pids[$idx]}" 2>/dev/null; then` branch at :443 and the `job_dur=$((now - batch_starts[$idx]))` line at :445. IMMEDIATELY AFTER the `job_dur` computation and BEFORE the `dur_fmt=$(format_duration "$job_dur")` line at :446, insert:

```
                        # Timeout enforcement (RESIL-03 / D-11..D-14): if PARALLEL_JOB_TIMEOUT_SECONDS > 0
                        # and the live job has exceeded it, TERM-then-KILL and persist FAIL + reason=timeout.
                        local _to="${PARALLEL_JOB_TIMEOUT_SECONDS:-0}"
                        if [[ "$_to" =~ ^[0-9]+$ ]] && (( _to > 0 )) && (( job_dur > _to )); then
                            _timeout_kill_job "${batch_pids[$idx]}" "${batch_funcs[$idx]}" "$job_dur"
                        fi
```

The post-loop `wait "${batch_pids[$idx]}"` at :470 collects the killed process's non-zero rc, and `_parallel_emit_job_output` at :483 reads the FAIL + timeout from the status files. NO change to the wait or emit code paths is required.

Step C — Insert the IDENTICAL block in the FINAL-WAIT heartbeat loop (lib/parallel.sh:537-569). Locate the same `if kill -0 "${batch_pids[$idx]}" 2>/dev/null; then` branch (around :547) and the `job_dur=$((now - batch_starts[$idx]))` line (around :549). Insert the same `# Timeout enforcement` block at the same relative position. Two-loop symmetry is mandatory per PATTERNS.md (the two heartbeat loops are structurally identical and the audit history treats them as one logical pattern).

Step D — Widen the reason-render conditional in `_parallel_emit_job_output`. In the `summary` mode branch at :261-263 the existing condition is:

```
            if [[ -n "$reason_code" ]] && { [[ "$badge" == "SKIP" ]] || { [[ "$badge" == "CACHE" ]] && [[ "${SHOW_CACHE:-false}" == "true" ]]; }; }; then
                printf "         reason: %s\n" "$reason_code"
            fi
```

Widen the condition to also fire when `badge == "FAIL"` so D-14 timeout reasons are surfaced. The updated condition:

```
            if [[ -n "$reason_code" ]] && { [[ "$badge" == "SKIP" ]] || [[ "$badge" == "FAIL" ]] || { [[ "$badge" == "CACHE" ]] && [[ "${SHOW_CACHE:-false}" == "true" ]]; }; }; then
                printf "         reason: %s\n" "$reason_code"
            fi
```

Apply the SAME widening to the `tail` mode branch (similar conditional at :279-281). Inspect the `full` mode branch (after :283) for the same conditional — if present, widen identically. The line-pattern stays the same; only the gate widens (no rewrite of the printf).

DO NOT introduce a new badge value (FAIL exists). DO NOT modify the post-loop `wait` semantics or the badge-aggregation case statement at :484-491 (it already counts FAIL into `failed++`, which sets `RECON_PARTIAL_RUN=true` via the existing aggregator — D-14 reuses this pipeline). DO NOT special-case axiom-distributed jobs (D-15: timeout kill targets the local subshell PID which itself dispatches axiom-scan; killing the subshell signals axiom-scan which signals remote nodes).
bash -n /Users/six2dez/Tools/reconftw/lib/parallel.sh && shellcheck -s bash --severity=error /Users/six2dez/Tools/reconftw/lib/parallel.sh - `grep -nE '^function _timeout_kill_job\(\) \{' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns exactly 1 (project-wide `function name() {` form per CONVENTIONS.md). - The bare `^_timeout_kill_job\(\)` form MUST NOT be present: `grep -cE '^_timeout_kill_job\(\)' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns 0. - `grep -n 'kill -TERM "\$pid"' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns at least one match inside _timeout_kill_job body. - `grep -n 'kill -KILL "\$pid"' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns at least one match inside _timeout_kill_job body. - `grep -nc 'PARALLEL_KILL_GRACE_SECONDS' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns >=1 (at least once inside _timeout_kill_job). - `grep -c 'printf "FAIL\\\\n" >"\${called_fn_dir}/\.status_' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns >=1 (the persistence write inside _timeout_kill_job). - `grep -c 'printf "timeout\\\\n" >"\${called_fn_dir}/\.status_reason_' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns >=1. - `grep -c '_timeout_kill_job "\${batch_pids\[\$idx\]}" "\${batch_funcs\[\$idx\]}"' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns exactly 2 (one in batch-flush loop, one in final-wait loop — two-loop symmetry). - `grep -c 'PARALLEL_JOB_TIMEOUT_SECONDS' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns >=2 (at least the two call-site occurrences inside the heartbeat loops; helper itself may not reference it). - Reason-render widening verified: `grep -c '"\$badge" == "FAIL"' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns >=2 (summary and tail branches, plus optionally full branch). All inside the same conditional-disjunction pattern alongside `"$badge" == "SKIP"`. - The DOCS-01 followup note appears above the helper: `grep -c 'DOCS-01 followup' /Users/six2dez/Tools/reconftw/lib/parallel.sh` returns >=1. - `bash -n lib/parallel.sh` exits 0. - `shellcheck -s bash --severity=error lib/parallel.sh` exits 0 (no new error-level findings). - Behavior smoke (no test files in this phase per Deferred): manually invoke a synthetic batch via `--source-only`-loaded shell, e.g. `source ./reconftw.sh && called_fn_dir=$(mktemp -d) && PARALLEL_JOB_TIMEOUT_SECONDS=2 PARALLEL_KILL_GRACE_SECONDS=1 PARALLEL_HEARTBEAT_SECONDS=1 parallel_funcs 1 my_slow_func` where my_slow_func is a test stub `function my_slow_func() { sleep 30; }`. After ~3 seconds the job is killed; `.status_my_slow_func` file contains `FAIL` and `.status_reason_my_slow_func` contains `timeout`; console shows `FAIL my_slow_func Xs` followed by `reason: timeout` line. _timeout_kill_job helper defined with `function name() {` form per CONVENTIONS.md (with DOCS-01 followup note about pre-existing siblings), TERM-then-KILL grace logic, timeout check inserted in BOTH heartbeat loops at the documented anchor; reason rendering widened to also print on FAIL badges; no new badge introduced; no axiom special-casing; shellcheck clean. Task 2: Update reconftw.cfg — DNS timeout defaults + two new parallel knobs reconftw.cfg - reconftw.cfg (current DNS timeout block at :386-389 — value-change site; current Parallelization block at :302-312 — new-knob insertion site) - .planning/phases/01-resilient-resume-timeout-safety/01-PATTERNS.md (anchor "reconftw.cfg — DNS timeouts and new parallel knobs" — exact line targets and inline-comment style) - .planning/phases/01-resilient-resume-timeout-safety/01-CONTEXT.md (D-11 default 0 ships disabled; D-13 default grace 10; D-16 DNS_BRUTE_TIMEOUT=6h, DNS_RESOLVE_TIMEOUT=4h) Step A — Modify the DNS timeout lines at `reconftw.cfg:387-388`. Per D-16: - Change `:387` from `DNS_BRUTE_TIMEOUT=0` to `DNS_BRUTE_TIMEOUT=6h`. Update the inline comment to reflect non-zero default. The comment in the existing file mentions `e.g. 4h` for DNS_BRUTE_TIMEOUT; per D-16 the BRUTE value is 6h (D-16 in CONTEXT.md is authoritative — the existing inline-comment example is inverted, fix it). New line: `DNS_BRUTE_TIMEOUT=6h # timeout/gtimeout duration for DNS bruteforce (0 disables hard-timeout). Default protects against hung resolvers.` - Change `:388` from `DNS_RESOLVE_TIMEOUT=0` to `DNS_RESOLVE_TIMEOUT=4h`. New line: `DNS_RESOLVE_TIMEOUT=4h # timeout/gtimeout duration for DNS resolve (0 disables hard-timeout). Default protects against hung resolvers.` - DO NOT modify `:389` (`DNS_HEARTBEAT_INTERVAL_SECONDS=20`) or `:386` (`PERMUTATIONS_LIMIT`). - Preserve the alignment style of surrounding lines (end-of-line `#` comment, leading column-aligned value).
Step B — Add two new knobs at the end of the Parallelization block. Insert IMMEDIATELY AFTER the existing `PARALLEL_TRACE_SLOW_SECONDS=30 # ...` line at `:312` and BEFORE the comment line `# Parallel batch sizing per module group ...` at `:314`. Insert:

```
# Per-job timeout (RESIL-03 / D-11..D-14). Default 0 = disabled (opt-in); suggested values:
#   3600 (1h) for long unattended scans, 600 (10min) for CI smoke runs.
# When > 0, parallel_funcs heartbeat sends SIGTERM after the threshold and SIGKILL after
# PARALLEL_KILL_GRACE_SECONDS if the job ignores TERM. Applies to both local and axiom jobs.
# Actual kill latency is the threshold + ~1s (heartbeat poll cadence) + PARALLEL_KILL_GRACE_SECONDS before SIGKILL.
PARALLEL_JOB_TIMEOUT_SECONDS=0 # 0 disables; e.g. 3600 for long scans, 600 for CI
PARALLEL_KILL_GRACE_SECONDS=10 # Seconds between TERM and KILL when enforcing PARALLEL_JOB_TIMEOUT_SECONDS
```

The default value of 0 is deliberate per D-11 (locked) — DO NOT propose a non-zero default. The doc comment listing 3600 and 600 examples is mandatory per D-11 / CONTEXT §Specifics. The added "Actual kill latency is the threshold + ~1s (heartbeat poll cadence) + PARALLEL_KILL_GRACE_SECONDS before SIGKILL." line is documentation only (no code change); it makes the effective kill latency explicit for users tuning the knob for CI deadlines.

DO NOT add a CLI flag for either knob (per CONTEXT §Established Patterns: "any new config knob added in this phase does NOT need a CLI flag for v1"). DO NOT modify `lib/parallel.sh:15` PARALLEL_HEARTBEAT_SECONDS init (that's a DOCS-01/Phase-5 concern). DO NOT touch `reconftw.cfg:39` MIN_DISK_SPACE_GB (that's DOCS-02/Phase-5).

Step C — Verify no unrelated lines are touched. The diff should affect exactly:
- 2 modified lines at :387-388 (DNS_BRUTE_TIMEOUT, DNS_RESOLVE_TIMEOUT values + comments)
- 7 new lines inserted between :312 and :314 (5 comment lines including the kill-latency note + 2 knob assignments)

Total: 2 lines modified, 7 lines added. No deletions.
bash -n /Users/six2dez/Tools/reconftw/reconftw.cfg && shellcheck -s bash --severity=error /Users/six2dez/Tools/reconftw/reconftw.cfg - `grep -c '^DNS_BRUTE_TIMEOUT=6h' /Users/six2dez/Tools/reconftw/reconftw.cfg` returns exactly 1. - `grep -c '^DNS_RESOLVE_TIMEOUT=4h' /Users/six2dez/Tools/reconftw/reconftw.cfg` returns exactly 1. - `grep -c '^DNS_BRUTE_TIMEOUT=0\b' /Users/six2dez/Tools/reconftw/reconftw.cfg` returns exactly 0 (old value removed). - `grep -c '^DNS_RESOLVE_TIMEOUT=0\b' /Users/six2dez/Tools/reconftw/reconftw.cfg` returns exactly 0 (old value removed). - `grep -c '^PARALLEL_JOB_TIMEOUT_SECONDS=0' /Users/six2dez/Tools/reconftw/reconftw.cfg` returns exactly 1 (new knob shipped disabled). - `grep -c '^PARALLEL_KILL_GRACE_SECONDS=10' /Users/six2dez/Tools/reconftw/reconftw.cfg` returns exactly 1. - Doc comment with `3600` and `600` examples present: `grep -c '3600' /Users/six2dez/Tools/reconftw/reconftw.cfg` and `grep -c '600' /Users/six2dez/Tools/reconftw/reconftw.cfg` each return >=1 in the new comment block (filter to the new section: `awk '/^# Per-job timeout/,/^PARALLEL_KILL_GRACE_SECONDS/' reconftw.cfg | grep -c '3600\|600'` returns >=2). - Kill-latency note present in the new doc block: `awk '/^# Per-job timeout/,/^PARALLEL_KILL_GRACE_SECONDS/' /Users/six2dez/Tools/reconftw/reconftw.cfg | grep -c 'Actual kill latency is the threshold'` returns exactly 1. - The kill-latency note mentions the heartbeat poll cadence and PARALLEL_KILL_GRACE_SECONDS: `awk '/^# Per-job timeout/,/^PARALLEL_KILL_GRACE_SECONDS/' /Users/six2dez/Tools/reconftw/reconftw.cfg | grep -cE 'heartbeat poll cadence.*PARALLEL_KILL_GRACE_SECONDS|PARALLEL_KILL_GRACE_SECONDS.*heartbeat poll cadence'` returns >=1. - Ordering preserved: `awk '/^PARALLEL_TRACE_SLOW_SECONDS/{p=1; next} p && /^PARALLEL_JOB_TIMEOUT_SECONDS/{print "ok"; exit}' reconftw.cfg` prints `ok` (i.e., the new knob is placed AFTER PARALLEL_TRACE_SLOW_SECONDS and BEFORE the batch-sizing block). - `bash -n reconftw.cfg` exits 0 (cfg is sourced as bash — must parse cleanly). - `shellcheck -s bash --severity=error reconftw.cfg` exits 0 (no NEW error-level findings; pre-existing warnings allowed). - Behavior smoke after sourcing cfg: `source reconftw.cfg && echo "$DNS_BRUTE_TIMEOUT $DNS_RESOLVE_TIMEOUT $PARALLEL_JOB_TIMEOUT_SECONDS $PARALLEL_KILL_GRACE_SECONDS"` prints `6h 4h 0 10`. - Behavior smoke for DNS: a manual run with hung resolver simulation (`timeout 0.1s` wrapper) shows DNS functions complete with WARN badge and the JSONL log contains the existing `_run_dns_with_heartbeat` non-zero return path; no code change to the helper is required (D-17 verification). Four cfg lines changed: two DNS timeout defaults flipped to non-zero (6h/4h), two new parallel knobs added at the documented section anchor with mandatory doc comment listing 3600/600 examples AND a kill-latency note explaining the threshold + ~1s heartbeat + grace before SIGKILL; no CLI flag added; no unrelated lines touched; cfg parses cleanly via bash -n. - `bash -n lib/parallel.sh reconftw.cfg` → exit 0. - `shellcheck -s bash --severity=error lib/parallel.sh reconftw.cfg` → exit 0 (no NEW error-level findings vs baseline). - Manual smoke (no test files in this phase per CONTEXT Deferred): 1. Source the project with new cfg: `./reconftw.sh --source-only`. 2. Verify defaults: `echo "$DNS_BRUTE_TIMEOUT $DNS_RESOLVE_TIMEOUT $PARALLEL_JOB_TIMEOUT_SECONDS $PARALLEL_KILL_GRACE_SECONDS"` prints `6h 4h 0 10`. 3. Timeout kill smoke: define a stub `function _slow_test() { start_func "${FUNCNAME[0]}" "test"; sleep 60; end_func "done" "${FUNCNAME[0]}"; }` in the sourced shell. Set `called_fn_dir=$(mktemp -d) PARALLEL_JOB_TIMEOUT_SECONDS=2 PARALLEL_KILL_GRACE_SECONDS=1 PARALLEL_HEARTBEAT_SECONDS=1 PARALLEL_MODE=true OUTPUT_VERBOSITY=1`, then run `parallel_funcs 1 _slow_test`. Within ~5 seconds the job is killed; console shows `FAIL _slow_test Xs` + `reason: timeout`; `cat "$called_fn_dir/.status__slow_test"` shows `FAIL`; `cat "$called_fn_dir/.status_reason__slow_test"` shows `timeout`. 4. Backwards-compat smoke: with `PARALLEL_JOB_TIMEOUT_SECONDS=0` (default), the same `_slow_test` runs to completion (or until the test shell is killed); no kill, no FAIL persistence. 5. DNS timeout smoke: with `DNS_BRUTE_TIMEOUT=6h` exported, `_run_dns_with_heartbeat` invocations should pass `-k 10s 6h` to the timeout command. Verifiable by inspecting the wrapped command in a `set -x` trace; no behavioral change for healthy resolvers. - Plan 01-03 success criteria (ROADMAP §"Phase 1" SC#3 + SC#4): - Setting `PARALLEL_JOB_TIMEOUT_SECONDS=600` in reconftw.cfg terminates any single parallel_funcs child exceeding 10 minutes via kill -TERM, allowing the batch to continue. - Fresh installs of reconftw.cfg ship with non-zero `DNS_BRUTE_TIMEOUT=6h` and `DNS_RESOLVE_TIMEOUT=4h` defaults, and a stuck DNS run aborts with a logged timeout rather than blocking indefinitely. - All `must_haves.truths` verifiable per the acceptance criteria above. - Default value `PARALLEL_JOB_TIMEOUT_SECONDS=0` (disabled) preserved per D-11 — backwards compatibility intact. - No CLI flag added — env-var/cfg override is the v1 contract. - Two-loop symmetry maintained: timeout check inserted in BOTH heartbeat loops (batch-flush and final-wait). - No code change to `_run_dns_with_heartbeat` in modules/utils.sh — only cfg defaults flip. - No new badge introduced; FAIL + reason=timeout reuses the existing status-persistence pipeline. - `_timeout_kill_job` declared with the project-wide `function name() {` form per CONVENTIONS.md §Function Naming; pre-existing sibling helpers using the bare form are flagged in-plan as a DOCS-01 / Phase 5 followup rather than a new-code precedent. - reconftw.cfg doc comment for PARALLEL_JOB_TIMEOUT_SECONDS explicitly states the effective kill latency (threshold + ~1s heartbeat poll cadence + PARALLEL_KILL_GRACE_SECONDS before SIGKILL) so CI users tuning the knob set realistic deadlines. After completion, create `.planning/phases/01-resilient-resume-timeout-safety/01-03-SUMMARY.md`.