Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 26, 2025

Pipeline Log Enhancements

This PR implements the following features for the pipeline log endpoint:

  • Modify existing GET endpoint to return last 200 lines by default
  • Add optional tail query parameter to customize number of lines returned
  • Add optional download query parameter to download the entire log file
  • Add WebSocket support on the same endpoint path for real-time log tailing
  • WebSocket auth via auth query parameter for browser compatibility

Implementation Details:

HTTP GET Endpoint (/api/v1/admin/pipeline-log/{stream_id}):

  • By default, returns the last 200 lines of the pipeline log
  • Query parameter tail (optional): specify the number of lines to return (e.g., ?tail=500)
  • Query parameter download (optional): set to true to download the entire file with proper content-disposition header (e.g., ?download=true)

WebSocket Endpoint (same path):

  • Accepts WebSocket upgrade requests on the same endpoint
  • Authentication via auth query parameter - required since browsers cannot add Authorization headers to WebSocket connections
  • Usage: wss://api.example.com/api/v1/admin/pipeline-log/{stream_id}?auth=<base64-nip98-token>
  • Sends the last 200 lines of existing log content upon connection
  • Continuously tails new log lines as they are written
  • Properly handles client disconnections and file read errors

Security:

  • All endpoints require admin authentication via NIP-98
  • Stream ID is validated as a UUID to prevent path traversal attacks
  • Admin actions are logged to the audit trail
Original prompt

When returning the pipeline log, return the last 200 lines, use a query param for optional number of tail lines, also add an option to download the entire file because sometimes its very large

Also add code to the same request path which can accept websocket requests that will tail the log file in real-time


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add options for log file retrieval and WebSocket support Add pipeline log tail, download, and WebSocket streaming Nov 26, 2025
Copilot AI requested a review from v0l November 26, 2025 14:30
Copilot finished work on behalf of v0l November 26, 2025 14:30
Copy link
Owner

@v0l v0l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove all the markdown docs. You also need to add the nip98 auth into the query argument because you cannot add auth headers in the browsers

Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot remove all the markdown docs. You also need to add the nip98 auth into the query argument because you cannot add auth headers in the browsers

Done in 5eeab5a. Removed all markdown docs and added WebSocket auth via auth query parameter (e.g., ?auth=<base64-nip98-token>).

Copilot AI requested a review from v0l November 26, 2025 16:31
Copilot finished work on behalf of v0l November 26, 2025 16:31
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