Repository navigation
feat(mcp): add opt-in stop, resume, and cancel tracking tools - #508
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Shadow risk calibration
Calibration result: agreement. Shadow risk never blocks or enables merge. Keep it in observation mode until roughly 50 pull requests have human-reviewed labels, then calibrate before considering any policy use. |
261f406 to
562e605
Compare
fe9973a to
0e71be1
Compare
0e71be1 to
b0a9a1e
Compare
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
| export function auditOutcome(result: unknown): string { | ||
| const parsed = z | ||
| .object({ status: z.string() }) | ||
| .or(z.object({ error: z.string() })) | ||
| .safeParse(result); | ||
| if (!parsed.success) return 'done'; | ||
| return 'status' in parsed.data ? parsed.data.status : parsed.data.error; |
There was a problem hiding this comment.
Failed batches look successful
auditOutcome returns done for every normal batch result because RecordWriteResult has neither status nor error. A batch where every save fails therefore gets the same audit outcome as a fully successful batch. This makes failed and partial writes harder to spot in logs and analytics.
Add a batch-specific outcome based on updated, failed, and not_attempted.
Knowledge Base Used: MCP observability and quality assurance
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/mcp/src/tools/write-kit.ts
Line: 505-511
Comment:
**Failed batches look successful**
`auditOutcome` returns `done` for every normal batch result because `RecordWriteResult` has neither `status` nor `error`. A batch where every save fails therefore gets the same audit outcome as a fully successful batch. This makes failed and partial writes harder to spot in logs and analytics.
Add a batch-specific outcome based on `updated`, `failed`, and `not_attempted`.
**Knowledge Base Used:** [MCP observability and quality assurance](https://app.greptile.com/-/switch-tenant?tenant=terminal49&next=%2Fcustom-context%2Fknowledge-base%2Fterminal49%2Fapi%2F-%2Fdocs%2Fmcp-observability-and-quality.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Add
stop_shipment_tracking,resume_shipment_tracking, andcancel_tracking_requestbehind the opt-intracking_lifecycletoolset. Stop/cancel preview first and support both user elicitation and confirmation-token flows; resume is additive. Default discovery stays at 30 tools.Third part of #451 / DEV-14372, based on #507. Original author: Akshay Dodeja. Includes behavior, contracts, protocol, stdio-secret, gateway auth, and telemetry-redaction coverage.
Validation: full
npm run agent-verifyplus all 88 gateway tests through the explicit MCP test config. The integration snapshot is generated from the actual tool registry.Known limit preserved from #451: approval consumption is per process. After stop then resume restores the same public shipment state, a different gateway instance can accept the old stop approval within its five-minute expiry. This is why lifecycle tools remain opt-in. No production toolset change is included.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review order: #506 → #507 → #508 → #509. Each diff is against its predecessor; #509 is the combined QA target.
Follow-up review: Resuming tracking explicitly warns about tracking quota and possible pay-as-you-go charges and requests client interaction. It remains additive/non-destructive and does not gain a server confirmation token. Client UI owns approval.
The PR appears safe to merge, with non-blocking feedback on batch audit outcomes.
Fix with agent prompt
Summary
Adds opt-in tracking lifecycle tools and shared approval flows for destructive writes.
Acknowledged limits: alosec explicitly preserves per-process approval consumption, including cross-instance stop/resume replay within five minutes. The supplied follow-up also intentionally leaves resume approval to the client.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD Call[Write tool call] --> Read[Read current records] Read --> Kind{Change needs approval?} Kind -->|No| Write[Apply change] Kind -->|Yes| Approval{Matching approval supplied?} Approval -->|No| Preview[Return preview or ask client] Preview --> Call Approval -->|Yes| Spend[Reserve approval] Spend --> Write Write --> Audit[Record audit outcome] Audit --> Result[Return result]Reviews (1) · Last reviewed commit: "test(mcp): expect client interaction for..." · Reviewed by Greptile