Uh oh!
There was an error while loading. Please reload this page.
fix(actionagent): resolve every engine constant under a host's inflections - #361
Merged
Conversation
…tions 1.2.1 scoped the autoloader override to the basename "api", which fixed the controllers under app/controllers/action_agent/api and nothing else. Seven files in this engine camelize differently once a host registers an acronym, and each raises Zeitwerk::NameError on first reference: mcp_catalog.rb MCPCatalog vs McpCatalog mcp_recording_middleware.rb MCPRecording… vs McpRecording… playwright_mcp_client.rb PlaywrightMCP… vs PlaywrightMcp… api_key.rb APIKey vs ApiKey api_keys_controller.rb APIKeysController vs ApiKeysController mcp_controller.rb MCPController vs McpController mcp_servers_controller.rb MCPServersCont… vs McpServersCont… The dashboard's Tools view was unreachable in such a host — the request 500s with "uninitialized constant ActionAgent::ToolDiscovery::McpCatalog" — as were the MCP endpoints and anything touching an API key. Rather than enumerate names, every path under this engine now camelizes with Zeitwerk's default inflector, ignoring whatever acronyms the host registered. It stays scoped by path because the loader is shared with the host, whose own constants must keep their spelling. INFLECTION_OVERRIDES carries any basename this engine wants spelled differently; it is empty today, which is the point: the engine names its files for the constants default camelization produces. The router half generalizes too. It does not consult the autoloader's inflector, so an acronym host asks for ActionAgent::API::MCPServersController. An all-caps run in a missing constant is now retried in the relaxed spelling (API -> Api, MCPServersController -> McpServersController) rather than each pair being aliased by hand.
TonsOfFun
marked this pull request as ready for review
August 14, 2026 23:47
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1.2.1 fixed the
apidirectory and nothing else. Seven files in this engine camelize differently once the host registers an acronym, and each raisesZeitwerk::NameErroron first reference:mcp_catalog.rbMCPCatalogMcpCatalogmcp_recording_middleware.rbMCPRecordingMiddlewareMcpRecordingMiddlewareplaywright_mcp_client.rbPlaywrightMCPClientPlaywrightMcpClientapi_key.rbAPIKeyApiKeyapi_keys_controller.rbAPIKeysControllerApiKeysControllermcp_controller.rbMCPControllerMcpControllermcp_servers_controller.rbMCPServersControllerMcpServersControllerFound by clicking through the mounted dashboard in a Rails 8.1 app that declares both
inflect.acronym "API"andinflect.acronym "MCP". The Tools view is completely unreachable there — it 500s withuninitialized constant ActionAgent::ToolDiscovery::McpCatalog— as are the MCP endpoints and anything touching an API key. Those are not exotic acronyms to register; Rails documents the pattern, and any host with its own MCP integration will have hit this.The fix
Rather than enumerate names, every path under this engine now camelizes with Zeitwerk's default inflector, ignoring whatever acronyms the host registered. It stays scoped by path, because the loader is shared with the host, whose own constants must keep their spelling.
INFLECTION_OVERRIDEScarries any basename this engine wants spelled differently. It is empty today, which is the point: the engine names its files for the constants default camelization produces, and a file that wants a genuine acronym adds itself there rather than depending on the host.The router half generalizes the same way. Routing does not consult the autoloader's inflector, so an acronym host asks for
ActionAgent::API::MCPServersController. An all-caps run in a missing constant is now retried in the relaxed spelling (API→Api,MCPServersController→McpServersController) instead of aliasing each pair by hand.Verification
Installed into that host and clicked every dashboard view. Before: Tools 500s. After: Tools renders (2 tools detected, 6 calls, 0 errors, attributed to the right telemetry spans), and MCP Services lists all 10 catalog entries — the view that reads
McpCatalogdirectly. Traces, Interactions and Metrics render throughout.Screenshots of the before/after are in the linked Sparkle PR.
Releases as 1.2.2
1.2.1 is already on RubyGems, so this ships as 1.2.2 — a host pinning
>= 1.2.1picks the fix up on its nextbundle update. Until it is released, the Tools and MCP Services views 500 on any host that registers these acronyms; Traces, Interactions and Metrics are unaffected.Note for whoever cuts the release:
activeagentstays at 1.2.0 here, and the publish step added in 1.2.1 skips a version already on RubyGems, so av1.2.2tag publishesactionagentalone rather than failing on the duplicate.