Skip to content

feat(ipc): define cancellation lifecycle contract#904

Closed
luoye520ww wants to merge 1 commit into
KunAgent:developfrom
luoye520ww:codex/ipc-cancellation-contract
Closed

feat(ipc): define cancellation lifecycle contract#904
luoye520ww wants to merge 1 commit into
KunAgent:developfrom
luoye520ww:codex/ipc-cancellation-contract

Conversation

@luoye520ww

Copy link
Copy Markdown
Collaborator

Problem

Long-running IPC operations need a common cancellation lifecycle. Existing operations expose unrelated cancellation shapes, so a caller cannot reliably distinguish an observed cancel request from work that has actually stopped.

Root cause

There was no shared contract linking an operation request, its cancellation message, the cancellation acknowledgement, and the final terminal result.

Scope

This PR defines and tests the shared IPC cancellation contract only. It does not change any IPC handler or business operation.

Changes

  • Add bounded requestId and operation request schemas.
  • Add explicit cancellation request and acknowledgement statuses (accepted, already-terminal, unknown-request).
  • Add a terminal response schema with completed, failed, and cancelled outcomes.
  • Reject unbounded or unknown fields so stacks, parameters, and secrets cannot enter the contract accidentally.

Safety

  • Cancellation acknowledgement means the request was observed; it does not claim that the operation has stopped.
  • Consumers can treat terminal events idempotently by requestId.
  • The contract carries no command, path, token, raw error stack, or operation payload.

Typecheck

npm.cmd run typecheck

Passed.

Tests

npm.cmd exec vitest run src/shared/ipc-cancellation.test.ts
npm.cmd run lint
npm.cmd run build
git diff --check

Passed: 4 contract tests; root lint and build passed; diff check passed.

Review performed

  • Functional correctness
  • Lifecycle and idempotency semantics
  • Data and secret safety
  • Cross-platform contract compatibility
  • Test quality and PR scope

Non-goals

  • IPC handler changes
  • Runtime cancellation implementation
  • Project transfer, diagnostics, provider probe, index, or extension-install integration

Follow-ups

Each long-running operation should adopt this contract in a separate, focused PR.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated IPC/SSE reliability PR #945, which passed Typecheck, Linux, macOS, and Windows packaged checks. Closing this duplicate to keep the review surface focused.

@luoye520ww luoye520ww closed this Jul 14, 2026
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.

1 participant