Skip to content

Add MySQL persistence, Redis caching and RabbitMQ task workers - #3

Merged
shirohasuki merged 5 commits into
RuyiAI-Stack:mainfrom
ada-cl25:triton-riscv-backend-infrastructure
Oct 10, 2026
Merged

shirohasuki merged 5 commits into
RuyiAI-Stack:mainfrom
ada-cl25:triton-riscv-backend-infrastructure

Conversation

@ada-cl25

@ada-cl25 ada-cl25 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow up on #2 with backend persistence, caching, and opt-in asynchronous execution for dsh-triton-riscv.

  • Replace runtime SQLite stores with workspace-scoped MySQL storage for sessions, runs, evidence memory, and reference catalogs. Add explicit Alembic upgrades and a read-only-source SQLite importer; remove the obsolete SQLite-to-SQLite migrator.
  • Add optional Redis read caching with versioned invalidation, short negative caching, TTL jitter, owner-checked rebuild locks, bounded admission/fallback, and an optional Bloom filter for exact case-ID lookups.
  • Add RabbitMQ workers for Agent turns, approved validation, and audited memory ingestion. Persist jobs and Outbox events in one MySQL transaction; use publisher confirms, manual acknowledgements, idempotent claims, leases, cancellation, and dead-letter handling.
  • Add queued task/status/artifact APIs and preserve workbench request IDs on retries. Keep native approval/source binding checks; interrupted work with uncertain side effects requires reconciliation rather than blind replay.
  • Keep connection credentials outside source/config and out of generated-test environments. Update plugin configuration, installation, migration, and worker commands.

Related Issue

Follow-up to #2. No issue is closed by this PR.

Validation

Re-run on macOS against fresh, disposable MySQL 8.4.11, Redis 8.2.2 with Bloom support, and RabbitMQ 4.3.6 instances. All temporary services shut down cleanly.

Check Result
Python unit/integration suite 562 passed, no skips; includes 27 Redis and 33 queue tests
Plugin JavaScript tests 69 passed
Native Harness / stdio MCP integration 12 passed
Frontend tests 8 passed
Frontend/plugin build Passed
Package audit Passed; 244 packaged files, runtime/private artifacts excluded
git diff --check Passed

Integration cases cover duplicate submissions, transaction rollback, delivery replay after publisher-confirm interruption, consumer disconnection, broker application restart, worker timeout, stale approvals, workspace isolation, and audited validation-to-memory handoff.

From packages/dsh-triton-riscv/, configure disposable services and run:

.venv/bin/python -I -m codex_agent.storage upgrade
.venv/bin/python -I -m unittest discover -s python/codex_agent/tests -v
npm test
npm run test:native-host
npm run test:frontend
npm run build
npm run check:package

Use TRITON_MYSQL_URL, TRITON_TEST_REDIS_URL, and TRITON_TEST_AMQP_URL; restart tests additionally use TRITON_TEST_REDIS_SERVER and TRITON_TEST_RABBITMQ_CTL. Do not point these tests at shared services. Setup and worker commands are in the backend README.

Compatibility and Limitations

  • Breaking storage change: enabled plugin/workbench use now requires MySQL 8.4 and an explicit schema upgrade. Back up and import existing SQLite data before first launch; there is no silent SQLite fallback or automatic data migration.
  • Redis and queue mode are disabled by default. Inline execution remains available. Cache/queue configuration changes require process restart.
  • Queue mode currently requires API and workers on the same host with the same absolute workspace/state paths. It uses durable classic queues and local content-addressed artifacts, not a multi-host HA deployment. Batch/project tools remain synchronous.
  • Delivery is at least once with idempotent processing and explicit reconciliation of uncertain side effects, not exactly-once arbitrary model/SSH execution.
  • This validation did not call a model API or a remote RISC-V host. Model and hardware boundaries used test doubles; real end-to-end asynchronous operator acceptance remains outstanding.
  • No changes to embedding models, retrieval ranking, parent/child expansion, monthly reports, or other plugins are included.

Checklist

  • Changes are scoped to the plugin and its configuration example.
  • Added and updated tests for persistence, cache, queue, API, and host integration.
  • Updated user-facing setup and migration documentation.
  • Ran relevant tests, build, package audit, and whitespace checks.
  • Documented breaking changes, deployment constraints, and unverified boundaries.

@shirohasuki

Copy link
Copy Markdown
Collaborator

Nice progress.

  1. I don't think we should maintain two separate testing frameworks. We could consider having the Python unit tests used by this plugin driven by Vitest, or simply removing them.
  2. Remember to run pre-commit checks—that's why CI failed.

@ada-cl25

ada-cl25 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestions; I have updated the original PR with the following key adjustments:

  1. Unified test entry point
    Python backend tests are now driven by Vitest, which internally executes existing tests using pytest, eliminating the need for maintainers to run a separate Python test suite. Existing test coverage is preserved, and Python test failures will directly cause both Vitest and the CI pipeline to fail. I also included six tests that were previously missed by the old command; a total of 568 Python tests passed locally.
  2. Completed pre-commit checks and CI configuration
    Full pre-commit checks have been run and passed, and the latest CI pre-commit step is also successful. Additionally, I set up the necessary temporary MySQL, Redis, and RabbitMQ instances and database initialization for the CI environment, and fixed issues with workflow variable configurations.

@shirohasuki
shirohasuki merged commit e132bf2 into RuyiAI-Stack:main Oct 10, 2026
2 checks passed
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.

2 participants