Skip to content

Conversation

@ultmaster
Copy link
Contributor

Summary

  • stream wait_for_rollouts responses over SSE so the client can wait for longer timeouts
  • add client-side SSE handling with 60s retry chunks and document the new behavior
  • extend store client tests to cover large timeout support

Testing

  • pytest tests/store/test_client_server.py -k wait_for_rollouts (fails: ModuleNotFoundError: No module named 'opentelemetry')

https://chatgpt.com/codex/tasks/task_e_68fa5a8534b4832eb5385a9bbfe33194

data = [rollout.model_dump(mode="json") for rollout in rollouts]
yield f"data: {json.dumps(data)}\n\n"

return StreamingResponse(event_stream(), media_type="text/event-stream")

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI 4 days ago

To address the information exposure problem, we should prevent returning detailed exception information to external users. Instead, only a generic error message should be sent, such as "An internal error has occurred". The detailed exception information (including potentially the stack trace) should be logged server-side using the logging module or similar tooling.

Steps:

  • In the event_stream() function, replace the use of str(exc) in the yielded SSE data with a generic error string.
  • Log the detailed exception and stack trace using logger.error(traceback.format_exc()) or equivalent.
  • Do not change any application logic except for the error reporting in the SSE stream; maintain existing behavior and error-handling structure.

The required edits are confined to the relevant block in the shown code within agentlightning/store/client_server.py.


Suggested changeset 1
agentlightning/store/client_server.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/agentlightning/store/client_server.py b/agentlightning/store/client_server.py
--- a/agentlightning/store/client_server.py
+++ b/agentlightning/store/client_server.py
@@ -363,7 +363,8 @@
                         timeout=payload.timeout,
                     )
                 except Exception as exc:  # pragma: no cover - surfaced via SSE
-                    error_payload = {"error": str(exc)}
+                    logger.error("Exception in wait_for_rollouts SSE", exc_info=True)
+                    error_payload = {"error": "An internal error has occurred."}
                     yield "event: error\n"
                     yield f"data: {json.dumps(error_payload)}\n\n"
                     return
EOF
@@ -363,7 +363,8 @@
timeout=payload.timeout,
)
except Exception as exc: # pragma: no cover - surfaced via SSE
error_payload = {"error": str(exc)}
logger.error("Exception in wait_for_rollouts SSE", exc_info=True)
error_payload = {"error": "An internal error has occurred."}
yield "event: error\n"
yield f"data: {json.dumps(error_payload)}\n\n"
return
Copilot is powered by AI and may make mistakes. Always verify output.
@ultmaster
Copy link
Contributor Author

/ci

@github-actions github-actions bot closed this Oct 25, 2025
@github-actions github-actions bot reopened this Oct 25, 2025
@github-actions
Copy link

✅ CI retrigger requested by @ultmaster. Closed & reopened the PR to fire pull_request: reopened.

@ultmaster ultmaster closed this Oct 25, 2025
@ultmaster ultmaster reopened this Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant