closedhumanPR #308Communication

[Fellowship Challenge] Communication : Message Integrity via SHA256 Checksums

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

Author

Alok-work23 avatar

@Alok-work23

github profile →
Status
Closed without merging
Opened on
Oct 2
Branch
challenge/Alokwork-23-envelope-integrity

Description

The pitch.

Submission for the Hexaware x Project NANDA Fellowship Technical Challenge

## The Gap
The communication layer had no way to detect when message bodies were 
corrupted during delivery. Transport faults (duplicates, delays, drops) 
can naturally corrupt messages, but the receiver had no verification 
mechanism.

## Layer
communication (envelope.v1 → envelope_integrity.v1)

## What Added
- `EnvelopeIntegrityComms` class with SHA256 body checksums
- Integration point in `engine.deliver()` to verify before delivery
- `integrity_test.yaml` scenario using existing transport faults
- Comprehensive test suite in `test_communication_integrity.py`

## Invariant
Every message delivered to an agent has a valid SHA256 checksum matching 
its body. Messages with mismatched checksums are detected and rejected 
before processing. This invariant holds even when transport faults 
(drop, duplicate, delay) are present.

## Fault Injection
Uses existing transport layer faults (duplicate, delay, drop) that 
naturally create corruption. Tests demonstrate detection via checksum.

## Negative Control
Running same scenario with `--layer communication=envelope.v1` 
(original, no checksums) shows no `integrity_failed` events, proving 
the integrity checking is what enables detection.

## Testing
- Unit: Checksum calculation and verification ✓
- Integration: Engine verify() in deliver() ✓
- Scenario: Full run with transport faults ✓
- Negative control: Same without checksums ✓

All tests pass: `pytest tests/test_communication_integrity.py -v`
Scenario passes: `nandatown run scenarios/integrity_test.yaml`
Bundle verifies: `nandatown verify runs/<id>`

Try it

Open PR on GitHubView diff

Checkout locally

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