Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

Short Description:

Implements peer-to-peer workflow execution across IPFS network, bypassing GitHub API entirely. Workflows tagged p2p-workflow or offline-workflow are distributed using merkle clock consensus, hamming distance assignment, and fibonacci heap priority scheduling.

What Has Changed:

  • Merkle Clock (merkle_clock.py): Cryptographically verifiable event log with SHA-256 chain verification for distributed consensus
  • Fibonacci Heap (fibonacci_heap.py): O(1) insert/find-min, O(log n) extract-min priority queue for resource-constrained scheduling
  • P2P Coordinator (p2p_workflow_coordinator.py): Workflow lifecycle manager with deterministic peer assignment via hamming_distance(SHA256(clock_head:task), SHA256(peer_id))
  • MCP Tools (mcp/p2p_workflow_tools.py): 10 tools exposing submit, assign, status, list, update, peer management, stats
  • CLI (cli/p2p_workflow_cli.py): Complete ipfs-kit p2p interface with JSON output support
  • Tag Parser: Auto-detects P2P tags in workflow name, labels, job name, job labels
  • State Persistence: JSON-backed coordinator state in ~/.ipfs_kit/p2p_workflows/

Steps for Reviewing:

  1. Review core algorithms: merkle_clock.py (hamming distance), fibonacci_heap.py (heap operations), p2p_workflow_coordinator.py (assignment logic)
  2. Verify tag detection: python -c "from ipfs_kit_py.p2p_workflow_coordinator import P2PWorkflowCoordinator; c=P2PWorkflowCoordinator('test'); print(c.parse_workflow_file('examples/p2p_workflows/scrape_website.yml'))"
  3. Run tests: python tests/test_p2p_workflow.py (26 tests covering all components)
  4. Test CLI: ipfs-kit p2p stats, ipfs-kit p2p workflow submit examples/p2p_workflows/scrape_website.yml
  5. Review examples: examples/p2p_workflows/ for tagging patterns

Relevant documentation:

  • P2P_WORKFLOW_GUIDE.md - Architecture, API reference, examples, troubleshooting
  • P2P_WORKFLOW_QUICK_REF.md - Command reference, common patterns
  • P2P_WORKFLOW_IMPLEMENTATION_SUMMARY.md - Technical details, complexity analysis
  • examples/p2p_workflows/README.md - Tagging conventions, usage

Relevant tests:

  • tests/test_p2p_workflow.py - 26 unit tests (5 merkle clock, 7 fibonacci heap, 14 coordinator)
  • All tests pass with 100% success rate
  • Validates: chain verification, priority ordering, task assignment, state persistence

Checklist

  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly
  • I have added appropriate error handling
  • I have checked for performance implications
  • I have considered backward compatibility
  • I have verified that all tests pass locally

Usage:

from ipfs_kit_py import P2PWorkflowCoordinator

coord = P2PWorkflowCoordinator(peer_id="peer-1")
coord.add_peer("peer-2")
wf_id = coord.submit_workflow("workflow.yml", priority=3.0)
coord.assign_workflows()  # Uses merkle clock + hamming distance
ipfs-kit p2p workflow submit workflow.yml --priority 1.0
ipfs-kit p2p workflow assign
ipfs-kit p2p stats

Workflow Tagging:

name: P2P-Workflow Data Scraping
labels: [p2p-workflow, offline-workflow]
jobs:
  scrape:
    name: Scrape Data

Task Assignment: Peer with min(hamming_distance(SHA256(clock_head:task_hash), SHA256(peer_id))) executes workflow. Deterministic across all peers.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/endomorphosis/ipfs_accelerate_py/pulls/61
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

i had previously used github actions workflows to be able to run ci/cd tests, and that is working great, but I would also like to be able to not hammer the github api, so i did implement peer to peer api caching and sharing between machines, but now I think i need to be able to bypass the github cli completely, I would like some sort of tag that would be applied to the github actions workflows, for workflows that will completely avoid the github api and ecosystem entirely, and that are not going to get triggered by the github automated systems. Instead i would like to have the peer to peer ipfs-accelerate instances, to periodically agree to handle some of the github actions workflows that are unrelated to unit tests in the current users namespace, but are instead workflows that involve generating new code, or generally performign tasks like scaping websites, etc, to be able to completely bypass the github api. I would like to use the concept of the merkle clock to be able to define who out of the peer to peer network is responsible for performing the task, and we can hash the merkle clock head, and a hash of the task, compared to the and hash the peerid, and get some sort of hamming distance to determine which peer handles the tasks and if they have failed to do so. With regards to which of the workflows that should be ran, if there is contention between resources available and workflows needing to be ran, i would like to use the fibinocci heap method.

I think there is already some sort of code in the codebase for this, but i would like to make sure that all of these core functions reside within the ipfs_kit_py package, and that they are exposed as MCP Server tools, cli tools with ipfs-kit and as package imports. make sure that we are going to align our approach to the existing approach in this pull request.
endomorphosis/ipfs_accelerate_py#61


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add tag for bypassing GitHub API in workflows Add P2P workflow distribution system with merkle clock consensus and fibonacci heap scheduling Nov 17, 2025
Copilot finished work on behalf of hallucinate-llc November 17, 2025 07:51
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.

2 participants