Skip to content

Sync HOPE agent-safe holistic workflow - #135

Open
swang22 wants to merge 2 commits into
Power-Agent:mainfrom
swang22:sync-hope-agent-workflow
Open

swang22 wants to merge 2 commits into
Power-Agent:mainfrom
swang22:sync-hope-agent-workflow

Conversation

@swang22

@swang22 swang22 commented Oct 22, 2026

Copy link
Copy Markdown

Summary

  • sync model-aware HOPE MCP core and shared integration tests from HOPE.jl commit 8126f0f
  • add isolated, idempotent GTEP-to-PCM agent runs with reconnect-safe status
  • add fail-fast optional-solver checks and output-path containment regression coverage
  • retain PowerMCP ownership of MCP SDK 2 transport, packaging, lockfile, and downstream unit tests
  • record the exact upstream revision in HOPE/SYNCED_FROM_HOPE.yml

Validation

  • uv --directory HOPE run python -m unittest discover -s tests -v (34 passed, 2 opt-in solver tests skipped)
  • uv --directory HOPE run python -m compileall -q src tests
  • upstream/downstream sync check passed
  • git diff --check passed

Synchronize model-aware HOPE MCP logic and integration tests from HOPE.jl 8126f0f. Register reconnect-safe holistic status and optional solver handling while retaining PowerMCP ownership of its MCP 2 transport and packaging.

@qian-harvard qian-harvard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the holistic workflow is a good addition, and the #130 hardening survives the sync. In a harness run:

  • every Julia call still passes values through ARGS;
  • injection payloads in solver are rejected;
  • invalid request_id values (../x, a/b, .., newlines, over 128 chars) are rejected;
  • eight concurrent launches with the same request_id produce exactly one job.

HOPE/tests + tests/ pass (475 passed), as does the PR's own unittest run.

One thing blocks the merge:

1. The sync removes PowerMCP's config hook. Main's core.py has _hope_setting() (from f994a15), which falls back to powermcp config for hope.repo_root, hope.julia_bin and hope.julia_depot_path. These settings are documented in README.md, powermcp/README.md and powermcp/registry.py. The synced core.py drops the hook, so those settings are silently ignored:

  • repo_root falls back to parents[4], which in an installed wheel is site-packages/powermcp;
  • Julia comes from PATH;
  • no depot is set.

powermcp doctor and the setup wizard still report HOPE as ready. Since the upstream sync treats core.py as a byte-for-byte copy, the next sync would drop it again. Could you either add the hook upstream, or move it into a file PowerMCP owns (e.g. server.py)? In the second case, set HOPE_REPO_ROOT / HOPE_JULIA_BIN / JULIA_DEPOT_PATH from powermcp.config only when they're unset.

Worth fixing in this PR or a follow-up:

  1. A run can stay "running" forever. The run manifest records no PID, and hope_holistic_status never checks whether the process is alive. If the Julia child dies without writing the manifest (server killed, OOM), the status stays running. Re-launching with the same request_id returns reused=True, status=running, so that id can't be recovered. A crash between creating the workspace and launching leaves the run stuck at CREATED/VALIDATED the same way. Recording the PID, and treating a dead PID as failed, would fix both.
  2. Status responses change after a reconnect. Before a reconnect a finished run reports status="done" and a failed one ok=False, error_type=job_failed. After a reconnect the same runs report "published" and ok=True, status="failed".
  3. No check for the HOPE.jl version. core.py calls tools/repo_utils/run_holistic_agent_job.jl, which only exists in recent HOPE.jl (around 8126f0f). With an older checkout, the whole workspace is copied before Julia fails. Please check that the script exists up front, and state the minimum HOPE.jl in the README.
  4. Two paths raise instead of returning a structured error: invalid YAML in a case's settings (ParserError), and a corrupt manifest (ValueError from hope_job_status).
  5. Small items:
    • ModelCases/X and X hash differently under the same request_id, which returns request_id_conflict.
    • Every launch reads and hashes every input file before checking for an existing manifest.
    • artifacts/agent_runs grows without any cleanup.
    • There are no unit tests for the hope_run_holistic / hope_holistic_status state machine (the integration tests need Julia and are opt-in). A fake-Julia test like the harness above would cover the idempotency and status paths in CI.

Restore PowerMCP path configuration through a downstream-owned adapter. Sync process-aware persistent status handling, compatibility and parsing preflights, canonical case IDs, and fast state-machine regression tests from HOPE.jl 6c69565.
@swang22

swang22 commented Oct 23, 2026

Copy link
Copy Markdown
Author

Thanks for the detailed review. I addressed the blocking config regression and the agent-state issues in commit 15cc275.

  • Added a PowerMCP-owned adapter that maps hope.repo_root, hope.julia_bin, and hope.julia_depot_path to HOPE_REPO_ROOT, HOPE_JULIA_BIN, and JULIA_DEPOT_PATH only when the runtime environment variable is unset. The synchronized core remains PowerMCP-independent.
  • Synced HOPE.jl through 6c69565: manifests now record launcher_pid and process_pid; dead RUNNING/CREATED/VALIDATED owners become durable failures.
  • Normalized public reconnect states to done/failed/cancelled, with failed manifests returning ok=false and error_type=job_failed.
  • Added a pre-copy check for tools/repo_utils/run_holistic_agent_job.jl and documented minimum revision 8126f0f.
  • Invalid case YAML and corrupt active manifests now return structured errors.
  • Canonicalized resolved case directory names so X and ModelCases/X hash identically.
  • Added synchronized fake-process state-machine tests plus PowerMCP adapter precedence tests.

Validation: 46 HOPE connector tests pass locally (2 opt-in real-solver tests skipped), the Windows PID probe succeeds, the connector wheel includes the adapter, and the upstream HOPE MCP suite passes 68 tests (2 opt-in skips).

I kept full content hashing because request IDs currently promise source-fingerprint conflict detection. Workspaces remain intentionally retained as audit records; the README now states that operators should apply their own archival/removal policy rather than PowerMCP deleting model evidence automatically. Please take another look when convenient.

This branch has not been deployed

No deployments
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