feat(mcp): add show_connection_sync_history interactive UI tool#1042
Conversation
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Adds a new Prefab UI tool that renders a sync history dashboard for an Airbyte Cloud connection. Includes: - Metric cards (total syncs, success rate, records/bytes synced) - Stacked bar chart of success/failure by date - Line charts of records and bytes over time - Detailed job history data table The tool uses the existing Cloud API (get_previous_sync_logs) and renders via the Prefab UI framework for MCP Apps-capable clients. Co-Authored-By: AJ Steers <aj@airbyte.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou can test this version of PyAirbyte using the following: # Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1780453086-show-sync-history' pyairbyte --help
# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1780453086-show-sync-history'PR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesCommunity SupportQuestions? Join the #pyairbyte channel in our Slack workspace. |
Fixes pyrefly type errors: - Tab uses 'title' not 'label' keyword - chart_data typed as list[dict[str, int | str]] to match actual data Co-Authored-By: AJ Steers <aj@airbyte.io>
Code Coverage OverviewLanguages: Python Python / code-coverage/pytest-fastThe overall coverage in the branch is 66%. The coverage in the branch is 65%. Show a code coverage summary of the most impacted files.
Python / code-coverage/pytest-no-credsThe overall coverage in the branch is 66%. The coverage in the branch is 65%. Show a code coverage summary of the most impacted files.
Python / code-coverage/pytestThe overall coverage in the branch remains at 71%, unchanged from the branch. Show a code coverage summary of the most impacted files.
Updated |
Co-Authored-By: AJ Steers <aj@airbyte.io>
- Fix DataTable parameter: data= -> rows= (fixes empty table rendering) - Add model_preview_count/limit/truncated/omitted_count/render_note to agent_summary following the pattern in _registry_ui.py Co-Authored-By: AJ Steers <aj@airbyte.io>
…arts Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Three-tier control for agent text response verbosity: - verbose: full job-level data for detailed follow-up analysis - default: aggregates and key observations only - min: one-liner confirmation that the dashboard rendered All tiers explicitly state the user has already been shown the dashboard, suppressing re-summarization by the agent. Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
…_ui param Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
- Dashboard heading shows connection name - Subtitle links connection name to job timeline URL - Source and destination names linked to their actor URLs - Job History table wrapped in collapsible Accordion (collapsed by default) - _build_agent_text now includes connection_name in context Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
Co-Authored-By: AJ Steers <aj@airbyte.io>
📝 WalkthroughWalkthroughAdds ChangesSync History Dashboard Tool
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
airbyte/mcp/interactive/_sync_history_ui.py (1)
169-181:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix success-rate/chart bucketing for non-final job statuses
show_connection_sync_history()(airbyte/mcp/interactive/_sync_history_ui.py lines ~169-181) treats anything that doesn’t include"succeeded"as"failed". Ifget_previous_sync_logs()can return non-terminal statuses like"running"/"pending"(per theSyncJobResult.statusdocs), would you want to exclude non-final jobs from the success-rate + “failed” series, or bucket them separately (while still treating"cancelled"as failed if that’s intended)? wdyt?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@airbyte/mcp/interactive/_sync_history_ui.py` around lines 169 - 181, The current logic in show_connection_sync_history() treats any status not containing "succeeded" as failed; update the success-rate and chart bucketing to only consider terminal statuses: compute succeeded as statuses equal to "succeeded" and compute total_terminal_jobs (used for success_rate) as count of statuses in the terminal set; treat statuses in {"failed", "cancelled"} as failed; treat non-terminal statuses from get_previous_sync_logs() (e.g., "running", "pending" per SyncJobResult.status) as a separate bucket (e.g., "in_progress") in chart_data rather than counting them as failed; update the succeeded calculation, success_rate denominator (use total_terminal_jobs), and the per-job chart_data entries (succeeded/failed/in_progress) accordingly so charts and rates exclude non-final jobs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@airbyte/mcp/interactive/_sync_history_ui.py`:
- Around line 169-181: The current logic in show_connection_sync_history()
treats any status not containing "succeeded" as failed; update the success-rate
and chart bucketing to only consider terminal statuses: compute succeeded as
statuses equal to "succeeded" and compute total_terminal_jobs (used for
success_rate) as count of statuses in the terminal set; treat statuses in
{"failed", "cancelled"} as failed; treat non-terminal statuses from
get_previous_sync_logs() (e.g., "running", "pending" per SyncJobResult.status)
as a separate bucket (e.g., "in_progress") in chart_data rather than counting
them as failed; update the succeeded calculation, success_rate denominator (use
total_terminal_jobs), and the per-job chart_data entries
(succeeded/failed/in_progress) accordingly so charts and rates exclude non-final
jobs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2c000c20-1c80-49a7-94e8-a232bf3d654c
📒 Files selected for processing (2)
airbyte/mcp/interactive/__init__.pyairbyte/mcp/interactive/_sync_history_ui.py
|
Re: non-terminal job status bucketing (lines 169-181) Valid observation. Assessment: Low-risk for the demo use case — historical sync logs are overwhelmingly terminal. The API returns completed jobs in practice because syncs finish quickly relative to polling frequency. However, I agree it's worth hardening: excluding non-terminal jobs from the success rate denominator and charting them separately (or omitting them) would be more correct. Deferring to Aaron ("AJ") Steers (@aaronsteers) on whether to address now or in a follow-up. |
show_connection_sync_history interactive UI tool
Summary
Adds
show_sync_history— a new interactive MCP tool that renders a Prefab dashboard for an Airbyte Cloud connection's sync history. Built for the Snowflake Summit demo.The tool fetches
connection.get_previous_sync_logs()and renders:(Source → Destination)subtitleAccordion)Key design decisions:
agent_context: Literal["min", "summary", "verbose"](default"min") — three-tier control over how much text context the agent receives. All tiers open with "The user has already been shown..." to suppress re-summarization.suppress_ui: bool = False— when True, skips Prefab rendering and returns text-only. Enables follow-up "give me the data" calls without re-rendering the dashboard.minsuggestssummary/verbose,summarysuggestsverbose,verbosehas no hint.INTERACTIVE_UI_ANNOTATION— only visible to MCP Apps-capable clients.Requested by Aaron ("AJ") Steers (@aaronsteers) for the Snowflake Summit demo.
Link to Devin session: https://app.devin.ai/sessions/33fa308d9fd44d80b1323e85cf60ef6c
Summary by CodeRabbit
Release Notes