INFRA-001: Restore infrastructure proxy bidding subscription in mesh_node.py #98

Closed
opened 2026-04-07 18:13:34 +00:00 by Mark · 2 comments
Owner

Problem

Subscription to intent.discovered exists (line 249), but bidding logic is missing. Infrastructure needs to bid on behalf of registered workers.

Scope (MINIMAL)

  1. In _on_intent_discovered(), add bidding logic:
    • Query ledger.find_eligible_worker_instances(intent_type)
    • Filter workers with bond_pool >= min_bond
    • For each eligible worker, call ledger.escrow_bond(worker_id, intent_id, bond)
    • Call ledger.acquire_claim_lease(intent_id, worker_id)
  2. No changes to spawn logic - that's INFRA-005

Files

  • docker/mesh_node.py - _on_intent_discovered() add bidding

Acceptance Criteria

  • Queries ledger for eligible workers
  • Escrows bond from worker pools
  • Acquires claim lease for winning bid
  • Emits intent.claimed on success
## Problem Subscription to `intent.discovered` exists (line 249), but bidding logic is missing. Infrastructure needs to bid on behalf of registered workers. ## Scope (MINIMAL) 1. In `_on_intent_discovered()`, add bidding logic: - Query `ledger.find_eligible_worker_instances(intent_type)` - Filter workers with `bond_pool >= min_bond` - For each eligible worker, call `ledger.escrow_bond(worker_id, intent_id, bond)` - Call `ledger.acquire_claim_lease(intent_id, worker_id)` 2. No changes to spawn logic - that's INFRA-005 ## Files - `docker/mesh_node.py` - `_on_intent_discovered()` add bidding ## Acceptance Criteria - [ ] Queries ledger for eligible workers - [ ] Escrows bond from worker pools - [ ] Acquires claim lease for winning bid - [ ] Emits `intent.claimed` on success
Author
Owner

Additional Context (2026-04-09)

Test Evidence

From E2E test execution (tests/e2e/test_skill_tool_e2e.py):

  • Tests pass because mesh_node executes work in-process
  • Real AI integration works (qwen3.5:9b, 102s execution)
  • But architecture is fundamentally broken
  • Issue #111 - meta_factory dataclass error (blocks factory evolution)
  • Issue #112 - Test collection errors (6 files cannot collect)
  • Issue #113 - Missing documentation (championships, rumination, bones)

Blocking Dependencies

This issue blocks:

  1. Proper worker isolation and scaling
  2. Bone fast-path execution by workers
  3. Validation as worker capability
  4. Evolution through mesh flow
  5. Federation of workers across nodes

Implementation Path

Phase 1: Remove _execute_as_worker() from mesh_node
Phase 2: Spawn ephemeral_worker.py as subprocess
Phase 3: Workers subscribe to backplane independently
Phase 4: Workers emit results via result.committed

Performance Impact

Current: Threads in mesh_node process (fast but wrong)
Correct: Subprocess spawning (slower but architecturally sound)

Trade-off: Accept spawning overhead for process isolation, independent scaling, correct architecture, and federation support.

## Additional Context (2026-04-09) ### Test Evidence From E2E test execution (tests/e2e/test_skill_tool_e2e.py): - Tests pass because mesh_node executes work in-process - Real AI integration works (qwen3.5:9b, 102s execution) - But architecture is fundamentally broken ### Related Issues - **Issue #111** - meta_factory dataclass error (blocks factory evolution) - **Issue #112** - Test collection errors (6 files cannot collect) - **Issue #113** - Missing documentation (championships, rumination, bones) ### Blocking Dependencies This issue blocks: 1. Proper worker isolation and scaling 2. Bone fast-path execution by workers 3. Validation as worker capability 4. Evolution through mesh flow 5. Federation of workers across nodes ### Implementation Path **Phase 1:** Remove _execute_as_worker() from mesh_node **Phase 2:** Spawn ephemeral_worker.py as subprocess **Phase 3:** Workers subscribe to backplane independently **Phase 4:** Workers emit results via result.committed ### Performance Impact Current: Threads in mesh_node process (fast but wrong) Correct: Subprocess spawning (slower but architecturally sound) Trade-off: Accept spawning overhead for process isolation, independent scaling, correct architecture, and federation support.
Author
Owner

✅ IMPLEMENTED - 2026-04-25

Infrastructure proxy bidding is now fully implemented via BidManager class:

Implementation:

  • docker/bid_manager.py - New BidManager class handles all bidding logic
    • bid() - Main entry point called from mesh_node on intent.discovered
    • _find_workers() - Finds eligible workers (literal → semantic fallback → factory catchall)
    • _filter_by_bond() - Filters workers by bond pool >= min_bond
    • _bid_all_workers() - Escrows bond and scores workers (similarity × 0.4 + reputation × 0.3 + bond_ratio × 0.3)
    • _emit_claimed() - Emits intent.claimed signal on winning bid

Integration in docker/mesh_node.py line 571:

if self.bid_manager.bid(intent_id, intent_type, payload):
    return  # Bid won, worker will be spawned after claim validation
    

Acceptance Criteria Status:

  • Queries ledger for eligible workers (via _find_workers() with literal + semantic fallback)
  • Escrows bond from worker pools (via _bid_all_workers() → ledger.escrow_bond())
  • Acquires claim lease for winning bid (via _emit_claimed())
  • Emits intent.claimed on success (via backplane signal)

Tests: 151 tests collected, bid-related tests passing.

Note: The original spec suggested adding logic directly to _on_intent_discovered() but the actual implementation uses a cleaner BidManager class pattern for better separation of concerns.

## ✅ IMPLEMENTED - 2026-04-25 Infrastructure proxy bidding is now fully implemented via `BidManager` class: **Implementation:** - `docker/bid_manager.py` - New `BidManager` class handles all bidding logic - - `bid()` - Main entry point called from mesh_node on intent.discovered - - `_find_workers()` - Finds eligible workers (literal → semantic fallback → factory catchall) - - `_filter_by_bond()` - Filters workers by bond pool >= min_bond - - `_bid_all_workers()` - Escrows bond and scores workers (similarity × 0.4 + reputation × 0.3 + bond_ratio × 0.3) - - `_emit_claimed()` - Emits `intent.claimed` signal on winning bid - **Integration in `docker/mesh_node.py` line 571:** ```python if self.bid_manager.bid(intent_id, intent_type, payload): return # Bid won, worker will be spawned after claim validation ``` **Acceptance Criteria Status:** - [x] Queries ledger for eligible workers (via `_find_workers()` with literal + semantic fallback) - [ ] - [x] Escrows bond from worker pools (via `_bid_all_workers()` → `ledger.escrow_bond()`) - [ ] - [x] Acquires claim lease for winning bid (via `_emit_claimed()`) - [ ] - [x] Emits `intent.claimed` on success (via backplane signal) - [ ] **Tests:** 151 tests collected, bid-related tests passing. **Note:** The original spec suggested adding logic directly to `_on_intent_discovered()` but the actual implementation uses a cleaner `BidManager` class pattern for better separation of concerns.
Mark closed this issue 2026-04-25 19:38:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed#98
No description provided.