Skip to content

v6.8 Part 1: integrative-review gate walks transitive descendants (#73) - #16

Merged
jarvis-stark-ops merged 2 commits into
mainfrom
kaipo/v6.8-integrative-review-transitive-walk
Jun 11, 2026
Merged

v6.8 Part 1: integrative-review gate walks transitive descendants (#73)#16
jarvis-stark-ops merged 2 commits into
mainfrom
kaipo/v6.8-integrative-review-transitive-walk

Conversation

@jarvis-stark-ops

Copy link
Copy Markdown
Collaborator

Summary

The v6.7 validation chain (2026-06-10 on hermes-dashboard) exposed that the integrative-review-at-archive gate (v6.7 NousResearch#30) walked direct children only and missed the common chained shape:

```
umbrella → pepper → friday → tony → tchalla
```

…where each task's parent is the PREVIOUS task, not the umbrella. The gate saw 1 direct child (Pepper, non-review) → `has_review_child=False` → no spawn. In production today, integrative review at archive does NOT fire for chains that fan out via task chaining — the common shape.

Closes hermes-jarvis#73 (the highest-impact of the 6 v6.8 findings from validation).

Fix

New helper `_v6_7_walk_descendants` uses a recursive CTE on `task_links` to walk transitive descendants. Cycle-safe via sqlite's UNION dedup. Both `has_review_child` and `has_non_review_child` now consider any descendant.

Fan-out behavior preserved (direct children are also transitive descendants).

Tests

7 new tests in `TestTransitiveDescendantWalk`:

  • chained shape (2026-06-10 case) triggers spawn — the missing case
  • fan-out shape still triggers (regression check)
  • mixed shape triggers
  • in-flight chained descendant blocks (existing semantics)
  • cyclic links don't infinite-loop
  • `_v6_7_walk_descendants` returns all levels
  • empty on orphan umbrella

37/37 in `test_v6_7_integrative_review.py` pass. 183/183 across full v6.7 regression set — zero failures.

Manual validation

After merge, can manually verify with:
```bash
hermes kanban create "test umbrella" --goal ...

spawn child build, child review chained off build, archive umbrella

integrative review should auto-spawn

```

🤖 Generated with Claude Code

Jarvis and others added 2 commits June 11, 2026 08:43
…endants

The v6.7 validation chain (2026-06-10 on hermes-dashboard) exposed
that ``_v6_7_should_spawn_integrative_review`` checked ``task_links
WHERE parent_id = umbrella_id`` — direct children only. The validation
chain shape was:

    umbrella → pepper → friday → tony → friday-rem → tony-rev → tchalla

…where each task's parent was the PREVIOUS task, not the umbrella.
The gate saw exactly 1 direct child (Pepper, non-review) → no spawn.
In production today, integrative review at archive does NOT fire for
chains that fan out via task chaining — the common shape.

Closes hermes-jarvis#73.

## Fix

Replace direct-child SQL with a recursive CTE in a new helper
``_v6_7_walk_descendants``. Walks ``task_links`` transitively from
the umbrella down. Cycle-safe (sqlite's recursive CTE with UNION
deduplicates so cyclic graphs don't infinite-loop). Both
``has_review_child`` and ``has_non_review_child`` now consider any
descendant.

The previous fan-out behavior is preserved because direct children
are also transitive descendants.

## Tests

7 new tests in ``TestTransitiveDescendantWalk``:
- chained shape (2026-06-10 validation case) now triggers spawn
- fan-out shape (original v6.7 design) still triggers
- mixed shape (some direct, some chained) triggers
- in-flight chained descendant blocks spawn (existing semantics)
- cyclic links don't infinite-loop
- _v6_7_walk_descendants returns all levels
- _v6_7_walk_descendants empty on orphan umbrella

37/37 in test_v6_7_integrative_review.py pass. 183/183 across v6.7 +
adjacent regression set — zero failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…edge-case tests

Independent review of the transitive-walk fix flagged three polish
items. All addressed:

- Docstring claimed "visited set prevents infinite loop" — false
  (no Python set exists). Cycle safety actually comes from sqlite's
  UNION dedup in the recursive CTE's working table. Replaced the
  lying comment and added a note that link_tasks rejects cycles at
  insert time so this defense is defensive-only.
- Return type was bare `list`. Now `list[sqlite3.Row]`.
- Added multi-parent caveat to the docstring — schema allows it and
  the walk is unaware of distinct-umbrella context.

3 new tests for edge cases the reviewer flagged:
- test_diamond_shape_dedups_descendant — UNION correctly returns
  shared diamond-target exactly once.
- test_deep_integrative_review_descendant_is_skipped — the title-
  prefix skip in the gate's iteration works at any depth, not just
  direct children. The test stubs a deep integrative review with
  a reject verdict and confirms archive evaluates cleanly without
  treating the deep IR as a regular review-role descendant.
- test_shared_descendant_across_umbrellas_documented — pins the
  current (accepted) behavior that multi-parent descendants leak
  across umbrellas, so future readers aren't surprised. Real
  production chains don't share live descendants across distinct
  umbrellas.

40/40 in test_v6_7_integrative_review.py pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jarvis-stark-ops
jarvis-stark-ops merged commit bf8f4a6 into main Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant