Skip to content

fix(runtime): handle IGNORE action fallback and tolerate upstream IGNORE#6543

Open
paulf280-ui wants to merge 68 commits intoelizaOS:v2-developfrom
paulf280-ui:fix/ignore-action-upstream
Open

fix(runtime): handle IGNORE action fallback and tolerate upstream IGNORE#6543
paulf280-ui wants to merge 68 commits intoelizaOS:v2-developfrom
paulf280-ui:fix/ignore-action-upstream

Conversation

@paulf280-ui
Copy link
Copy Markdown

@paulf280-ui paulf280-ui commented Mar 1, 2026

Summary

  • Fixes IGNORE action handling in the agent runtime — when the LLM selects IGNORE, the runtime now falls back gracefully rather than erroring or hanging
  • Adds diagnostics and tolerance for upstream IGNORE action signals in the bootstrap plugin
  • Pins tsup, externalizes tokenizers, and fixes embedding input coercion in @elizaos/core
  • Fixes UUID and parsing helpers; makes embedding tests deterministic
  • Adds CLAUDE.md with build commands and architecture overview for contributors

Test plan

  • Run bun run test:core — all vitest tests pass including new deterministic embedding tests
  • Verify agent does not crash/hang when LLM responds with IGNORE action
  • Verify bun run build:core succeeds cleanly

🤖 Generated with Claude Code

Greptile Summary

This PR adds core TypeScript files (runtime.ts, embedding.ts, parsing.ts, uuid.ts) to @elizaos/core package that were previously missing from source control. The main changes include:

  • IGNORE action handling: Implements graceful fallback when LLM returns IGNORE action (lines 1084-1088 in runtime.ts) — treats it as a no-op instead of throwing "Action not found" errors
  • Embedding robustness: Adds input type coercion to handle non-string inputs gracefully, returning empty arrays for empty inputs
  • Build configuration: Pins tsup to ^8.5.1 and externalizes native modules (@anush008/tokenizers, onnxruntime-node, sharp) to prevent bundling issues
  • Test coverage: Adds deterministic embedding tests with mocked dependencies
  • Python additions: Adds agent.py, run_traderbot.py, and trader.json for Python runtime testing; extensively refactors runtime.py (5484 lines changed)

Issues found:

  • Type mismatch in embedding.ts:234 where input (type unknown) is passed to retrieveCachedEmbedding which expects string — should pass text instead
  • Inconsistent logging using console.error instead of elizaLogger in parsing.ts
  • Misleading comment in tsup.config.ts about CommonJS when using ESM format

Confidence Score: 3/5

  • This PR has one critical type mismatch bug that must be fixed before merge
  • Score reflects a logic bug in embedding.ts:234 where wrong variable type is passed to retrieveCachedEmbedding. This could cause runtime type errors. The IGNORE action handling and other changes are well-implemented, but the type bug needs resolution.
  • Pay close attention to packages/core/src/embedding.ts line 234 — type mismatch that needs fixing

Important Files Changed

Filename Overview
packages/core/src/runtime.ts Added IGNORE action fast-path at lines 1084-1088 to gracefully handle IGNORE actions without throwing errors
packages/core/src/embedding.ts Added input coercion for robustness, but type mismatch at line 234 where input is passed instead of text to retrieveCachedEmbedding
packages/core/src/parsing.ts Added comprehensive JSON parsing utilities, but uses console.error instead of elizaLogger at 8 locations (lines 100, 101, 119, 120, 154, 155, 168, 169)
packages/core/tsup.config.ts Added build config with tokenizers externalized, but misleading comment at line 8 says "targeting CommonJS" when format is "esm"
packages/python/elizaos/runtime.py Extensive refactoring with 5484 lines changed; difficult to review comprehensively without more context

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Start[LLM Returns Action] --> Normalize[Normalize Action Name]
    Normalize --> CheckIgnore{Is IGNORE or<br/>contains 'ignore'?}
    CheckIgnore -->|Yes| LogIgnore[Log: Skipping IGNORE action]
    CheckIgnore -->|No| FindAction[Look up action in registry]
    LogIgnore --> Continue[Continue to next message]
    FindAction --> ActionExists{Action found?}
    ActionExists -->|Yes| CheckHandler{Has handler?}
    ActionExists -->|No| LogError[Log: Action not found]
    CheckHandler -->|Yes| Execute[Execute action.handler]
    CheckHandler -->|No| LogNoHandler[Log: No handler]
    LogError --> Continue
    LogNoHandler --> Continue
    Execute --> HandleError{Error occurred?}
    HandleError -->|Yes| LogExecError[Log execution error]
    HandleError -->|No| Success[Action completed]
    LogExecError --> Continue
    Success --> Continue
Loading

Last reviewed commit: dbc6b01

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

lalalune and others added 30 commits February 6, 2026 23:57
Squashed 245 commits from the v2.0.0-alpha branch into a single commit.
This includes the full v2.0.0 architecture rewrite, plugin restructuring,
new examples, test improvements, and all related cleanups.

Co-authored-by: Cursor <cursoragent@cursor.com>
This merge commit unifies the git history of the develop branch (v1.7.x)
with the next branch (v2.0.0-alpha rewrite). The tree is taken entirely
from next — the v2 rewrite supersedes all v1.x code structure.

Valuable develop-only changes (plugin-sql domain stores, request context,
EMBEDDING_DIMENSION, MESSAGE_SENT event, RLS/withIsolationContext) will
be ported as follow-up commits to their new v2 package locations.
- Merge develop history into next via `merge -s ours` (unified git graph,
  v2 tree preserved)
- Port request-context (per-entity settings via AsyncLocalStorage) from
  develop's core into packages/typescript/src/
- Port EMBEDDING_DIMENSION config to skip ~500ms API call during init
- Emit MESSAGE_SENT event after response messages saved to memory
- Extract full plugin-sql package from develop (domain stores, Neon
  serverless, RLS/withIsolationContext, Drizzle schema, runtime migrator)
- Fix TS errors in runtime.ts (ActionResult cast, LogBody phase field)
- Include pre-existing WIP changes (computeruse, python, rust, tui)

Co-authored-by: Cursor <cursoragent@cursor.com>
Source fixes:
- approval.ts: resolve pending promises as cancelled in stop() (was hanging)
- tools.ts: empty allow list (allow:[]) now correctly denies all tools
- secrets.ts: Telegram bot token regex {35} -> {35,43} to match real tokens
- test-utils.ts: complete rewrite — add createTestCharacter, fix
  expectRejection/retry/waitFor signatures, add randomString/randomSentence
- vitest.config.ts: exclude e2e/ dir from vitest (Playwright conflict)

Test fixes:
- character-utils: clean MODEL_PROVIDER_SECRETS from process.env in tests
  that assume no env-based providers (OPENAI_API_KEY set by .env.test)
- autonomy-task: update expected AUTONOMY_TASK_TAGS to match source
- onboarding-state: use == null (loose) to catch both null and undefined
- onboarding-cli: update inline Telegram regex to match secrets.ts
- plugin-browser-imports: skip gracefully when plugins/ dir is empty
- bootstrap providers: fix default imports to named imports

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- Fix Rust Core Tests: run cargo fmt to fix formatting issues in
  runtime.rs, message_service.rs, and integration_tests.rs
- Fix Python Core Tests: commit protobuf generated types that were
  gitignored, causing ModuleNotFoundError for elizaos.types.generated
- Fix Rust SQL Plugin / WASM Build / Python SQL Plugin Tests: add
  directory existence checks so jobs skip gracefully when
  plugins/plugin-sql/{rust,python} directories don't exist yet
- Update .gitignore to allow generated files needed by packages

Co-authored-by: Cursor <cursoragent@cursor.com>
The Rust package uses prost-build which requires the protoc binary
to compile protobuf definitions. Add apt-get install step for
protobuf-compiler in the CI workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
The native and wasm features are mutually exclusive (runtime uses
cfg(all(feature = "native", not(feature = "wasm")))). Using
--all-features enables both, excluding the runtime module entirely.
Switch to explicit native,bootstrap-internal features instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add spec_helpers module export to generated/mod.rs (was missing,
  causing unresolved import errors in bootstrap actions)
- Remove duplicate HashMap import in send_message.rs
- Format spec_helpers.rs with cargo fmt
- Use default features (native) for CI tests since bootstrap-internal
  has WIP compilation issues that need separate resolution

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove ../milaidy from workspaces array in package.json since it
references a parent workspace submodule that doesn't exist in CI,
causing bun install to fail during Interop Tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
The plugins workspace directory must exist for bun install and turbo
build to work. Without it, the @elizaos/prompts build fails with
ENOENT when scanning the plugins directory.

