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 #300Memory

[Fellowship Challenge] Track: quote-amnesia-restart, a seller that forgets work it already answered

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

Author

mohansree14 avatar

@mohansree14

github profile →
Status
Merged
Merged on
Oct 12
Branch
challenge/mohansree14-seller-amnesia

Description

The pitch.

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

Gap: every Track crash fault keeps the seller's journal. Nothing tested a seller that comes back with no memory of work it already answered (a restart onto a fresh disk, for example).

Layer / track: Track, new profile `quote-amnesia-restart`.

Fault (`crash_amnesia`): on the first claim the seller computes the quote, sends the response, then its journal is wiped and it exits before acking. After the restart and redelivery it does the work again because it has no record of it.

Invariant: the buyer gets exactly one quote response. The response id is derived from the request id (q-1 -> r-1), so the second answer is an identical resend and the coordinator returns the original acceptance (`replay_returned`) instead of accepting a new message.

Negative control: `quote-amnesia-fresh-ids`, same fault but the seller mints a random response id per application. It fails at `response`: "2 distinct quote responses were accepted, expected one".

Changes
- `participants/seller.py`: the fault, and the fresh-id switch for the control
- `evaluator.py`: new `amnesia_survived` stage, judged from town events (crash, restart, attempt 2 claim, replay_returned) rather than the seller's own `applied` flag
- `runner.py`: fix found while building this. The runner only restarted a crashed seller while the buyer was still running; here the buyer finishes first, so the seller was never restarted and the run ended INCOMPLETE
- profiles, Fault literal + regenerated schema, report stage text, README table
- `tests/test_seller_amnesia.py`: fails on main, passes here

Bundles (both pass `nandatown verify`)
- quote-amnesia-restart: PASSED, `sha256:d6742bbd24573b52eb97384d2c48cdf3c77583d137f3da7762155fb1b9309b8a`
- quote-amnesia-fresh-ids: FAILED as intended, `sha256:6fb8a51fd4130925691701432e2109065cc879a033f2c37c7b20bcdb7998e577`

```
nandatown run quote-amnesia-restart
nandatown run quote-amnesia-fresh-ids
nandatown verify runs/<id>
```

What this does not show: the seller really does apply the work twice. The `processed` stage still reports "exactly once" because it reads the seller's own ack; `amnesia_survived` only shows the visible effect (the response) happens once. Fine for a quote, not for a side effect like a charge. One crash point, stock seller only.

Testing: ran the full suite on Windows against main and this branch. Same set of pre-existing environment failures on both (url_credentials / receipt / hard-link tests); the two new tests pass.

Try it

Open PR on GitHubView diff

Checkout locally

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