Add /run-workflow skill and enrich get_status - #1058
Conversation
This comment has been minimized.
This comment has been minimized.
Autofix tracking{"Lint/Python": 2, "Lint/Docker": 1, "Test/Unit Tests": 1} |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
No agent-mode design concerns.
The changes align well with the agent-mode design guidelines:
get_statusenrichment adds lightweight metadata (pipeline details, 10 message summaries), not large pre-fetched diffs — this is orienting, not constraining- Coordinator spawning correctly uses
claude --printwith model aliasopus(not a pinned identifier), following EGG200/EGG201 - tmpfs mount on
~/reposfor the coordinator is an excellent example of "the sandbox is the constraint" — technically enforcing the orchestrator-not-implementer role rather than relying solely on prompt instructions /run-workflowskill is appropriate procedural guidance for a user-invoked sequential workflow; it tells the agent what to do at each lifecycle stage without micromanaging implementation
— Authored by egg
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Code Review: PR #1058
Thorough review of all 34 changed files. The PR bundles three concerns: (1) Python 3.11→3.13 upgrade, (2) PipelinePhase enum consolidation removing duplicates, and (3) /run-workflow skill + get_status enrichment + coordinator spawning refactor. The upgrade and consolidation are clean. The coordinator/MCP changes have issues.
Blocking Issues
1. run-workflow.md references non-existent CronCreate tool
sandbox/.claude/commands/run-workflow.md:47
The skill instructs the agent to "Set up recurring status polling using CronCreate with a 60-second interval." CronCreate does not exist in Claude Code. This is a hallucinated tool name, making Phase 3 (Monitor) non-functional as written. The agent will fail or hallucinate when trying to follow these instructions.
Fix: Replace with instructions to poll manually using repeated get_status calls in a loop with sleeps, or remove the cron reference entirely and describe the monitoring as "poll periodically."
2. test_get_status does not test the new enrichment at all
orchestrator/tests/test_coordinator_mcp_functional.py:457-466
The _handle_get_status method was significantly changed — it now makes 3 HTTP requests (coordinator state, pipeline details, messages) and merges the results. But test_get_status still uses a single mock_req.return_value which returns the same dict for all 3 calls. It only asserts result["current_phase"] == "implement", never checking that pipeline or recent_messages keys are present.
This means the enrichment logic (lines 248-275 of mcp_tools.py) has zero test coverage. The graceful fallback when enrichment fails is also untested.
Fix: Use mock_req.side_effect = [coordinator_response, pipeline_response, messages_response] to mock each call independently, then assert "pipeline" and "recent_messages" are present in the result with correct structure. Add a test for the fallback path where enrichment calls raise exceptions.
Non-Blocking Issues
3. Coordinator spawned with repo_volumes={} + tmpfs over /home/egg/repos
orchestrator/routes/pipelines.py:6314, 6323-6329
The coordinator container is spawned with an empty repo_volumes={} and a tmpfs overlaying /home/egg/repos. This means the coordinator has no access to the repository filesystem at all. While this may be intentional (coordinator as pure orchestrator), it's worth noting that:
- The coordinator's CLAUDE.md instructions reference
$EGG_REPO_PATH/docs/index.mdfor context gathering egg-contract showreads from.egg-state/in the repo path- The
_build_agent_promptat line 3194 tells the coordinator to runegg-orchcommands (which don't require repo access), so this may be fine
If this is intentional, a brief comment explaining why would help future readers. If not intentional, it needs fixing.
4. VALID_PIPELINE_PHASES now includes coordinator
gateway/gateway.py:4020-4021
The refactoring from a hardcoded frozenset to frozenset(p.value for p in PipelinePhase) is good for avoiding drift, but it silently adds coordinator to the valid phases. The old frozenset explicitly excluded it. Verify this is intentional — it means PATCH /api/v1/sessions/<token>/phase now accepts coordinator as a valid phase value from external callers.
5. test_init_emits_spawn_event doesn't verify EventType
orchestrator/tests/test_coordinator_executor_functional.py:168-177
The test asserts mock_emit.assert_called_once() and checks call_kwargs["data"]["role"] == "coordinator", but doesn't verify the first positional argument is EventType.COORDINATOR_SPAWN. A wrong event type would pass silently.
6. test_state_store.py state cleanup pattern weakened
orchestrator/tests/test_state_store.py:1032-1088, 1140-1167
The old save-and-restore pattern (original = StateStore._push_in_flight; ... finally: StateStore._push_in_flight = original) was replaced with force-to-False (StateStore._push_in_flight = False). The old pattern is strictly safer because it detects test pollution from prior tests. The new pattern masks any leaks by unconditionally resetting.
— Authored by egg
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Addressed all review feedback:
Blocking fixes:
CronCreatereference removed — replaced with instructions to poll in a loop with 60-second sleeps. All cron references (cancel cron, etc.) updated to match.test_get_statusnow covers enrichment — usesside_effectto mock all 3 HTTP calls independently; assertspipelineandrecent_messageskeys are present with correct structure. Addedtest_get_status_enrichment_fallbackto verify graceful degradation when enrichment calls raise exceptions.
Non-blocking fixes:
3. Coordinator tmpfs comment added — explains why repo_volumes={} + tmpfs is intentional (coordinator as pure orchestrator, not filesystem reader).
4. VALID_PIPELINE_PHASES excludes coordinator — coordinator is an internal orchestration concern, not a phase external callers should set. Filtered it out with an explanatory comment.
5. test_init_emits_spawn_event verifies EventType — added assertion that the first positional arg is EventType.COORDINATOR_SPAWN.
6. Save-and-restore pattern restored in test_state_store.py — all three tests now save original values of _push_in_flight and _push_pending before the test and restore them in finally, rather than force-resetting to False.
— Authored by egg
There was a problem hiding this comment.
No agent-mode design concerns in the delta.
The changes since the last review are all feedback fixes: replacing the hallucinated CronCreate tool with a polling loop (improves agent reliability), filtering coordinator from VALID_PIPELINE_PHASES, adding a comment explaining the coordinator tmpfs rationale, and test improvements. None introduce agent-mode anti-patterns.
— Authored by egg
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Re-Review: PR #1058
Re-review of commit 18344db (addressing feedback from initial review at 8718750).
Previous Blocking Issues — Verified Fixed
1. CronCreate reference removed — run-workflow.md now correctly instructs the agent to poll in a loop with 60-second sleeps. No remaining references to hallucinated tools.
2. test_get_status enrichment coverage — Properly uses side_effect to mock all 3 HTTP calls independently. Asserts pipeline and recent_messages keys with correct structure. New test_get_status_enrichment_fallback test verifies graceful degradation when enrichment calls raise ConnectionError. Good coverage.
Previous Non-Blocking Issues — Verified Fixed
3. Coordinator tmpfs comment — Clear, explains intent well.
4. VALID_PIPELINE_PHASES excludes coordinator — Correctly filtered with explanatory comment.
5. test_init_emits_spawn_event verifies EventType — Asserts first positional arg is EventType.COORDINATOR_SPAWN.
6. Save-and-restore pattern in test_state_store.py — All three tests save originals of _push_in_flight and _push_pending before the test and restore them in finally blocks.
New Findings
7. workflow_hint and urgency parameters are silently dropped (non-blocking)
orchestrator/mcp_tools.py:198-212
The submit_task tool schema defines workflow_hint and urgency as parameters (lines 48-58), and run-workflow.md Phase 1 instructs the agent to collect them and Phase 2 to pass them. But _handle_submit_task never reads or forwards these values to the pipeline creation API. Users who provide these parameters will see no effect.
Either forward them (e.g., in data["config"]) or remove them from the tool schema to avoid misleading callers.
— Authored by egg
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Agreed. Removed — Authored by egg |
This comment has been minimized.
This comment has been minimized.
Add a /run-workflow slash command that guides users through the full pipeline lifecycle (seed, submit, monitor, HITL, complete) using MCP tools. Enrich get_status to also return pipeline details and recent inter-agent messages alongside coordinator state, with graceful fallback if either enrichment call fails.
There was a problem hiding this comment.
No agent-mode design concerns in the delta.
The single new commit removes workflow_hint and urgency from the submit_task tool schema and run-workflow.md — a clean fix for the previously flagged issue of silently dropped parameters. No agent-mode anti-patterns introduced.
— Authored by egg
There was a problem hiding this comment.
Re-Review: PR #1058 (commit 2e4c077)
Delta since last review (18344db): removal of workflow_hint and urgency from submit_task schema, run-workflow.md, and schema test.
Previous Issue #7 — Verified Fixed
workflow_hint and urgency removed from the submit_task tool schema (mcp_tools.py), the skill instructions (run-workflow.md), and the schema test assertions. The handler never used these values, so removal is the correct fix.
New Finding
1. README.md still references removed parameters (non-blocking)
sandbox/.claude/commands/README.md:69
The /run-workflow description still says:
Gathers task parameters (description, repo, issue, workflow hint, urgency)
This should be updated to match the actual parameters:
Gathers task parameters (description, repo, issue)
— Authored by egg
2e4c077 to
ed41558
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…/egg-exec-20260313-214915-3146/work
…/egg-exec-20260313-215028-3186/work
Conflict Resolution SummaryResolved merge conflicts with
Verification
Please review: The gateway decorator fixes — main's PR #1053 introduced Python 3.12 type parameter syntax which conflicts with this PR's Python 3.11 compatibility commit. The resolution uses — Authored by egg |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…/egg-exec-20260313-214915-3146/work # Conflicts: # gateway/auth.py # gateway/gateway.py
|
Agreed. Updated Also fixed lint failures: restored — Authored by egg |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
egg agent-mode-design failed. View run logs 25 previous review(s) hidden. |
There was a problem hiding this comment.
No agent-mode design concerns in the delta.
Changes since the last review (2e4c077) are primarily merge commits bringing in main (including #1053) and conflict resolution. The substantive agent-mode-relevant changes are all clean:
- Container lifecycle tracking (
container_monitor.py) — pure infrastructure for reconciling coordinator-spawned agent exits; no agent-facing design impact - Auto-start in
submit_task(mcp_tools.py) — creates and starts the pipeline in one MCP call, simplifying the agent workflow (good) - Coordinator spawning refactored to
_spawn_and_wait(pipelines.py) — consistency improvement; still usesclaude --print --model opus(alias, not hardcoded ID) - Coordinator prompt in
_build_agent_prompt— concise 4-step objective that defers details tocoordinator.md; not micromanaging - Coordinator rules updated (
coordinator.md) — adds explicit "no repo access" constraints that match the tmpfs sandbox enforcement
— Authored by egg
|
egg agent-mode-design completed. View run logs 26 previous review(s) hidden. |
There was a problem hiding this comment.
Re-Review: PR #1058
Re-review at commit bf032e7 (merge of origin/egg/run-workflow-skill). Delta since last review at 2e4c077.
The new delta introduces coordinator lifecycle management (marking coordinator/agent entries as exited on completion, reconciling coordinator-spawned agent containers) and a merge with main. The merge has re-introduced three regressions that were explicitly fixed in prior review rounds.
Blocking Issues
1. Merge regression: VALID_PIPELINE_PHASES re-includes coordinator
gateway/gateway.py:4020-4021
At 2e4c077, this was correctly:
# ...excluding "coordinator", which is an internal orchestration concern...
VALID_PIPELINE_PHASES = frozenset(p.value for p in PipelinePhase if p != PipelinePhase.COORDINATOR)The merge replaced it with:
# ...derived from phase_filter.PipelinePhase to avoid drift
VALID_PIPELINE_PHASES = frozenset(p.value for p in PipelinePhase)This re-admits coordinator as a valid phase for the PATCH /api/v1/sessions/<token>/phase endpoint. This was explicitly identified as an issue in the first review, fixed in 18344db, and confirmed fixed in the re-review at 18344db. The merge undid it.
Fix: Restore the exclusion filter: frozenset(p.value for p in PipelinePhase if p != PipelinePhase.COORDINATOR)
2. Merge regression: test_init_emits_spawn_event lost EventType assertion
orchestrator/tests/test_coordinator_executor_functional.py:185-187
At 2e4c077, the test included (added per review feedback in 18344db):
from events import EventType
call_args = mock_emit.call_args[0]
assert call_args[0] == EventType.COORDINATOR_SPAWNThe merge removed these three lines. The test now only asserts call_kwargs["data"]["role"] == "coordinator" without verifying the event type. A wrong EventType would pass silently.
Fix: Restore the three lines verifying EventType.COORDINATOR_SPAWN.
3. Merge regression: test_state_store.py save-and-restore pattern reverted to force-to-False
orchestrator/tests/test_state_store.py:1036-1037, 1058-1059, 1067-1068, 1086-1087, 1143-1144, 1165-1166
At 2e4c077, all three _sync_to_remote_async tests correctly used save-and-restore:
original_in_flight = StateStore._push_in_flight
original_pending = StateStore._push_pending
# ... test body ...
finally:
StateStore._push_in_flight = original_in_flight
StateStore._push_pending = original_pendingThe merge conflict resolution summary says "Accepted main's removal of unused original_in_flight/original_pending variables" — but these variables were not unused. They were the save-and-restore mechanism. The merge re-introduced the force-to-False pattern.
Fix: Restore the save-and-restore pattern in all three tests (test_sync_to_remote_async_debounces_and_retries, test_sync_to_remote_async_no_retry_without_pending, test_sync_to_remote_async_respects_max_retries).
Non-Blocking Issues
4. Coordinator tmpfs comment removed
orchestrator/routes/pipelines.py:6308-6311
At 2e4c077, there was an explanatory comment (added per review feedback):
# Coordinator is a pure orchestrator — it should not read or
# modify repository files. Empty repo_volumes + tmpfs over
# ~/repos enforces this: the coordinator can only interact
# via egg-orch CLI commands, not the filesystem.The merge removed it. The repo_volumes={} + tmpfs pattern is non-obvious without explanation.
Fix: Restore the comment above the _spawn_and_wait call.
5. Missing test coverage for _reconcile_coordinator_agent error paths
orchestrator/tests/test_container_monitor.py
The TestReconcileCoordinatorAgent class has five tests for the happy paths but none for the error-handling branches:
- No test for
VersionConflictErrorwhensave_pipelineraises (line 537-542 ofcontainer_monitor.py). Compare:TestReconcileContainerState.test_handles_version_conflictcovers this for the sibling function. - No test for
list_pipelines()failure (line 492-499). Compare:TestReconcileContainerState.test_handles_store_list_errorcovers this for the sibling function.
These error paths are reachable in production (version conflicts happen during concurrent pipeline updates).
6. handle_coordinator_completion saves without expected_version
orchestrator/coordinator_executor.py:161, 185
Both store.save_pipeline(pipeline) calls omit expected_version, while the sibling function _reconcile_coordinator_agent correctly uses expected_version=pipeline.version. The in-process get_pipeline_state_lock prevents same-process races, but this is a pattern inconsistency that could mask issues if another process modifies the pipeline concurrently. Low risk due to the lock but worth noting for consistency.
All three blocking issues are merge regressions — fixes that were confirmed working at 2e4c077 and then lost during the merge with main. The simplest fix is to re-apply the three specific changes.
— Authored by egg
|
egg review completed. View run logs 26 previous review(s) hidden. |
| egg is addressing review feedback... |
Fix three blocking merge regressions that were introduced when merging
with main:
1. VALID_PIPELINE_PHASES: restore coordinator exclusion filter so the
session phase endpoint does not accept 'coordinator' as a valid phase
2. test_init_emits_spawn_event: restore EventType.COORDINATOR_SPAWN
assertion that verifies the correct event type is emitted
3. test_state_store.py: restore save-and-restore pattern for
_push_in_flight and _push_pending in all three _sync_to_remote_async
tests to detect test pollution
Non-blocking fixes:
4. Restore coordinator tmpfs comment explaining why repo_volumes={} +
tmpfs is intentional (coordinator as pure orchestrator)
5. Add error path tests for _reconcile_coordinator_agent: version
conflict and store list failure, matching sibling function coverage
6. Add expected_version to handle_coordinator_completion save_pipeline
calls for consistency with _reconcile_coordinator_agent
There was a problem hiding this comment.
Addressed all review feedback from the re-review at bf032e7:
Blocking fixes (merge regressions):
VALID_PIPELINE_PHASESexcludescoordinator— restored the exclusion filter with an explanatory comment.test_init_emits_spawn_eventverifies EventType — restored the three-line assertion checkingEventType.COORDINATOR_SPAWN.- Save-and-restore pattern in
test_state_store.py— all three_sync_to_remote_asynctests now save originals of_push_in_flightand_push_pendingand restore them infinallyblocks.
Non-blocking fixes:
4. Coordinator tmpfs comment restored — explains why repo_volumes={} + tmpfs is intentional.
5. Error path tests added for _reconcile_coordinator_agent — test_handles_version_conflict and test_handles_store_list_error, matching the sibling TestReconcileContainerState coverage.
6. handle_coordinator_completion uses expected_version — both save_pipeline calls now pass expected_version=pipeline.version for consistency with _reconcile_coordinator_agent.
— Authored by egg
There was a problem hiding this comment.
No agent-mode design concerns in the delta.
The single commit since the last review (bf032e7 → 6a07672) addresses merge regressions and test improvements — all infrastructure/correctness fixes with no agent-mode design impact:
- Coordinator
VALID_PIPELINE_PHASESexclusion restored (gateway enforcement, not prompt-level) - Coordinator tmpfs comment restored (documents sandbox-enforced constraint)
expected_versionadded tosave_pipelinecalls (concurrency safety)- Test fixes: EventType assertion, save-and-restore pattern, error path coverage
No anti-patterns introduced.
— Authored by egg
|
egg agent-mode-design completed. View run logs 26 previous review(s) hidden. |
There was a problem hiding this comment.
Re-Review: PR #1058 (commit 6a07672)
Delta since last review (bf032e7): single commit addressing all 6 issues from the previous review.
Previous Blocking Issues — Verified Fixed
1. VALID_PIPELINE_PHASES excludes coordinator — Correctly filtered with if p != PipelinePhase.COORDINATOR and explanatory comment. Third time this fix has been applied (was lost in a merge at bf032e7); the current code is correct.
2. test_init_emits_spawn_event verifies EventType — Asserts call_args[0] == EventType.COORDINATOR_SPAWN. Restored correctly.
3. Save-and-restore pattern in test_state_store.py — All three _sync_to_remote_async tests save _push_in_flight and _push_pending before the test and restore them in finally blocks. Correct.
Previous Non-Blocking Issues — Verified Fixed
4. Coordinator tmpfs comment — Restored at pipelines.py:6308-6311. Clear and concise.
5. Error path tests for _reconcile_coordinator_agent — test_handles_version_conflict (line 366) and test_handles_store_list_error (line 380) both match the actual implementation error paths in container_monitor.py:492-499 and 537-542. Good coverage.
6. handle_coordinator_completion uses expected_version — Both save_pipeline calls (lines 158 and 185) now pass expected_version=pipeline.version, consistent with _reconcile_coordinator_agent.
No new issues found. All six fixes from the previous review are correctly applied and the delta introduces no regressions.
— Authored by egg
|
egg review completed. View run logs 26 previous review(s) hidden. |
Add /run-workflow skill and enrich get_status MCP tool
The egg MCP server exposes coordinator tools but has no guided workflow for
external Claude Code sessions. This adds a
/run-workflowslash command thatowns the full pipeline lifecycle — seed prompt, submit, monitor, HITL handling,
and completion — using the existing MCP tools.
The
get_statusMCP tool is also enriched to return pipeline details (repo,issue number, mode, created_at) and recent inter-agent messages alongside the
existing coordinator state. Both enrichment calls fail gracefully so the
primary coordinator state is always returned.
Changes:
sandbox/.claude/commands/run-workflow.md— new 5-phase skill definitionorchestrator/mcp_tools.py— enriched_handle_get_statuswith pipelinedetails and messages; updated tool description
sandbox/.claude/commands/README.md— added/run-workflowentryIssue: none
Test plan:
pytest orchestrator/tests/test_coordinator_mcp_functional.py/run-workflowin a Claude Code session with the MCP server configuredget_statusreturnspipelineandrecent_messagesfields