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 →
mergedhumanPR #292Auth

[Fellowship Challenge] Path profile for a reused order id with changed terms

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

Author

Saidheerajgollu avatar

@Saidheerajgollu

github profile →
Status
Merged
Merged on
Oct 12
Branch
challenge/saidheerajgollu-order-conflict

Description

The pitch.

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

Track: Path. This adds one Path profile, `a2a-order-conflict@0.1`.

## Gap

Path's retry check sends the same order twice with the same content. It never checks what an agent does when a retry keeps the order id but changes the terms. The Track coordinator already rejects this (409 `identity_reuse`), but Path has no test for it.

Town's own reference seller has this bug on main:

```
order-abc, quantity 2 -> completed, total_cents 3990
order-abc, quantity 5 -> completed, total_cents 9975
```

## Layer

None of the twelve Lab layers. This is a new Path profile, which the challenge lists as a valid place for a contribution. Path talks to the agent through its own A2A driver and doesn't use the Lab layers. There are no Lab or Track changes.

## Fault and invariant

Fault: attempt 2 resends the same `request_id` with `quantity: 5`.

Invariant: an order id keeps its first terms. The new `conflicting_retry` stage passes only if the agent's task ends `rejected`.

- Answering the retry fails, even if the agent returns the first quote again, because a completed task tells the buyer the new terms were accepted.
- A `failed` task or an RPC error counts as not enough evidence, because Town can't tell a refusal from a crash.
- Attempt 1 is judged the same way as in `a2a-capability-fulfillment@0.3`.

## Bundle fingerprint

`nandatown verify` passes on both bundles.

- Passing run, 6/6 stages: `sha256:d8709653034c3f438d3fb424bfbedb9af5554a3838179f0a6c637ce161d77d60`
- Negative control: `sha256:8925f35fcc1159510093c535d203597c0e828b17d9a937499de6c475cc32802b`

## Negative control

With `nandatown a2a serve --defect accept_conflicting_retry`, the run fails at `conflicting_retry`, and all earlier stages pass:

```
conflicting_retry  Failed  ... total_cents 3990, then 9975
```

## Changes

- `path_profiles.py`: the new profile. `controlled_condition` also accepts `conflicting_retry`. There are no new fields, so existing profile fingerprints don't change.
- `path_runner.py`: sends the changed retry and adds the `conflicting_retry` stage.
- `a2a_adapter.py`: the reference seller remembers the terms for each `request_id` and rejects a changed retry. Identical retries work as before.
- `cli.py`: new `--defect accept_conflicting_retry`, which brings back the old behavior.
- `report.py`, `bundle.py`, `README.md`: the stage label, the evaluator version `path-order-conflict-0.1` and docs.

## How to run

```
nandatown a2a serve
nandatown test-agent --url http://127.0.0.1:8940 --path-profile a2a-order-conflict@0.1
```

## Tests

`tests/test_path_order_conflict.py` has 20 tests. On main, 16 of them fail. On this branch, all 20 pass. The full suite passes: 1776 tests.

## Notes

- `nandatown new` has no template for Path profiles, so I followed the existing entries in `path_profiles.py`.
- This checks one changed field on one synthetic order in one run. The seller keeps order terms in memory, so a restart forgets them, and Path can't restart the agent to test that.

Try it

Open PR on GitHubView diff

Checkout locally

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