Skip to content

fix: background-job response hygiene — no traceback leaks, honest ETA (#538) - #550

Closed
Shashankss1205 wants to merge 1 commit into
mainfrom
fix/538-job-response-quality
Closed

Shashankss1205 wants to merge 1 commit into
mainfrom
fix/538-job-response-quality

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Fixes #538. Background-job response hygiene:

NB-04 — errors[] leaked full server tracebacks

The async failure paths stored errors=[str(e), traceback.format_exc()], exposing the full traceback with absolute filesystem paths to the MCP client. Now they store only the clean message and log the traceback server-side. The same "traceback" key was also stripped from the sync fit/predict/call_method error responses (same leak), and the async "Unknown metric" message now carries the same query_registry(task='metric') hint as the sync path.

Verified end-to-end: an async fit with a bad handle returns errors: ["Handle not found: est_bogus_zzz"] — no Traceback, no .py paths.

NB-05 — misleading ETA and stale terminal step

  • estimated_time_remaining extrapolated from 2–3 coarse steps and was wildly wrong (reported ~15s remaining when a job finished in under a second). It now returns None unless the job reports ≥10 steps, so coarse jobs stop faking an estimate.
  • A cancelled job now sets current_step = "Cancelled" instead of freezing on the last in-flight label (e.g. "Running cross-validation...").

Testing

  • New tests/test_job_response_quality.py (4 tests): no ETA for coarse jobs, ETA present for fine-grained jobs, cancel sets a terminal step + no ETA, failed-job errors carry no traceback/paths.
  • Full suite: 289 passed.

🤖 Generated with Claude Code

…#538)

- NB-04: async job errors[] stored [str(e), traceback.format_exc()], leaking the
  full server traceback with absolute filesystem paths to the client. Store only
  the clean message and log the traceback server-side. Also stripped the
  "traceback" key from sync fit/predict/call_method error responses (same leak),
  and aligned the async "Unknown metric" message with the sync hint.
- NB-05: estimated_time_remaining extrapolated from 2-3 coarse steps and was
  wildly wrong (15s remaining when a job finished in <1s). Return None unless the
  job reports >= 10 steps. A cancelled job now sets current_step="Cancelled"
  instead of freezing on the last in-flight label.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Shashankss1205

Copy link
Copy Markdown
Collaborator Author

Closing: this PR's content is already on main as commit f8f377c (identical patch-id; it was landed directly rather than through the PR merge button). Nothing further to merge.

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.

[BUG] Background job responses leak tracebacks and show misleading ETA / stale current_step

1 participant