Add agentic CLI telemetry#882
Merged
Merged
Conversation
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 free
to 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.
Summary
mono:sessionId, bounded rawcaller,agentSessionId,installRequestId, Railway resource IDs, and coarseerrorClass.setupAgentEventTracklifecycle events fromrailway setup agentwith start/finish, success/failure, configured clients, and the same shared telemetry context.user.idafter login for future skills attribution and stampRAILWAY_INSTALL_REQUEST_IDfrominstall.sh --agentsso install setup can be correlated to first CLI telemetry.Why
This is the CLI producer-side follow-up to the merged agentic telemetry contract in
mono(#28652). It starts turning CLI usage into analyzable agentic telemetry so we can answer questions like “which agents are using Railway?”, “which setup flows complete?”, and “which project/environment/service did an agent-driven CLI call touch?”Caller Attribution
calleris populated on all CLI telemetry events. Resolution order is:RAILWAY_CALLERwhen set by a harness or skill.opencode,claude,cursor,codex, andwindsurf.ci,agent_subprocess, ortty.This means attribution is reliable when
RAILWAY_CALLERis set and best-effort otherwise. Strong cross-surface joins still require harnesses/skills to setRAILWAY_AGENT_SESSION; when absent, agent-like CLI invocations fall back to a per-process session ID.Safety / Compatibility
DO_NOT_TRACK,RAILWAY_NO_TELEMETRY, andrailway telemetry disable.setupAgentEventTrackfailures are ignored.user.idafter login is best-effort; login still succeeds if writing the ID fails.Notes
install.sh --agentsnow generatesRAILWAY_INSTALL_REQUEST_IDlocally and exports it before invokingrailway setup agent./agents.mdfetches to install execution; that remains a future frontend/server-side attribution follow-up.CliEventTrackGraphQL type is intentionally left in place for compatibility, but the new telemetry calls are sent as raw GraphQL JSON so the PR is not blocked on regenerated CLI GraphQL bindings for nullable telemetry fields.Validation
bash -n install.shgit diff --checknix shell nixpkgs#rustfmt -c rustfmt --edition 2024 src/telemetry.rs src/commands/setup.rs src/commands/login.rs src/config.rs src/consts.rs src/gql/mutations/mod.rsnix shell nixpkgs#cargo nixpkgs#rustc -c cargo checknix shell nixpkgs#cargo nixpkgs#rustc -c cargo test --no-run