Skip to content

fix(persona,#1409): force turn-execute through Rust registry#1417

Merged
joelteply merged 2 commits into
feat/lane-d-persona-turn-executefrom
codex/lane-d-turn-execute-rust-only
May 18, 2026
Merged

fix(persona,#1409): force turn-execute through Rust registry#1417
joelteply merged 2 commits into
feat/lane-d-persona-turn-executefrom
codex/lane-d-turn-execute-rust-only

Conversation

@joelteply
Copy link
Copy Markdown
Contributor

Summary

Validation

  • cargo test --manifest-path src/workers/continuum-core/Cargo.toml modules::cognition::turn_execute_tests --lib --features metal,accelerate => 5/5
  • cargo test --manifest-path src/workers/continuum-core/Cargo.toml persona::turn_frame --lib --features metal,accelerate => 18/18
  • precommit: TypeScript compilation passed; Rust clippy held at baseline 157; browser tests skipped because ./jtag ping and continuum-core IPC socket were unavailable

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.

@joelteply joelteply merged commit 76cf52a into feat/lane-d-persona-turn-execute May 18, 2026
3 checks passed
@joelteply joelteply deleted the codex/lane-d-turn-execute-rust-only branch May 18, 2026 19:16
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) <noreply@anthropic.com>

* 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 <test@test.com>

---------

Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant