Skip to content

feat(retrieval): temporal-spine lane onto production retrieve() + flip default ON (#1107 phase 2, #1064) - #1114

Merged
github-actions[bot] merged 4 commits into
mainfrom
feat/1107-phase2-temporal-spine-lane
Jul 7, 2026
Merged

feat(retrieval): temporal-spine lane onto production retrieve() + flip default ON (#1107 phase 2, #1064)#1114
github-actions[bot] merged 4 commits into
mainfrom
feat/1107-phase2-temporal-spine-lane

Conversation

@robotrocketscience

@robotrocketscience robotrocketscience commented Jul 6, 2026

Copy link
Copy Markdown
Owner

What

#1107 Phase 2 — graduate the temporal-spine lane onto the production retrieve() path and flip its default ON. Operator-directed lane release (2026-07-06). Completes the #1064 flip end-to-end: the writer shipped default-ON in #1111; this makes the retrieval lane default-ON and live on the production hook path.

Commits (atomic)

  1. feat(retrieval): mechanism — the epic(retrieval): converge production hook onto retrieve_v2 — staged lanes are not on the live path #1107 Phase-1 shim hard-forced all six staged lanes off. Pass use_temporal_spine=None so production retrieve() honours is_temporal_spine_enabled (env → TOML → default) exactly like the eval surface. Behaviour-preserving on its own (resolver default still False). The other five lanes stay hard-off.
  2. feat(retrieval): flipis_temporal_spine_enabled default False → True. The spine lane is now live on every host's retrieve(). Tests: test_lane_default_off_flag → test_lane_default_on_flag + new test_lane_explicit_opt_out; the equivalence baseline LANES_OFF → SHIM_LANES (spine resolver-driven, five off) now mirrors the shim exactly, and the inverted test_retrieve_keeps_staged_lanes_off becomes test_shim_runs_temporal_spine_lane_others_off (proves, on a TEMPORAL_NEXT corpus, the shim runs spine and the other five stay off).
  3. docs: CONFIG.md + feature-temporal-spine.md (status: writer+lane both default-ON) + CHANGELOG entry.

Verification

  • Full suite: 5849 passed / 69 skipped / 75 xfailed. Flipping the lane default broke nothing — the lane is append-only (never displaces the L1 pack) and a no-op on spineless stores.
  • G3 hot-path latency gate: PASS (fresh run on this HEAD, benchmarks/temporal_spine_latency.py, 10k beliefs / 200 sessions): Δp50 = −0.01ms, Δp95 = +26.27ms vs the Δp95 ≤ 50ms gate; lane fired 30/30 queries.
  • Equivalence guard for the other five lanes intact (tests/test_retrieve_v2_equivalence.py).

Scope / relationship to #1092

Refs #1064, #1107 (Phase 2). Does not close the #1107 epic — the remaining five staged lanes graduate individually behind their own latency gates. This delivers what the #1092 HOLD draft's lane-half would; #1092 can be closed/reduced once this lands.

Opt-out

AELFRICE_TEMPORAL_SPINE=0 or [retrieval] use_temporal_spine = false.

Summary by CodeRabbit

  • New Features

    • Temporal-spine retrieval is now enabled by default and works end-to-end in the live retrieval flow.
    • Default settings include a retrieval budget of 32.
  • Bug Fixes

    • Retrieval now consistently follows the Phase 2 cutover behavior, with temporal-spine activation controlled by resolver precedence.
  • Documentation

    • Updated changelog, design, and configuration guidance to reflect default-on rollout and opt-out controls.
  • Tests

    • Updated/added coverage for default-on behavior, opt-out handling, and retrieval equivalence.

…im (#1107 phase 2)

The #1107 Phase-1 shim hard-forced all six staged lanes off. Graduate the
temporal-spine lane (#1064, the pilot) to resolver control: pass
use_temporal_spine=None so the production retrieve() path honours
is_temporal_spine_enabled (env -> TOML -> default) exactly like the eval
surface. Behaviour-preserving on its own — the resolver default is still
False, so the lane stays off until the default flip. The other five lanes
remain hard-off.
…#1107 phase 2)

Operator-directed lane release (2026-07-06). is_temporal_spine_enabled now
defaults True, so the production retrieve() shim (resolver-driven since the
prior commit) runs the temporal-spine lane on every host. Completes the
#1064 flip end-to-end: writer default-ON shipped in #1111, lane default-ON
here. Every pre-registered gate cleared (G1 +14.6pp LoCoMo coverage, G2 trim
survival + top-rank invariance, G3 latency delta_p95 in-band, G5
determinism). Opt out with AELFRICE_TEMPORAL_SPINE=0 or [retrieval]
use_temporal_spine = false.

Tests: test_lane_default_off_flag -> test_lane_default_on_flag + a new
test_lane_explicit_opt_out (env/TOML force off). The retrieve_v2 equivalence
guard's baseline (LANES_OFF -> SHIM_LANES) now mirrors the shim exactly —
spine resolver-driven, five lanes off — and the inverted
test_retrieve_keeps_staged_lanes_off becomes
test_shim_runs_temporal_spine_lane_others_off, proving on a TEMPORAL_NEXT
corpus that the shim runs the spine lane and the other five stay off. Full
suite 5849 passed.
…1064, #1107 phase 2)

Reflect the lane flip end-to-end: CONFIG.md (the [retrieval] use_temporal_spine
lane is default-on/live on the production retrieve() path, opt-out documented),
feature-temporal-spine.md (status writer+lane both default-ON; #1107 Phase-2
cutover exposes the lane on the live hook path), and a CHANGELOG entry for the
#1107 production convergence onto retrieve_v2 with temporal spine as the first
graduated lane.
@robotrocketscience robotrocketscience added the author-garsecg PR coordination mutex label Jul 6, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@robotrocketscience robotrocketscience added the attn:review Needs review (PR open, awaiting reviewer) label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

PR-size soft cap

This PR is over the advisory size threshold:

  • 264 changed lines (limit: 200)
  • 6 changed files (limit: 3)

Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated attn:merge-conflict cycles (see #602). When practical, split into smaller PRs that each touch a focused surface.

This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the size:override label and this comment will be removed on the next push.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e5ab929e-ffae-4640-9cd4-77735faaa77e

📥 Commits

Reviewing files that changed from the base of the PR and between 90ed4ba and 3a6814a.

📒 Files selected for processing (1)
  • src/aelfrice/retrieval.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/aelfrice/retrieval.py

📝 Walkthrough

Walkthrough

The temporal-spine retrieval lane is flipped to default ON after the #1107 Phase-2 cutover. The resolver, retrieve() wiring, tests, and related design/config/changelog text are updated to match the new production path and opt-out behavior.

Changes

Temporal-spine default-ON cutover

Layer / File(s) Summary
Resolver and adapter default-ON wiring
src/aelfrice/retrieval.py
is_temporal_spine_enabled now defaults to True, and retrieve() passes use_temporal_spine=None into retrieve_v2 so env/TOML/default resolution decides the lane.
Temporal-spine and shim coverage
tests/test_temporal_spine.py, tests/test_retrieve_v2_equivalence.py
Tests now assert default-ON behavior, opt-out precedence, SHIM_LANES wiring, and retrieve()/retrieve_v2 equivalence for the temporal-spine lane.
Design, config, and changelog updates
docs/design/feature-temporal-spine.md, docs/user/CONFIG.md, CHANGELOG/v3.md
Docs and changelog now describe the lane and ingest writer as default ON after the cutover, with updated production-path and opt-out wording.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific, concise, and accurately reflects moving temporal-spine onto production retrieve() and flipping the default on.
Description check ✅ Passed The description is detailed and covers the why, linked issues, verification, and rollout notes, though it omits some template sections like type of change and test plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1107-phase2-temporal-spine-lane

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/aelfrice/retrieval.py (1)

3315-3325: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Stale "default-OFF" docstrings now contradict the resolver's new default.

Both the retrieve_with_tiers comment ("#1064 temporal-spine lane (additive, default-OFF)", Line 3315) and the retrieve_v2 docstring section for use_temporal_spine ("Default-OFF — the default-ON flip is gated on the pre-registered #1064 criteria", Lines 3524-3525) were not updated alongside the is_temporal_spine_enabled default flip to True. These now describe the opposite of actual behavior and will mislead future readers/maintainers.

📝 Proposed fix
-    # `#1064` temporal-spine lane (additive, default-OFF). Traverses
+    # `#1064` temporal-spine lane (additive, default-ON since `#1107`
+    # Phase 2). Traverses
     # TEMPORAL_NEXT chains from the top-5 packed L1 seeds, both
-      appends the chronological neighbours to the candidate set. The
-      lane is a no-op (byte-identical output) when the store has zero
-      TEMPORAL_NEXT edges. Default-OFF — the default-ON flip is gated
-      on the pre-registered `#1064` criteria. Opt in via
-      `AELFRICE_TEMPORAL_SPINE=1`, the kwarg, or
-      `[retrieval] use_temporal_spine = true`.
+      appends the chronological neighbours to the candidate set. The
+      lane is a no-op (byte-identical output) when the store has zero
+      TEMPORAL_NEXT edges. Default-ON since the `#1107` Phase 2 cutover
+      (the pre-registered `#1064` criteria all cleared). Opt out via
+      `AELFRICE_TEMPORAL_SPINE=0`, the kwarg, or
+      `[retrieval] use_temporal_spine = false`.

Also applies to: 3518-3527

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/aelfrice/retrieval.py` around lines 3315 - 3325, Update the stale
temporal-spine documentation to match the new resolver default. In
`retrieve_with_tiers` and the `retrieve_v2` docstring for `use_temporal_spine`,
change the “default-OFF” wording to reflect that `is_temporal_spine_enabled` now
defaults to True, and adjust any adjacent notes about the `#1064` gating so they
no longer describe the opposite behavior.
🧹 Nitpick comments (1)
tests/test_retrieve_v2_equivalence.py (1)

269-291: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated clustered-corpus setup.

The "other five staged lanes stay off" section (Lines 270-291) re-implements the same clustered-corpus construction already used in test_equivalence_clustered_corpus (Lines 186-198). Consider extracting a shared _build_clustered_corpus(store) helper to avoid the two copies drifting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_retrieve_v2_equivalence.py` around lines 269 - 291, The
clustered-corpus setup is duplicated in the staged-lanes guard test and the
existing clustered-corpus equivalence test, so factor that repeated
MemoryStore/Edge construction into a shared helper (for example, a
`_build_clustered_corpus` function) and reuse it from both cases. Update the
assertions in `test_retrieve_v2_equivalence` to call the helper so the corpus
shape stays identical across tests and the two copies cannot drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/aelfrice/retrieval.py`:
- Around line 3315-3325: Update the stale temporal-spine documentation to match
the new resolver default. In `retrieve_with_tiers` and the `retrieve_v2`
docstring for `use_temporal_spine`, change the “default-OFF” wording to reflect
that `is_temporal_spine_enabled` now defaults to True, and adjust any adjacent
notes about the `#1064` gating so they no longer describe the opposite behavior.

---

Nitpick comments:
In `@tests/test_retrieve_v2_equivalence.py`:
- Around line 269-291: The clustered-corpus setup is duplicated in the
staged-lanes guard test and the existing clustered-corpus equivalence test, so
factor that repeated MemoryStore/Edge construction into a shared helper (for
example, a `_build_clustered_corpus` function) and reuse it from both cases.
Update the assertions in `test_retrieve_v2_equivalence` to call the helper so
the corpus shape stays identical across tests and the two copies cannot drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d94011cf-6a95-484d-a445-87a82c57c359

📥 Commits

Reviewing files that changed from the base of the PR and between 64f345c and 90ed4ba.

📒 Files selected for processing (6)
  • CHANGELOG/v3.md
  • docs/design/feature-temporal-spine.md
  • docs/user/CONFIG.md
  • src/aelfrice/retrieval.py
  • tests/test_retrieve_v2_equivalence.py
  • tests/test_temporal_spine.py

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:Setr:2026-07-07T00:14:35Z]

@robotrocketscience

Copy link
Copy Markdown
Owner Author

Review — temporal-spine lane onto production retrieve() (#1107 Phase 2, #1064)

Verdict: technically sound. One doc-accuracy fix wanted before merge; the merge itself is an operator release call.

Correctness — the mechanism is right

  • retrieve() now passes use_temporal_spine=None (not False), so the shim delegates to is_temporal_spine_enabled (env → TOML → default) exactly like the eval surface. Verified the value threads retrieve()retrieve_v2retrieve_with_tiersis_temporal_spine_enabled(temporal_spine_enabled), and the lane is further guarded by store.has_edge_type(EDGE_TEMPORAL_NEXT) — so default-ON is a no-op on spineless stores. Safe posture.
  • Resolver default flip False → True is localized and the fall-through docstring was updated in place.
  • Equivalence guard reworked correctly: SHIM_LANES uses use_temporal_spine=None to mirror the shim, and the existing L0/L1/L2.5/BFS/manifest cases run on spineless corpora where the lane is inert — so byte-equivalence still holds for real reasons, not by coincidence. test_shim_runs_temporal_spine_lane_others_off proves both halves non-vacuously (spine-ON load-bearing via prod != spine_off; other five stay off via the clustering reorder).
  • CI green across the matrix, FF-clean on main, all three commits signed.

Should fix before merge — two stale in-code docstrings (CodeRabbit finding is valid)

The doc files (CHANGELOG, CONFIG.md, design doc) were flipped to default-ON thoroughly, but two docstrings inside src/aelfrice/retrieval.py still assert the old default and now contradict behavior:

  • retrieval.py:3315# #1064 temporal-spine lane (additive, default-OFF).
  • retrieval.py:3524-3527retrieve_v2 docstring for use_temporal_spine: Default-OFF — the default-ON flip is gated on the pre-registered #1064 criteria. Opt in via AELFRICE_TEMPORAL_SPINE=1 ...

These are the authoritative in-code reference and now say the opposite of what the code does. Doc-only, but worth fixing — and leaving the CodeRabbit thread unresolved will bounce ready-to-merge on the merge-train.

Minor / optional

  • CHANGELOG historical entry title still reads a dedicated retrieval lane, default-off though its body was updated to say the lane is now live. Cosmetic.
  • CodeRabbit nitpick (extract a shared _build_clustered_corpus helper for the duplicated test setup): reasonable but trivial — fine to decline.

Merge gate

Per the ratified #1064 plan, the lane-default flip is a separate operator release call — not a reviewer's to trigger. Not adding ready-to-merge. Recommend: land the two-docstring fix, resolve the CodeRabbit thread, then the operator makes the flip call.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:Setr:2026-07-07T00:18:56Z]

…#1064, #1107 phase 2)

The Phase-2 flip updated the resolver docstring, doc files, and CONFIG.md
but left two in-code docstrings asserting the old default-OFF posture:
retrieve_with_tiers' lane comment and retrieve_v2's use_temporal_spine
entry. Both now describe default-ON with the opt-out env/kwarg/TOML
paths, matching is_temporal_spine_enabled's flipped default.
@robotrocketscience

Copy link
Copy Markdown
Owner Author

Addressed the CodeRabbit maintainability finding in 3a6814a3 (docs-only): the two in-code docstrings that still asserted default-OFF are now synced to default-ON with the opt-out paths —

  • retrieve_with_tiers lane comment (retrieval.py:3315)
  • retrieve_v2 use_temporal_spine docstring entry (retrieval.py:3524-3527)

The doc files (CHANGELOG, CONFIG.md, design doc) were already correct; these were the two the flip missed. Pushed FF onto the branch (90ed4ba0..3a6814a3), signed, CI-clean expected.

Declined the nitpick to extract a shared _build_clustered_corpus test helper — trivial, and the two copies are small enough that drift risk is low.

The branch is merge-ready. The lane-default-ON flip itself remains the operator's release call per the ratified #1064 gate — not adding ready-to-merge.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:Setr:2026-07-07T00:23:32Z]

@robotrocketscience robotrocketscience added the ready-to-merge Trigger merge-train: FF main to this PR's head label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

merge-train: merged 3a6814amain via FF push.

@github-actions
github-actions Bot merged commit 3a6814a into main Jul 7, 2026
35 checks passed
@github-actions github-actions Bot removed the ready-to-merge Trigger merge-train: FF main to this PR's head label Jul 7, 2026
@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:Setr:2026-07-07T00:25:13Z]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attn:review Needs review (PR open, awaiting reviewer) author-garsecg PR coordination mutex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant