Skip to content

espeak-shared: never exit on eSpeak init failure; detect truncated data paths - #79

Merged
lalalune merged 1 commit into
mainfrom
claude/espeak-data-path
Oct 14, 2026
Merged

lalalune merged 1 commit into
mainfrom
claude/espeak-data-path

Conversation

@lalalune

Copy link
Copy Markdown
Member

Summary

  • eliza_espeak_shared::prepare() called espeak_Initialize(..., options=0). In eSpeak NG 1.52 that calls exit(1) when the data cannot be loaded, so a bad data directory ended the whole process (on Android, the agent). It now initialises through espeak_ng_InitializePath / espeak_ng_Initialize / espeak_ng_InitializeOutput, which return a status.
  • libespeak-ng keeps its data path in a fixed N_PATH_HOME buffer (160 bytes on POSIX) and truncates longer paths silently, then falls back to its compiled-in default data. prepare() now reads back the kept path (espeak_Info) and fails with an error naming N_PATH_HOME when it is not the requested directory (or its espeak-ng-data child).
  • A missing data directory is now an error. Before, eSpeak silently loaded its default data instead.
  • misaki's fixed "~135 bytes" pre-check is removed. The limit is whatever the linked libespeak-ng was built with; the eliza Android build raises it to 1024 (-DN_PATH_HOME=1024, in the companion eliza PR).

Tests

New ctest misaki_g2p_espeak_data_path (skips with code 77 without libespeak-ng or its data). It covers:

  • a missing directory;
  • 150-byte and 400-byte parents with an espeak-ng-data link;
  • recovery on the short path afterwards.

Local runs on macOS arm64:

  • Homebrew eSpeak NG 1.52.0 (N_PATH_HOME 160): both long paths are rejected with the N_PATH_HOME error, the short path still works, and the process stays up. misaki_g2p_mini_lexicon, misaki_g2p_unit, misaki_g2p_espeak_shared and misaki_g2p_espeak_data_path pass.
  • eSpeak NG 1.52.0 built from the pinned source with -DN_PATH_HOME=1024: both long paths are accepted and phonemize byte-identically to the short path.

AI assistance disclosure: written with Claude Code.

🤖 Generated with Claude Code

…ta paths

espeak_Initialize() calls exit(1) when its data cannot be loaded unless
espeakINITIALIZE_DONT_EXIT is passed, and the shared owner passed 0, so a bad
eSpeak data directory ended the whole process (the agent on Android).
libespeak-ng also copies the data path into a fixed N_PATH_HOME buffer
(160 bytes on POSIX) and silently truncates a longer one, then falls back to
its compiled-in default data.

prepare() now:
- rejects a missing data directory with an error;
- initialises through espeak_ng_InitializePath/espeak_ng_Initialize/
  espeak_ng_InitializeOutput, which return a status instead of exiting;
- reads back the path libespeak-ng kept (espeak_Info) and fails, naming
  N_PATH_HOME, when it is not the requested directory (or its
  espeak-ng-data child).

misaki's fixed "~135 bytes" pre-check is removed: the limit is whatever the
linked libespeak-ng was built with, and the Android builds raise it.

New test misaki_g2p_espeak_data_path: missing dir, 150- and 400-byte paths
(rejected with a 160-byte N_PATH_HOME, accepted and phonemized identically
with -DN_PATH_HOME=1024), and recovery on the short path afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lalalune

Copy link
Copy Markdown
Member Author

Merging. Checks: 32 passed. macOS-latest-arm64 fails only in test-metal-matmul-support (Subprocess aborted). That job also fails on main and on #77, so it is not caused by this change. The riscv64/ppc64le/s390x/graviton4 runners never get scheduled on this fork (also pending on #77). windows-2022-cuda is still queued; the changed header compiles only when libespeak-ng is linked, and that is not the case on Windows CI (windows-latest passed).

@lalalune
lalalune merged commit 5df17a6 into main Oct 14, 2026
33 of 38 checks passed
lalalune added a commit to elizaOS/eliza that referenced this pull request Oct 14, 2026
…everywhere, raise the eSpeak path limit (#36239)

* fix(voice): stage eSpeak NG data on AOSP, name the Paradee GGUF v1_0 everywhere, raise the eSpeak path limit

- The mobile-voice catalog staged tts/paradee/paradee-8m-v1.0.gguf, while
  ElizaBionicInferenceServer, paradee-voice/inputs.json, the paradee-voice
  build and the host worker use paradee-8m-v1_0.gguf. The catalog (path,
  hfPath, missingAssets) now uses paradee-8m-v1_0.gguf, and the Paradee GGUF
  and misaki lexicon rows carry their byte-reproducible pins. A group staged
  under the old name is restaged (the record's path is compared too).
- AOSP bootstrap passed espeak_data_dir=NULL to eliza_inference_paradee_load,
  so misaki spelled out every word outside its lexicon. The catalog now lists
  the 7 pinned eSpeak NG 1.52.0 English data files (GPL-3.0-or-later,
  flagged, unpublished, catalog-pinned), staged as a nested group
  tts/paradee/espeak-ng-data after tts/paradee. The bootstrap passes
  <bundle>/tts/paradee when that group is staged, logs the resulting G2P
  kind, and if the load with eSpeak data fails it retries with the lexicon
  alone and warns.
- libespeak-ng keeps its data path in a 160-byte N_PATH_HOME buffer (about
  135 bytes of directory). stage-elizavoice-lib builds the Android
  libespeak-ng with -DN_PATH_HOME=1024, checks path_home's size in the
  archive, and keys its reuse stamp on the option so older builds are
  rebuilt. The compiled data bytes are unchanged.

- llama.cpp gitlink 866a6da2 -> 5df17a66 (elizaOS/llama.cpp#79): the shared
  eSpeak owner no longer exit(1)s when the data cannot load, and it rejects
  a data path libespeak-ng would truncate (naming N_PATH_HOME) instead of
  quietly loading other data. misaki's fixed ~135-byte check is gone.

Tests: aosp-voice-download covers the catalog/inputs.json/Bionic/host-worker
name and pin agreement, the nested eSpeak group (ordering, staging, tamper,
path escape) and restaging on a renamed row; the bootstrap test covers the
eSpeak load fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style(voice): biome format the AOSP voice staging changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <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