Security-critical implementations:
- Implement HMAC-SHA256 MAC computation in setup_production.py (3b)
- Implement HMAC-SHA256 MAC computation in keystore.py (3c)
- Implement agent SDK signature verification using coordinator API (2a)
Database cleanup:
- Remove backward compatibility engine from database.py (3a)
- Update fix_db.py to use get_engine() instead of direct engine import
Agent integration service deployment:
- Implement systemd-based agent instance deployment (1a)
- Implement HTTP health check for agent instances (1b)
- Implement systemd service removal for agent instances (1c)
- Implement deployment rollback with previous version redeployment (1d)
- Implement metrics collection from agent endpoints with fallback (agent_integration.py:828)
- Implement alerting rules with configurable thresholds (agent_integration.py:856)
All implementations follow the plan priorities:
- Security-critical items first (MAC computation, signature verification)
- Database cleanup second (backward compatibility removal)
- Agent integration service deployment third (systemd deployment, health checks, removal, rollback, metrics, alerting)
Implemented proxy endpoints to AI service for all AI service operations:
- POST /jobs: Submit job for execution
- GET /jobs/{job_id}: Get job status
- GET /jobs/{job_id}/result: Get job result
- POST /jobs/{job_id}/cancel: Cancel job
- GET /jobs: List jobs with filtering
- GET /health: Health check
All endpoints proxy to AI service (port 8106) using AITBCHTTPClient.
Implemented GPU discovery using nvidia-smi system command:
- /profiles: List available GPU profiles using nvidia-smi
- /metrics/{gpu_id}: Get GPU metrics (utilization, memory, temperature)
- /discover: Discover and register edge GPUs for a miner
- /optimize: Optimize ML inference request for edge GPU
All endpoints use subprocess to run nvidia-smi commands and parse
the output to extract GPU information.
Changed datetime.now(datetime.UTC) to datetime.now(UTC) since UTC
is imported separately. This fixes AttributeError when error
responses are generated.
- Re-enabled edge_gpu and multi_modal_rl routers
- Added blockchain RPC proxy endpoints:
- GET /blocks/{height}
- GET /blocks/hash/{hash}
- GET /transactions/{tx_hash}
- GET /accounts/{address}
- GET /validators
- GET /supply
- GET /state/dump
- GET /blocks/{height} - Get block by height
- GET /blocks/hash/{hash} - Get block by hash
- GET /transactions/{tx_hash} - Get transaction by hash
- GET /accounts/{address} - Get account balance and state
- GET /validators - List validators
- GET /supply - Get token supply
- GET /state/dump - Get state dump
- Add blockchain, edge_gpu, multi_modal_rl to router imports
- Add include_router calls for edge_gpu and multi_modal_rl
- Remove conditional imports since files now exist
- Add configure_logging function to aitbc_logging.py for root logging level configuration
- Update coordinator-api import to use aitbc_logging.configure_logging instead of deprecated aitbc.logging module
- Add nosec B104 comments to 4 uvicorn.run() and 1 api_host binding using 0.0.0.0 (api-gateway, coordinator-api, exchange, wallet)
- Replace datetime.UTC with datetime.timezone.utc in 10 locations across agent SDK (agent.py, compute_provider.py, swarm_coordinator.py)
- Add Union and Callable to contract_integration.py imports
- Changed datetime.UTC to timezone.utc in advanced_ai.py
- Changed datetime.UTC to timezone.utc in realtime_learning.py
- Changed datetime.UTC to timezone.utc in jwt_handler.py
- Changed datetime.UTC to timezone.utc in distributed_consensus.py
- Changed datetime.UTC to timezone.utc in exceptions.py
- Changed datetime.UTC to timezone.utc in alerting.py
- Changed datetime.UTC to timezone.utc in communication.py
- Changed datetime.UTC to timezone.utc in message_types.py
- Updated imports from `datetime import
- Convert api-gateway pyproject.toml to old Poetry format for workspace compatibility
- Add routing configuration for AI service (port 8106)
- Add routing configuration for Monitoring service (port 8107)
- Add routing configuration for OpenClaw service (port 8108)
- Add routing configuration for Plugin service (port 8109)
- Remove duplicate middleware implementations from coordinator-api (app_logging.py, error
- Removed edge_gpu import from main.py
- Removed app.include_router(edge_gpu) from main.py
- Deleted edge_gpu.py router file
GPU endpoints now handled by gpu-service on port 8101
This is Phase 4.3d: Update coordinator-api to remove GPU code
- Updated aitbc-core pyproject.toml with structlog and starlette dependencies
- Created middleware directory with 4 middleware files:
- RequestIDMiddleware for request correlation
- PerformanceLoggingMiddleware for performance tracking
- RequestValidationMiddleware for size validation
- ErrorHandlerMiddleware for standardized error responses
- Added structlog logging functions (configure_logging, get_logger) to aitbc-core
- Updated coordinator-api main.py to use aitbc-core middleware and logging
- Removed local middleware files from coordinator-api
- Removed app_logging.py from coordinator-api
- Added aitbc-core as workspace package to root pyproject.toml
This completes Phase 4.1: Extract shared utilities to aitbc-core
- Created RequestValidationMiddleware for request/response size validation
- Created ErrorHandlerMiddleware for standardized error responses
- Added both middlewares to FastAPI app
- Created validation patterns documentation
- Configured 10MB default size limits for requests and responses
This completes Phase 6: Request Validation Middleware
- Created PerformanceLoggingMiddleware to track request timing
- Added performance logging to main.py
- Logs request duration in milliseconds
- Adds X-Process-Time header to responses
This is Phase 5.4: Add performance logging
- Updated app_logging.py to use structlog for structured logging
- Added configure_logging function with JSON output format
- Updated main.py to call configure_logging during startup
- Created RequestIDMiddleware for request correlation
- Added request ID middleware to FastAPI app
- Updated web_vitals.py to use structured logging
This is Phase 5.1-5.3: Configure structlog, add request ID correlation, update routers
- Fixed monitoring_dashboard.py: replaced bare except with ValueError, AttributeError
- Fixed cross_chain_bridge_enhanced.py: replaced bare except with Exception (with logging)
- Fixed enterprise_integration.py: replaced bare except with specific exceptions
This starts Phase 3: Exception Handling Improvement
- Added test_services_blockchain.py with tests for blockchain service
- Added test_services_marketplace.py with tests for marketplace service
- Added test_services_agent.py with tests for agent service
This is Phase 2.3: Add tests for core services
- Added test_routers_blockchain.py with tests for blockchain status and sync status
- Added test_routers_governance.py with tests for governance proposals and voting
- Added test_routers_marketplace.py with tests for marketplace listings
- Added test_routers_agent.py with tests for agent list, register, and status
- Added test_routers_payments.py with tests for payment creation and status
This is Phase 2.2: Add tests for coordinator-api routers
- Updated all 6 app pyproject.toml files to reference root dependencies
- coordinator-api, blockchain-node, wallet, agent-coordinator, pool-hub, blockchain-event-bridge
- Kept package structure definitions and local path dependencies
- This completes dependency consolidation to single source of truth at root
Added __init__.py files to directories with Python files that were
missing them to fix imports and pytest discovery:
- apps/agent-coordinator/src/app and subdirectories (auth, monitoring, protocols, routing)
- apps/coordinator-api/src/app/agent_identity, reputation, utils
- apps/wallet/src/app/keystore, crypto, receipts
- apps/pool-hub/src/poolhub/services
- Test directories for agent-coordinator, blockchain-node, coordinator-api, pool-hub, wallet
- Source directories for agent-services and ai-engine
- blockchain-node subdirectories (contracts, economics, network, rpc)
- Migration directories for blockchain-node, coordinator-api, pool-hub
This improves import reliability and reduces the need for sys.path
manipulation in conftest.py.
Fixed hardcoded IP addresses in production code by replacing them with
environment variables or config settings:
- apps/blockchain-node/src/aitbc_chain/sync_cli.py: Use AITBC_SYNC_SOURCE
and AITBC_SYNC_IMPORT_URL env vars for RPC URLs
- apps/blockchain-node/src/aitbc_chain/app.py: Use AITBC_TRUSTED_IPS
env var for rate limiting bypass
- apps/coordinator-api/src/app/routers/client.py: Use settings.blockchain_rpc_url
for RPC endpoint
- dev/scripts/dev_heartbeat.py: Use AITBC_LOCAL_RPC and AITBC_GENESIS_RPC
env vars for RPC URLs
- cli/aitbc_cli.py: Use AITBC_FOLLOWER_HOST and AITBC_FOLLOWER_PORT
env vars for network peer display
This makes the codebase more portable and configurable for different
deployment environments.
Fixed Python 3.12+ deprecation warning by replacing all 357 occurrences
of datetime.utcnow() with datetime.now(datetime.UTC) across 49 files.
This change ensures timezone-aware datetime objects and fixes the deprecation
warning introduced in Python 3.12 (target version is 3.13).
- Add return type annotations to all async functions
- Add argument type annotations to functions missing them
- Add missing imports for typing (Any, Annotated, etc.)
- Add missing imports for FastAPI components (Query, Body, HTTPException)
- Fix validator functions in bounty.py and staking.py
- Fix dependency injection functions in agent_identity.py
- All 236 Ruff ANN001/ANN201 errors resolved across 26 files
- Add return type annotation to create_agent_network in client.py
- Add return type annotation to get_execution_receipt in client.py
- Add return type annotation to create_agent_network in admin.py
- Add return type annotation to get_execution_receipt in admin.py
- Addresses ruff ANN201 warnings in critical router files
- Add AsyncIterator, Callable, Awaitable imports from typing
- Add return type annotation to lifespan function (AsyncIterator[None])
- Add return type annotation to request_metrics_middleware (Response)
- Add type annotation to call_next parameter (Callable[[Request], Awaitable[Response]])
- Add return type annotation to rate_limit_metrics function (Response)
- Addresses ruff ANN001, ANN201, ANN202 warnings in main entrypoint
- Fix app.py to properly import FastAPI app from main.py
- Remove unused python_13_optimized.py variant
- Ensure single clean entrypoint for coordinator-api service
- Systemd wrapper uses app.main:app which now properly resolves