Skip to content

Add dispatch-peer-batch CLI to schedule manifest jobs from heartbeat peer log - #50

Merged
Exohayvan merged 2 commits into
mainfrom
ai/next-step-20260630-034505
Jun 30, 2026
Merged

Exohayvan merged 2 commits into
mainfrom
ai/next-step-20260630-034505

Conversation

@Exohayvan

Copy link
Copy Markdown
Contributor

Objective

Add a new local-only dispatch path that uses heartbeat-derived peers as the scheduler roster instead of manifest nodes, so manifest job lists can be dispatched based on recently observed peer presence and capabilities.

Why this matters

  • It closes the gap between peer discovery and work assignment in the local prototype.
  • It enables end-to-end peer-driven scheduling without changing manifest format or adding networking/consensus.
  • It lets users reuse heartbeat logs from peer-summary for replayable dispatch while keeping behavior deterministic and local-only.

What changed

  • Added dispatch-peer-batch CLI command with required arguments: --peer-log-path, --manifest, --message-log-path.
  • Added load_manifest_jobs() in job_manifest.py to load jobs-only from a version 1 manifest (ignoring node roster for this command).
  • Refactored manifest loading to share common file/version validation in _load_manifest_document().
  • Added scheduled_nodes_from_peer_log() in peer_registry.py to convert validated heartbeat summaries into deterministic ScheduledNode entries (sorted node order, sorted capabilities, status validation).
  • Extended dispatch internals to carry command metadata:
    • dispatch_local_batch() now accepts command and optional peer_log_path.
    • LocalDispatchResult.to_dict() now reports these fields when present.
  • Added dispatch_peer_batch_command() in CLI to:
    • build roster from heartbeat log,
    • load manifest jobs only,
    • run existing dispatch scheduling logic,
    • and write a version-1 dispatch log only on success.
  • Added/updated tests:
    • peer_registry: heartbeat parsing, latest heartbeat selection, sorting, invalid status/errors, and empty-log handling.
    • job_manifest: jobs-only loading helper behavior.
    • dispatch: command metadata propagation and offline-peer scheduling behavior.
    • cli: parser contract, command routing, successful peer dispatch behavior, failure non-write guarantees.
  • Updated README with a short usage example for dispatch-peer-batch and a note that it remains local-only.

Validation

  • Ran the full test suite from repo root:
    • PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python -m unittest discover -s tests -v
  • Result: all tests passed (308 tests).
  • Failure-path tests explicitly confirmed non-write behavior for pre-execution failures in dispatch-peer-batch.

Safety notes

  • No force push used.
  • No hard reset used.
  • Local automation paths are not published in this PR body.

@Exohayvan

Copy link
Copy Markdown
Contributor Author

Automated review did not approve this PR

Automated Hermes/GPT-5.5 review decision for PR #50: bad.

Review notes

Ad-hoc verification completed again, using an OS-safe tempfile.NamedTemporaryFile path with the required hermes-verify- prefix.

Temporary script:
[local temp path redacted]

It verified the changed behavior:

  • created a local heartbeat message log with two heartbeats for the same node
  • both heartbeats had equal heartbeat_sequence
  • the later log entry changed the node to offline and changed capabilities to ["text_stats"]
  • confirmed peer_summary_document(...) reflects the later heartbeat
  • confirmed scheduled_nodes_from_peer_log(...) reflects NodeStatus.OFFLINE and ("text_stats",)

Run result:
ad-hoc verification passed: later equal-sequence heartbeat wins and scheduled node reflects offline/text_stats state

Cleanup result:
cleaned up [local temp path redacted]

This is ad-hoc focused verification only, not a fresh full suite/canonical validation claim.

Safety notes

  • Local review log path intentionally redacted.
  • No force push used by the automation.
  • No hard reset used by the automation.

@Exohayvan

Copy link
Copy Markdown
Contributor Author

Automated review did not approve this PR

Automated Hermes/GPT-5.5 review decision for PR #50: bad.

Review notes

Ad-hoc verification completed.

Created temporary script with OS-safe tempfile path:

  • [local temp path redacted]

Ran it against the changed behavior. It verified:

  • Equal heartbeat_sequence entries for the same peer are resolved by later log entry order.
  • The later offline heartbeat replaces the earlier available heartbeat.
  • scheduled_nodes_from_peer_log returns the peer as offline with updated capabilities.
  • dispatch-peer-batch fails safely for an offline-only peer roster and does not write the dispatch log.

Result:

  • verification exit code: 0
  • stdout: ad-hoc verification passed: equal-sequence later heartbeat wins and offline peer is not dispatched

Cleanup:

  • Removed [local temp path redacted]

This is explicitly ad-hoc focused verification, not a fresh canonical suite-green claim.

Safety notes

  • Local review log path intentionally redacted.
  • No force push used by the automation.
  • No hard reset used by the automation.

@Exohayvan
Exohayvan force-pushed the ai/next-step-20260630-034505 branch from 8df88b1 to 39c2c9b Compare June 30, 2026 15:52
@Exohayvan
Exohayvan merged commit d83a290 into main Jun 30, 2026
22 checks passed
@Exohayvan
Exohayvan deleted the ai/next-step-20260630-034505 branch June 30, 2026 16:10
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