observability Plugin
Admin MySQL
The `admin_mysql` plugin (`plugins/admin_mysql/`) gives operators a live, read-mostly view of the MySQL server backing a Syrus instance: process list, connection pressure, buffer/InnoDB variables, slow-query-log configuration, Performance Schema statement digests, and a targeted `KILL QUERY` action. It is a self-contained Rails engine plugin, installed but disabled by default (`default_enabled: false`, `disableable: true`, category `observability`). Unlike `mysql_db_browser`, this plugin only ever inspects Syrus's *own* database connection (`ActiveRecord::Base.connection`) — it has no concept of external connections.
Admin MySQL
The admin_mysql plugin (plugins/admin_mysql/) gives operators a live, read-mostly view of the MySQL server backing a Syrus instance: process list, connection pressure, buffer/InnoDB variables, slow-query-log configuration, Performance Schema statement digests, and a targeted KILL QUERY action. It is a self-contained Rails engine plugin, installed but disabled by default (default_enabled: false, disableable: true, category observability). Unlike mysql_db_browser, this plugin only ever inspects Syrus's *own* database connection (ActiveRecord::Base.connection) — it has no concept of external connections.
Configuration
No credentials or config schema. The plugin works against whatever ActiveRecord::Base.connection Syrus is already using; AdminMysql.mysql? (Inspector.mysql?) checks that the adapter name includes "mysql" and every entry point (Inspector#snapshot, #kill_query, both admin pages, both MCP tool sets) raises/hides itself when the check fails. On a SQLite-backed dev/test instance the plugin has nothing to show, so AdminPages .admin_pages returns [] and both MCP tool sets report themselves unavailable — the plugin is a no-op rather than an error.
suggests_enabling nudges an admin to turn the plugin on when Syrus::PluginSignals#database_adapters (stamped by Steps::Prepare/ RepoPluginDetector) reports a MySQL adapter in use.
Admin page
Admin → MySQL (/admin/mysql, group observability) renders AdminMysql::Inspector#snapshot, fetched from GET /api/v1/app/admin/mysql (mirrored at GET /api/v1/admin/mysql for the external Bearer-token admin API):
connection_summary— threads connected/running, max used connections vs.
max_connections, sleeping-connection count, aborted connects, and wait_timeout/interactive_timeout.
variables/status— a fixed allowlist ofSHOW VARIABLES/`SHOW GLOBAL
STATUS` values (version, InnoDB buffer pool/log/redo settings, flush/sync settings, slow-query-log settings, and InnoDB row-lock/fsync counters).
process_list—SHOW FULL PROCESSLIST, sorted running-first then by
longest-running, capped at limit (default 50, max 200), with Info truncated to 1000 bytes.
ddl_progress— progress of running online DDL such asCREATE INDEXor
ALTER TABLE (a deploy migration on a large table, for example): per statement, the InnoDB alter stage, work completed and estimated, percent complete, elapsed seconds, and an estimated time remaining. It reads performance_schema.events_stages_current, whose InnoDB alter stage instruments are off by default; when they are, the section reports available: false with the setup_sql to enable them (and the server options that keep them enabled across MySQL restarts) instead of an empty list that would look like "no DDL running".
storage— the largest tables in the Syrus database (up to 50): estimated
rows, data, index and free bytes, from information_schema.TABLES. Row counts are InnoDB estimates and statistics can lag by information_schema_stats_expiry, so treat them as approximate. Use it to judge how long a migration on a table will take before deploying it.
statement_digests— top statements from
performance_schema.events_statements_summary_by_digest, scoped to the current database, ordered by total wait time, with average and maximum latency, execution count, rows sent and examined, and normalized sample SQL.
slow_sql_events— recentsyrus.performance.slow_sqlobservations with
duration, normalized SQL, fingerprint, and available calling-code context.
Every diagnostic SELECT carries a 1000ms MAX_EXECUTION_TIME hint so a stuck query in the inspected server can't hang the admin page itself. A missing GRANT (e.g. no SELECT on performance_schema.events_statements_summary_by_digest) degrades that one section to { available: false, error: { class, message, hint, setup_sql } } with the exact GRANT/SET GLOBAL statement needed, rather than failing the whole snapshot.
POST /api/v1/app/admin/mysql/kill_query (mirrored at /api/v1/admin/mysql/kill_query) runs KILL QUERY <thread_id> against a decimal PROCESSLIST.Id — it stops the query, not the connection. String ids are interpreted strictly as base 10; prefixed hexadecimal and other non-digit forms are rejected.
MCP tools
Agent calls carry scoped permission descriptors in addition to the existing surface gates. Live status is the mysql.admin.observe capability and remains available only through the admin, MySQL-adapter, repository, and role checks. Query interruption is the separate mysql.admin.kill_query capability, is critical-risk, and is limited to exact-invocation authority in addition to its confirmed pending action and statement revalidation.
Admin MySQL exposes different MCP tools on workflow and chat surfaces:
admin_mysql_status(limit?)— same payload as the admin page's snapshot.
Available to admin-owned Syrus workflow implement runs and admin chats.
admin_mysql_kill_query(thread_id)— same as the admin page's kill action.
Available only from admin chat contexts. It records the requesting operator, thread id, and current statement in a pending action; the statement is checked again before the query is interrupted after operator confirmation. Direct run/workflow calls are rejected before Inspector#kill_query runs.
Availability differs by surface:
- Workflow tools —
AdminMysql::WorkflowToolSet.available_for?requires
AdminMysql.mysql? and McpToolPolicy.syrus_repository? (the Job's repository is tkadauke/syrus or a registered fork), and available_for_context? further requires the WORKFLOW_IMPLEMENT agent role and an admin Job owner. StatusTool repeats the admin check before reading the database. In other words, only admin-owned implement runs working on Syrus itself get read-only MySQL status diagnostics — not non-admin runs, arbitrary customer-repository workflows, or any workflow attempting query interruption. Process-list info and slow-log sql_text values have string, hexadecimal, and numeric SQL literals redacted before they are returned.
- Chat tools —
AdminMysql::ChatToolSet.available_for?requires the
chat's user to be an admin and AdminMysql.mysql?, with no repository restriction, so any admin's chat session can inspect/kill queries once the plugin is enabled on a MySQL instance.
Operational notes
The plugin reads live database state and can terminate queries, so treat it as an operator/admin-only surface: keep it disabled on SQLite installations (there is nothing for it to show) and enable it deliberately on MySQL-backed production or staging instances that need in-app diagnosis instead of shelling into the database pod.