Skip to content

fix(core): parseKeyValueXml prefix-tag corruption + extractFirstSentence dead abbrevs + secrets settingUpdated - #11573

Merged
NubsCarson merged 1 commit into
developfrom
fix/core-parser-text-secrets
Jul 2, 2026
Merged

NubsCarson merged 1 commit into
developfrom
fix/core-parser-text-secrets

Conversation

@NubsCarson

Copy link
Copy Markdown
Member

Fixes #11572. Three provable @elizaos/core correctness bugs surfaced by a Fable-5 hunt of the quiet (non-money/cloud) lanes — each small, surgical, and mutation-checked.

# bug fix
1 parseKeyValueXml drops a field + promotes a bogus keyfindMatchingXmlClose uses indexOf(\<${tag}`), which matches any tag *starting with* the name, so <textarea>inside avalue inflates depth → close never found →textdropped,textarea` promoted. Hits live cloud evaluators (room-title, helpers) on model output. bump depth only on exact tag-name match
2 extractFirstSentence never matches its own e.g/i.e\b(\w+)$ excludes ., extracting "g" from "e.g"; the abbreviation entries are dead → the first-sentence / TTS early-emit path chops replies at "e." capture [\w.]+, strip a trailing dot before comparing
3 secrets-setup settingUpdated ships literal {{settingName}} for custom messages (.replace bound to the default only) and returns the next key as updatedKey (read after reassignment) parenthesize like the askSetting branch; return the just-answered key

Evidence

  • Mutation-checked tests for all three (reverting each fix reds its test — verified individually):
    • structured-parser.test.ts: prefix-extended tag in a value round-trips ({text, thought}, no textarea key).
    • text-splitting.test.ts (new): e.g./i.e. don't split; Mr./Dr. still don't; normal sentences do.
    • secrets/setup/service.test.ts (new): custom settingUpdated substitutes the name; updatedKey is the answered key.
  • Regression sweep: 482 tests / 74 files green (__tests__/, utils/, features/secrets/).
  • Also removed 3 stale gitignored .js build artifacts under core/src that shadow the .ts (a parseKeyValueXml import without extension was resolving to a stale build — the known core-src-stale-.js trap; the fix looked broken until I cleared them).

N/A rows

  • Live-LLM trajectory: partial N/A — bugs 1 & 2 are on the model-output parsing path (deterministic string logic), asserted directly against the real functions with the exact adversarial inputs (<textarea> in a value; "e.g."); no model behavior changed. Bug 3 is UI-message plumbing.
  • Screenshots: N/A (no UI surface).

Authored via a Fable-5 hunt (found + specified) + mutation-checked implementation. A companion voice-UI batch (listener-leak / re-entrancy / error-handling) is coming separately.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f9ee954e-c267-4160-a369-75dfe905e793

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/core-parser-text-secrets

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

…nce dead abbrevs + secrets settingUpdated (#11572)

Three provable, unit-tested correctness bugs (Fable-5 hunt of quiet lanes):

1. parseKeyValueXml (utils.ts findMatchingXmlClose): indexOf(`<${tag}`) matched
   any tag whose name merely STARTS with the target, so a value containing
   `<textarea>` while closing `<text>` inflated depth → the close was never
   found, the field dropped, and `textarea` promoted to a top-level key. Used by
   live cloud evaluators on model output. Fix: bump depth only on exact tag-name
   match; skip prefix-extensions.

2. extractFirstSentence (utils/text-splitting.ts): the preceding-word match
   `\b(\w+)$` excludes `.`, extracting only "g" from "e.g", so the e.g/i.e
   abbreviation entries were dead and the first-sentence/TTS early-emit path
   chopped replies at "e.". Fix: capture `[\w.]+` and strip a trailing dot.

3. secrets setup service (features/secrets/setup/service.ts): the settingUpdated
   response bound `.replace` to the DEFAULT only (custom messages shipped raw
   {{settingName}}), and updatedKey read session.currentSettingKey AFTER it was
   reassigned to the next key. Fix: parenthesize like askSetting; return the
   just-answered key.

Each fix has a mutation-checked test (reverting reds it). Also removed 3 stale
gitignored .js artifacts under core/src that shadow the .ts (a parseKeyValueXml
import without extension resolved to a stale build). Regression sweep: 482 tests
across 74 files green.
@lalalune
lalalune force-pushed the fix/core-parser-text-secrets branch from 16b84f5 to 30126d9 Compare July 2, 2026 21:02

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@lalalune lalalune left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified after rebasing onto current origin/develop (9a15c0f).

Local evidence on rebased head 30126d9:

  • git diff --check origin/develop...HEAD
  • bun run --cwd packages/core test -- src/__tests__/structured-parser.test.ts src/utils/text-splitting.test.ts src/features/secrets/setup/service.test.ts ✅ 3 files / 8 tests
  • bunx @biomejs/biome@2.5.2 check packages/core/src/__tests__/structured-parser.test.ts packages/core/src/features/secrets/setup/service.test.ts packages/core/src/features/secrets/setup/service.ts packages/core/src/utils.ts packages/core/src/utils/text-splitting.test.ts packages/core/src/utils/text-splitting.ts
  • bun run --cwd packages/core typecheck
  • broader regression slice: bun run --cwd packages/core test -- src/__tests__ src/utils src/features/secrets ✅ 75 files / 490 tests

The three fixes are narrow and directly covered: exact tag matching in XML close scanning, dotted abbreviation handling for first-sentence extraction, and secrets setup settingUpdated placeholder/updatedKey behavior.

@NubsCarson
NubsCarson merged commit ebd5203 into develop Jul 2, 2026
40 of 62 checks passed
@NubsCarson
NubsCarson deleted the fix/core-parser-text-secrets branch July 2, 2026 21:07
lalalune pushed a commit that referenced this pull request Jul 3, 2026
…unctuation

ebd5203 (#11573) fixed the dead e.g/i.e entries by matching [\w.]+ but
anchored the match with (?:^|\s), which rejects abbreviations preceded by
quotes/parens/asterisks ('"Dr' / '(Mr') that the original \b handled — the
tts first-sentence early-emit path chopped mid-name ('He cited "Dr.').
drop the anchor: leftmost matching already captures the maximal trailing
[\w.] run and any other char or start-of-string delimits it.
@claude

claude Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions github-actions Bot added the Tests label Jul 3, 2026
lalalune pushed a commit that referenced this pull request Jul 3, 2026
…unctuation

ebd5203 (#11573) fixed the dead e.g/i.e entries by matching [\w.]+ but
anchored the match with (?:^|\s), which rejects abbreviations preceded by
quotes/parens/asterisks ('"Dr' / '(Mr') that the original \b handled — the
tts first-sentence early-emit path chopped mid-name ('He cited "Dr.').
drop the anchor: leftmost matching already captures the maximal trailing
[\w.] run and any other char or start-of-string delimits it.

(cherry picked from commit 99511f2)
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.

core: three provable correctness bugs — parseKeyValueXml prefix-tag corruption, extractFirstSentence dead abbreviations, secrets-setup settingUpdated

2 participants