Co-authored-by: Cursor <cursoragent@cursor.com>
The TypeScript build has missing dependencies (drizzle-orm) that
prevent a full build. Since interop tests are experimental and their
test steps already use || true, make the install and build steps
non-blocking with continue-on-error.

Co-authored-by: Cursor <cursoragent@cursor.com>
Adds intelligent action filtering to reduce prompt bloat when agents have
many registered actions (50+). The service uses a two-tier ranking pipeline:

1. Vector search: embed action descriptions at registration, cosine similarity at query time
2. BM25 reranking: keyword-based scoring catches exact matches vectors miss

Key changes:
- New ActionFilterService (services/action-filter.ts) with full metrics/monitoring
- Pure TypeScript BM25 index (services/bm25.ts) — zero dependencies
- Pure TypeScript cosine similarity (services/cosine-similarity.ts)
- Modified ACTIONS provider to use filtering when service is available
- Provider filtering: auto-includes relevant dynamic providers via BM25
- Route type: added x402 payment config field to BaseRoute interface
- 161 tests covering BM25, cosine sim, filtering pipeline, edge cases

Graceful degradation: no embedding model → BM25-only. Service absent → original behavior.
Backward compatible: agents with <15 actions see zero change.

Co-authored-by: Cursor <cursoragent@cursor.com>
Includes critical fix for duplicate key violation on worlds table:
- plugin-sql: WorldStore.create() uses onConflictDoNothing()
- core: ensureWorldExists() checks existence before insert

Co-authored-by: Cursor <cursoragent@cursor.com>
- Updated bun.lock and examples-manifest.json
- Removed legacy plugin-sql package (migrated to polyglot architecture)
- Minor fixes in rust generated code and typescript search/components

Co-authored-by: Cursor <cursoragent@cursor.com>
…found

Replace hard throw in roleProvider with graceful return of empty data.
Downgrade settingsProvider log from error to debug since missing room is
a normal condition in autonomous/task contexts.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ferences

chore(changelog): remove references
- Add SummarizationEvaluator: dialogue filtering, threshold gating, rolling XML-based LLM summaries
- Add LongTermExtractionEvaluator: cognitive science categories, strict confidence thresholds (0.85+), checkpointing
- Add ContextSummaryProvider: returns session summaries with/without topics
- Extend MemoryService: session summary CRUD, extraction checkpointing, config management, formatted memories
- Add prompts.rs: 3 XML templates matching TS/Python exactly
- Add types: SummaryResult, MemoryExtraction
- Update plugin registration: 2 providers + 2 evaluators (was 1 provider + 0 evaluators)

Rust agent can now learn from conversations, summarize context, and extract long-term facts.
- align python/rust/typescript runtime, schema, and provider updates\n- add new autonomy evaluators, embedding parity tests, and training utilities\n- remove deprecated packaged security skills\n- ignore and clean local/generated artifacts (.cursor, trained_models, temp outputs)
github-actions bot and others added 26 commits February 17, 2026 01:42
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 1, 2026

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.

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
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

13 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

}

// Check cache first
const cachedEmbedding = await retrieveCachedEmbedding(runtime, input);
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.

type mismatch — retrieveCachedEmbedding expects string but receives input (type unknown). should pass text instead

Suggested change
const cachedEmbedding = await retrieveCachedEmbedding(runtime, input);
const cachedEmbedding = await retrieveCachedEmbedding(runtime, text);

Comment on lines +100 to +101
console.error("Error parsing JSON:", e);
console.error("Failed parsing text:", jsonBlockMatch[1]);
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.

use elizaLogger.error instead of console.error for consistency with the rest of the codebase (also affects lines 119-120, 154-155, 168-169)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

outDir: "dist",
sourcemap: true,
clean: true,
format: ["esm"], // Ensure you're targeting CommonJS
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.

misleading comment — says "targeting CommonJS" but format is esm

Suggested change
format: ["esm"], // Ensure you're targeting CommonJS
format: ["esm"], // ESM format for modern Node.js

@odilitime odilitime added the 1.x V2 label Mar 4, 2026
@odilitime odilitime changed the base branch from develop to v2-develop March 4, 2026 20:10
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.

4 participants