chore(generate): delete unreachable agenerate (#90)

Closes audit Finding 7 (2026-05-20).

``agenerate`` was a 43-line async generator at the bottom of
``generate/stream.py`` that reimplemented the walk loop without
salience candidates, inner-loop admissibility, language candidates,
rotor admissibility, margin mode, trajectory recording, vault recall
scoring, or admissibility tracing — every capability the sync
``generate()`` has accrued since ADR-0022.

Caller audit:
  * ``ChatRuntime.achat`` / ``ChatRuntime.arespond`` call the sync
    ``generate()`` under ``asyncio.to_thread`` semantics (the
    explicit comment in ``achat`` documents this: "the underlying
    call is still synchronous CPU-bound work").
  * No production code, eval, demo, or test references
    ``agenerate``.
  * Re-exported in ``generate/__init__.py`` but only as a public
    name, never consumed.

The function was therefore reachable only by accident — any caller
wiring it would silently get a walk that ignores every ADR added
since ADR-0022.  CLAUDE.md's "small, load-bearing PRs" doctrine
explicitly disfavors maintaining diverged reimplementations of the
core loop as a future hook.

Removed:
  * ``async def agenerate`` (43 lines) from ``generate/stream.py``.
  * ``agenerate`` from the ``generate/__init__.py`` star import and
    ``__all__``.

If a real async walk path becomes necessary later (e.g. once
``achat`` needs genuine off-thread execution), the right shape is a
thin ``asyncio.to_thread`` wrapper over the real ``generate()`` —
not a parallel reimplementation.

Verification:
  * ``ripgrep agenerate`` — zero remaining references in the repo.
  * ``core test --suite cognition`` — 120/0/1.
  * ``core test --suite smoke`` — 67/0.
  * ``core test --suite runtime`` — 19/0.
This commit is contained in:
Shay 2026-05-20 19:59:28 -07:00 committed by GitHub
parent e41a14f76c
commit 4d68dc89c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 47 deletions

View file

@ -13,7 +13,7 @@ from .dialogue import (
propose_dialogue,
trajectory_blade,
)
from .stream import generate, agenerate
from .stream import generate
from .surface import SentenceAssembler, SentencePlan, assemble as assemble_surface
__all__ = [
@ -23,7 +23,6 @@ __all__ = [
"FrameSlot",
"Proposition",
"PropositionFrame",
"agenerate",
"blade_alignment",
"classify_dialogue_blade",
"generate",

View file

@ -638,48 +638,3 @@ def generate(
admissibility_trace=tuple(admissibility_trace),
region_was_unconstrained=region_was_unconstrained,
)
async def agenerate(
state: FieldState,
vocab,
persona,
max_tokens: int = 128,
vault=None,
recall_top_k: int = 3,
):
current = state
recent_nodes = deque([state.node], maxlen=_RECENT_WINDOW)
stop_nodes = frozenset(
idx for token in _STOP_TOKENS
if (idx := _try_index(vocab, token)) is not None
)
for _ in range(max_tokens):
current, _hits_applied = _recall_state(
_voiced_state(current, persona),
vault,
recall_top_k,
)
word, word_idx = _nearest_next(
vocab,
current.F,
current.node,
recent_nodes=tuple(recent_nodes),
stop_nodes=stop_nodes,
)
yield _articulate(vocab, word)
A = vocab.get_versor_at(current.node)
B = vocab.get_versor_at(word_idx)
V = word_transition_rotor(A, B)
current = propagate_step(current, V)
current = FieldState(
F=current.F,
node=word_idx,
step=current.step,
holonomy=current.holonomy,
energy=current.energy,
valence=current.valence,
)
recent_nodes.append(word_idx)