[codex] add portable workspace preparation tool - #26
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenFlywheel could query Langfuse traces and record authoritative outcomes, but initializing an optimization experiment still required manual branch management, ad-hoc Harbor commands, and machine-specific Codex MCP registration. That made expensive duplicate baselines possible and could evaluate the original harness checkout instead of the candidate workspace.
Root cause
There was no typed preparation use case connecting Git isolation, generated experiment instructions, a pinned harness revision, ITSM-bench execution, and re-entrant status polling. The plugin MCP launcher also depended on local
$PLUGIN_ROOTand$OPENFLYWHEEL_ROOTpaths, whichcodex execdoes not reliably inject into contributed MCP subprocesses.Change
prepare_workspaceMCP toolofw/<experiment-id>from an explicit base commit in a sibling Git worktree; never switch or reset the original checkout.PROGRAM.mdplusexperiment_config.yamlbefore baseline execution.OFW_HERMES_SOURCE, preventing evaluation of the wrong Hermes checkout.running -> ready | failed.Modular preparation package
Every module is under 500 lines and every touched function has cyclomatic complexity 5 or lower.
Portable plugin runtime
openflywheel-mcpconsole entry point.uvxfrom immutable package commit6319f24.Live ITSM evidence
A fresh Codex session invoked the installed plugin and prepared one real ITSM task:
itsm-hermes-plugin-smoke-20260828ofw/itsm-hermes-plugin-smoke-202608287e48d58a26c77d85efef4a1c8a12b3bc7989ff9afa75f2dc85225f10a5f3802981cf9c87$0.252173849995The original Hermes checkout remained unchanged. Replaying the identical request returned the same
readyresult without launching another baseline. After removing the manual development MCP registration, a freshcodex execdiscovered and called the installed plugin's ownopenflywheel.prepare_workspaceserver successfully.Companion integration
The ITSM adapter change and one-task smoke manifest are pushed separately to
divo12/ITSMBench@exp/ofw-hermes:b27c58a— consumeOFW_HERMES_SOURCE24cf9b1— add safe one-task OpenFlywheel smoke configurationVerification
uv run ruff check src tests plugins/openflywheel/scripts/mcp_server.pyuv run mypy src tests plugins/openflywheel/scripts/mcp_server.pyuv run pytest --cov=ofw --cov-report=term-missing --cov-fail-under=90 -qradon cc -s -a src/ofw/mcp.py src/ofw/preparation plugins/openflywheel/scripts/mcp_server.pyopenflywheel-mcpand both packaged templatesuvxstartup and plugin-onlycodex execverifiedScope boundary
This PR prepares and evaluates the baseline workspace. It does not start the optimization loop automatically, edit the harness after initialization, record outcome scores, push the experiment branch, or open a harness pull request.
Summary by cubic
Adds the
prepare_workspacetool that isolates harness experiments in a sibling Git worktree, records a baseline via Harbor, and writesPROGRAM.mdfrom packaged templates. Replaces the inline plugin MCP server with an installableopenflywheel-mcpconsole script launched byuvxfrom a pinned commit, so the plugin no longer runs from the local checkout.New Features
prepare_workspacecreates a non-destructiveofw/<experiment-id>branch in a sibling worktree and returns typed preparation status.unverified.Refactors
plugins/openflywheel/scripts/mcp_server.pytosrc/ofw/mcp.pywith anopenflywheel-mcpconsole script..mcp.jsonnow launches viauvx --from git+https://github.com/divo12/OpenFlyWheel.git@6319f24and forwards the model and Langfuse environment variables.Written for commit 69177bd. Summary will update on new commits.