feat: node operator identity tracking#17
Merged
Conversation
Add env-var-driven auth middleware that defaults to none (backward compatible). - AUTH_HTTP_MODE=api-key-env validates X-API-Key header on /api/ routes - AUTH_WS_MODE=api-key-env validates ?token= query param before WS accept - docker-compose.yml includes commented example env vars Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When X-Verbose: true header is sent, response wraps result with pipeline metrics: queue_wait_ms, preprocessing_ms, inference_ms, postprocessing_ms, total_ms, and per-node contribution data. Timestamps propagate through PrivateArgs across all 3 services (core-api, core-background, core-websocket) via Redis. Without the header, responses are unchanged (backward compatible). Tested all 5 endpoints: translation, text-generation, TTS, STT, image-text-to-text. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pass the authenticated operator user_id from WebSocket connection through the entire task pipeline so metrics can attribute inference work to the node operator. Also fix race condition where metrics were stored in Redis after result publication, causing core-api to read stale data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
99d5168 to
6eaea2d
Compare
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
operator={userId}in upstream WS URI so server can attribute inference work to node operatorsOperatorIdtoNodeContributionin TaskMetricsFiles changed
TaskSockets.cs— readoperatorquery param from WS connectionWebSocketNodesQueue.cs— store operator_id alongside nodeId in channelDistributeQueue.cs— store operator_id in taskRequest.PrivateArgsTaskMetrics.cs— add OperatorId to NodeContributionTaskMetricsBuilder.cs— include operator_id in built metricsPostProcessingQueue.cs— fix race condition (metrics before result)Test plan
🤖 Generated with Claude Code