← Back to Pull requests

fix(mcp): preserve transport event deadline values and provenance #437

Closed
unknown closed this pull request without merging on Oct 17, 2026 07:02 UTC
View on GitHub
unknown unknown commented on Oct 16, 2026 00:09 UTC
Author

Review follow-up — a3f4c0e


Addressed Maurycy's review: active-only milestones/categories and compact summaries; withdrawn history retained in the full timeline; concrete latest-event/formatter types; opaque reported JSON preserved only at the two event-value paths; final-response tests on both tools; shorter tool description with detailed guidance in the query resource. All five review threads answered and resolved. Remote checks pending; no merge or live customer verification.

Summary


Fixes DEV-13524: preserve public transport-event value, data_source, and invalidated_at instead of discarding them during MCP formatting.

  • Applies to the dedicated timeline endpoint and its container-include fallback, plus the compact snapshot's latest-event summary.

  • Uses the same tool description for registered discovery and the standalone definition, documenting reported deadline values versus event timestamps; the longer playbook lives in the query-guidance resource.

  • Keeps values as supplied (including structured JSON, false, zero, and empty strings); absent values become null. Does not infer or calculate deadlines.
  • For container.detention_lfd_line.changed, the deadline is the API's value, not timestamp. Pickup LFD remains separate and unchanged. This fixes information loss where an event is reported; it does not establish carrier coverage or promise an empty-return deadline for every container. No t49/backend changes, agent prompt changes, auth changes, or SQL-tool dependencies.

    Verification


  • 430 MCP tests pass, including the original 17 executor regressions and 10 registered-response regressions. The full workspace suite also passes: 359 SDK + 31 CLI tests, with one existing SDK skip.

  • Repository npm run check passes (existing lint warnings remain).

  • SDK and MCP builds pass.

  • All six supported MCP protocol smoke versions pass.

  • git diff --check passes.

  • Synthetic fixtures only; no live customer calls or deployment verification.
  • <!-- codesmith:footer -->
    ---
    <a href="https://app.blacksmith.sh/Terminal49/codesmith/API/pr/437?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1794701400&installation_model_id=18852&pr_number=437&ref=codesmith_pr_footer&repository=Terminal49%2FAPI&return_to=https%3A%2F%2Fgithub.com%2FTerminal49%2FAPI%2Fpull%2F437&signature=a7cb3d0f842657dc62255f43ce0a89a52ff2c5a310b61ab643422f3f4d927eaa"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a>
    <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    <!-- codesmith:autofix:disabled -->
    <!-- /codesmith:footer -->

    <!-- greptile_comment -->

    <!-- greptile_summary -->

    <h2><a href="https://app.greptile.com/api/retrigger?id=81905899"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/terminal49/github/terminal49/api--09759b76-76b9-443c-8883-3fa461eae503/-/pull/437"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 4/5</h2>

    <!-- greptile-risk -->

    The PR appears safe to merge, with non-blocking fixes recommended for structured values and the snapshot return type.

    <h2><a href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22terminal49%2Fapi%22%20on%20the%20existing%20branch%20%22fix%2Fmcp-transport-event-values%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22fix%2Fmcp-transport-event-values%22.%0A%0A%23%23%23%20Issue%201%0Apackages%2Fmcp%2Fsrc%2Ftools%2Fget-container-transport-events.ts%3A220%0AStructured%20%60value%60%20objects%20can%20still%20lose%20fields%20in%20actual%20MCP%20responses.%20%60wrapTool%60%20passes%20the%20whole%20result%20through%20%60stripResponseSteering%60%2C%20which%20recursively%20removes%20%60_agent_steering%60%20and%20%60_response_contract%60%2C%20plus%20fields%20such%20as%20%60recommendations%60%20beneath%20any%20%60_metadata%60%20key.%20For%20example%2C%20%60%7B%22_metadata%22%3A%7B%22recommendations%22%3A%5B%22reported%22%5D%7D%7D%60%20becomes%20%60%7B%22_metadata%22%3A%7B%7D%7D%60.%20This%20affects%20both%20the%20timeline%20and%20compact%20snapshot.%0A%0AKeep%20reported%20event%20values%20outside%20this%20cleanup%20and%20add%20a%20test%20through%20the%20registered%20tool%3B%20the%20new%20executor%20tests%20stop%20before%20this%20step.%20Greptile%20automatically%20discovered%20a%20related%20ticket%20stating%20that%20structured%20event%20values%20must%20be%20preserved%2C%20which%20informed%20this%20comment.%0A%0A%23%23%23%20Issue%202%0Apackages%2Fmcp%2Fsrc%2Ftools%2Fget-container.ts%3A388-390%0A%60formatEventsData%60%20now%20returns%20%60value%60%2C%20%60data_source%60%2C%20and%20%60invalidated_at%60%2C%20but%20%60ContainerStatus.events.latest_event%60%20still%20declares%20only%20%60event%60%2C%20%60timestamp%60%2C%20and%20%60location%60.%20Since%20%60executeGetContainer%60%20returns%20%60Promise%3CContainerStatus%3E%60%2C%20TypeScript%20callers%20cannot%20access%20the%20new%20fields%20without%20a%20cast.%0A%0AAdd%20these%20fields%20to%20the%20declared%20return%20type%2C%20using%20%60unknown%60%20for%20arbitrary%20reported%20%60value%60.%0A%0ANote%3A%20If%20this%20suggestion%20doesn't%20match%20your%20team's%20coding%20style%2C%20reply%20to%20this%20and%20let%20me%20know.%20I'll%20remember%20it%20for%20next%20time!%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=terminal49%2Fapi&pr=437&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=7"><img alt="Fix All in Codex" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=7" align="right"></picture></a>Findings</h2>

    1. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Reported fields can disappear <a href="https://github.com/Terminal49/API/pull/437#discussion_r4289562200">▶</a>
    2. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;New fields lack types <a href="https://github.com/Terminal49/API/pull/437#discussion_r4289562209">▶</a>

    <details><summary>Fix with agent prompt</summary>

    `

    ### Issue 1
    packages/mcp/src/tools/get-container-transport-events.ts:220
    Structured `value` objects can still lose fields in actual MCP responses. `wrapTool` passes the whole result through `stripResponseSteering`, which recursively removes `_agent_steering` and `_response_contract`, plus fields such as `recommendations` beneath any `_metadata` key. For example, `{"_metadata":{"recommendations":["reported"]}}` becomes `{"_metadata":{}}`. This affects both the timeline and compact snapshot.
    
    Keep reported event values outside this cleanup and add a test through the registered tool; the new executor tests stop before this step. Greptile automatically discovered a related ticket stating that structured event values must be preserved, which informed this comment.
    
    ### Issue 2
    packages/mcp/src/tools/get-container.ts:388-390
    `formatEventsData` now returns `value`, `data_source`, and `invalidated_at`, but `ContainerStatus.events.latest_event` still declares only `event`, `timestamp`, and `location`. Since `executeGetContainer` returns `Promise<ContainerStatus>`, TypeScript callers cannot access the new fields without a cast.
    
    Add these fields to the declared return type, using `unknown` for arbitrary reported `value`.
    
    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `

    </details>

    <details open><summary><h3>Summary</h3></summary>

    Preserves reported transport-event values, sources, and withdrawal dates in timeline and compact snapshot responses.

  • Transport timelines keep each event’s reported details.

  • Container snapshots keep the latest event’s reported details.

  • </details>

    <!-- greptile_confidence_score:4 -->

    <sub>Reviews (1) · Last reviewed commit: "fix(mcp): preserve transport event value..." · Reviewed by Greptile</sub>

    <!-- /greptile_comment -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: maurycy Review duration: 1852m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #437"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%
    Repository