Repository navigation
Conversation
joelteply
added a commit
that referenced
this pull request
May 18, 2026
…mpt -> inference (#1409) (#1415) * feat(persona): Lane D — Rust persona/turn-execute chains drain -> prompt -> inference (#1409) Adds the `persona/turn-execute` command in CognitionModule that executes a full persona turn in ONE Rust hop: drain inbox -> wrap in PersonaTurnFrame -> derive ResponsePrompt (lazy) -> build InferenceRequest (prompt_text path) -> dispatch `inference/llm/request` via the global command_executor (routes to InferenceLlmModule registered in PR-5 #1404) -> bundle replayRecord + inferenceResponse -> persist replay record (v2 schema with response_prompt captured from #1412) Files changed: * src/persona/turn_frame.rs: new `ResponsePrompt::to_prompt_text` helper that flattens system_prompt + chat messages into a single deterministic plain-text prompt for adapter-based engines (LlamaCppAdapter, cloud adapters). Format: "<system>\n\nrole: content\nrole: content\n..." Empty system_prompt produces no leading paragraph; lowercase role matches the on-the-wire PromptRole serde format. * src/modules/cognition.rs: new `persona/turn-execute` command. Inputs: - persona_id (required) - window_ms (default 80), max_items (default 16) - composition_artifact_id (default Uuid::nil()) - max_tokens (default 512), max_duration_ms (default 10_000) Returns: { "replayRecord": PersonaTurnFrameReplayRecord | null, "inferenceResponse": InferenceResponse | null } Empty drain returns the null pair (no-op, not Err). Missing persona returns typed Err per Joel's never-swallow rule. Tests (+9, all green): * persona::turn_frame (6 new, total 18): - to_prompt_text_renders_each_message_as_role_colon_content - to_prompt_text_prepends_system_prompt_when_present - to_prompt_text_skips_empty_system_prompt - to_prompt_text_handles_mixed_roles_in_order - to_prompt_text_handles_no_messages - to_prompt_text_empty_prompt_returns_empty_string * modules::cognition::turn_execute_tests (3 new): - turn_execute_persona_not_found_returns_typed_error - turn_execute_empty_drain_returns_null_bundle - turn_execute_bad_max_items_returns_typed_error The dispatch-success path (drain -> dispatch -> inference response) runs through `command_executor::executor()` which is only initialized at runtime startup (ipc/mod.rs). Tests that exercise the executor live in the integration suite; unit-tests here cover the param-parse + short-circuit + persona-not-found paths. Builds atop #1412 (v2 schema with response_prompt) and #1404 (InferenceLlmModule runtime registration). Closes alpha card #1409. Why one command: the TS persona loop previously executed each stage with its own IPC round-trip (drain, then build prompt, then call inference) — 3 round-trips per turn, prompt-building lived in TS. Lane D pulls all three into the substrate so (a) the prompt is built in Rust where the turn-frame lives, (b) the production replay record carries the exact prompt that fed inference, (c) the persona turn becomes one observable unit on the bus. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(persona,#1409): force turn-execute through Rust registry (#1417) * fix(persona,#1409): force turn-execute through Rust registry * fix(runtime,#1409): use unlimited concurrency contract for cognition --------- Co-authored-by: Test <[email protected]> --------- Co-authored-by: Test <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Sep 21, 2026
…played beacon never moves a ledger row backwards (#4318) Card ac4bca50. Every attach cursor under ~/.continuum/state/ froze on 2026-09-14 17:20 — the afternoon airc #1417 (5120d5a) made the daemon's `AttachCursorAdvanced` frame opt-in per attach to end the WARN floods on airc-lib's subscribe streams (c5466b56 / e28889cc). This consumer persists its watermark and names that frame its SOLE advance source (WATERMARK DISCIPLINE, #261), and never opted in: `grep cursor_heartbeat core/` was empty. `airc.cursor.advanced` probes since: 0. So every core boot on every node resumed each room from a week-old watermark and streamed the gap as live events. IntelMac, 2026-09-21 18:15Z: 1,229 / 3,636 / 2,711 chat projections per minute for three minutes, then ~1 — 7,700 events of the fleet room into the bus, the chat projection and the capacity ledger, each stamped heard-now. The grid fold then judged three nodes (one of them THIS node) "behind" from beacons their senders had published days earlier, and posted "reboot there" for each — the 07-30 glass-box shape returned by a pin bump. 1. `attach_request_for_cursor`: `.with_cursor_heartbeat()` on both arms. The resume arm has no coalesced seam, so the heartbeat is its only advance; the first-attach arm gets the seam summary once and the heartbeat keeps the watermark ≤1 s behind after it. 2. `GridCapacityLedger::hear`: an offer the sender stamped earlier than the one already held for that peer is dropped — sender's clock against the sender's own clock, no receiver skew; equal (a re-sent frame) and unstamped (0, an older core) still fold. `replays_an_older_reading` is the pure rule. Tests: `every_attach_asks_for_the_cursor_heartbeat_it_persists` (both arms; drop either call → red), `a_replayed_older_reading_never_overwrites_ a_fresher_row` (older stamp dropped, equal and unstamped fold, rule pinned). Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Note
This still proves Rust turn assembly/routing, not real model inference. The next gate must wire InferenceLlmModule with a real adapter and replay a prod-shaped turn through an actual model.