Skip to content

fix(Alden): block unconfirmed MLX replies before speech and durable history - #31

Closed
twoimo wants to merge 11 commits into
codex/alden-activity-order-20261011from
codex/alden-voice-completion-fence-20261011
Closed

twoimo wants to merge 11 commits into
codex/alden-activity-order-20261011from
codex/alden-voice-completion-fence-20261011

Conversation

@twoimo

@twoimo twoimo commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Fixes a production-path gap in the local MLX voice runtime: previously a transport-complete, partial assistant text could reach TTS and persisted assistant history even if the generation had no verified finish reason, was content-filtered/tool-directed, carried an explicit failure, or appended another response after a "stop" marker.

Implementation, stacked strictly on draft #30:

  • Require one unambiguous local response with finish_reason="stop" before a reply can be returned to AldenVoicePipeline. Preserve explicit length-truncation handling; refuse missing/unknown, content_filter, tool_calls, function_call, failed/incomplete/cancelled states and explicit error payloads.
  • For SSE, verify ordered termination before accepting [DONE]; reject injected post-stop content/duplicate terminal frames and tool-call fragments. Permit a subsequent usage-only frame (choices=[]) without creating an extra answer.
  • Fail closed on duplicate JSON keys, nonfinite NaN/Infinity and exponent overflow from the loopback provider; reject invalid assistant roles or multiple selected choices.
  • Continue using the existing fixed local MLX model readiness check, per-turn request/context/source identity, abort guard and aggregate metrics; do not modify model choices, Gemini routes, voices, OSK, queue, or any production settings.
  • Run the real AldenVoicePipeline.process_text, LocalMlxLlm, AbortToken, and local SQLite voice_messages with only the provider socket and audio hardware faked. Confirm rejected model text is never spoken or persisted, the confirmed user input remains, duplicate event IDs cannot replay, and the next valid turn retains its ID/context attribution.

Verified: macOS Actions #38072362981, exact CI source b83ac5c34481ac827fa75a5862245658bb393e38: 175 tests, 169 passed, 6 skipped because this focused runner lacks NumPy. The implementation/test Git blob SHAs match this CI branch exactly. Earlier CI failures 38072109129 and 38072289600 exposed fixture assumptions that missing completion was accepted as success; fixtures were made explicit rather than relaxing the new production completion rule.

Technical contract, dated evidence and required Mac recovery steps.

Explicit limitations: No valid Core native turn_token or desktop Mac Computer Use channel has been provided to this turn. Therefore the user's designated Mac clone, goal-objective.md, outputs/STATUS.md, installed app and live model/STT/TTS sessions could not be accessed or changed. Remote synthetic macOS CI is not a physical device test, product model swap, notarized release or production deployment. PR #27-#30 remain open draft and unmerged.

@twoimo

twoimo commented Nov 23, 2026

Copy link
Copy Markdown
Owner Author

Closing: this is the Oct 10-11 side stack #28 to #32 (87 commits from 0509551, not in #48 by patch-id). It touches no src/ file and no auto-reply worker or supervisor. 31 of its 38 changed files do not exist on main (scripts/alden_voice.py, scripts/alden_tool_runtime.py, scripts/alden_collection.py, desktop/src/knowledge/* and their tests), so it cannot land on main without the lineage. The one change to a file main uses standalone is 72c7a3d in scripts/verify_local_models.py, a stricter operator-only probe that nothing on main calls. It stays on the branch.

Why the lineage cannot land as drafts. The codex/alden-* lineage forked from main at 533dbf6 (2026-10-05). Its tip is #48 (5f4843f), 727 commits ahead. main then took the 1.9.0/1.9.1 stability work (#49 to #58), and none of these drafts was rebased onto it.

  • A trial merge of main into the tip conflicts in 36 files, including 10k-line hunks in src/main.rs and src/context/mod.rs, which 1.9.0 split into modules.
  • A read-only audit found that the lineage's src/ax_send.rs lacks two 1.9.x composer safeguards: e14458e (an unreadable composer is not treated as empty) and 7d9635d (no second Return without a composer read, the double-send fix). A conflict resolved toward the lineage would compile and silently undo both.
  • The lineage's queue code bails on queue schema v3.
  • About 1.24M of the tip's 1.57M added lines are generated docs/architecture snapshots (about 121 MB).

What was kept. The audit read all 69 lineage commits that touch src/ or the auto-reply scripts. The three that fix main's production send path are now on main:

Every other lineage commit is on main already, superseded there, or Alden desktop and feature work that depends on lineage-only modules.

Nothing is deleted. The branch stays on the remote. The installed /Applications/Alden.app 0.3.219 was built from this lineage (a124320), so treat the branch as the source of that build. To bring the desktop work to main, start a planned integration from the tip, codex/alden-explicit-references-20261025, rebased onto main. Keep main's side in src/ax_send.rs and the queue v3 code. Reopen this PR or start from the branch if you want it.

@twoimo twoimo closed this Nov 23, 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