Vote for your favorite SkillMD. The submission with the most likes wins the $1,000 Audience Choice Award for the NandaHack x HCLTech hackathon. Voting is open through October 25.Vote now →
in reviewhumanPR #307Coordination

[Fellowship Challenge] Add terminal Contract-Net task cancellation

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

Author

Status
In review
Opened on
Oct 2
Branch
challenge/cipher-v-cancellable-contractnet

Description

The pitch.

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

## Gap

The stock `contractnet.v1` coordination plugin can announce, bid on, and award a task, but an issuer cannot cancel an open task.

That leaves no protocol rule ensuring that a bid already in transit becomes non-actionable if the issuer cancels before it arrives.

## Contribution

**Track:** Lab  
**Layer:** coordination  
**Plugin:** `contractnet.cancel.v1`

This adds an issuer-authorized terminal cancellation transition:

```text
OPEN -> CANCELLED
```

Once cancelled:

- later bids are rejected
- later award attempts are rejected
- the cancelled task cannot be revived

Stock `contractnet.v1` is unchanged.

This is distinct from PR #296 (`contractnet.once.v1`), which protects one-shot finalization under duplicate triggers. This contribution adds issuer-controlled cancellation and specifically handles an in-flight bid arriving after cancellation.

## Fault

The bundled `cancellable_contractnet` scenario uses Town's native transport delay fault:

```yaml
faults:
  - action: delay
    kind: task_bid
    nth: 1
    delay: 1.0
```

The bidder sends while the task is open. Town delays that bid. The issuer cancels the task before the delayed bid arrives.

## Invariant

Once an issuer successfully cancels an open task, that task cannot accept a subsequently delivered bid and cannot later be awarded.

## Protected run

The delayed bid arrives after cancellation and is rejected.

- `fault_exercised` — passed
- `task_cancelled` — passed
- `late_bid_rejected` — passed
- `cancelled_task_not_awarded` — passed

Bundle fingerprint:

`sha256:15e6d478e3f46fb5d3c1807871ee3d12d2c53784b811614315c969564318e8d8`

`nandatown verify` passes.

## Negative control

The same scenario, seed, timings, and delayed-bid fault are run with:

`coordination=contractnet.cancel.nonterminal.v1`

This intentionally records cancellation without making it terminal.

The delayed bid is then accepted and the supposedly cancelled task is awarded.

- `fault_exercised` — passed
- `task_cancelled` — passed
- `late_bid_rejected` — failed
- `cancelled_task_not_awarded` — failed

Bundle fingerprint:

`sha256:de8b74a8be6a2be967d07a68f607d1176b4443737ce8fbea7232f0406a7c2d0b`

The scenario fails for the predicted semantic reason, while `nandatown verify` still passes.

## Tests

Focused regression suite: `63 passed`.

A pristine `origin/main` full-suite baseline and the challenge branch were compared in the same Windows environment. No additional deterministic test failure attributable to this change was found.

## Evidence limitations

Cancellation is a coordination-layer state transition, not transport message deletion or distributed cancellation consensus.

The evidence proves this bounded Town scenario and invariant; it is not a claim of general agent reliability or universal protocol conformance.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/307/head:pr-307
git checkout pr-307