fix(shannon-worker): insert each Shannon helper independently#31
Open
peteromallet wants to merge 1 commit into
Open
fix(shannon-worker): insert each Shannon helper independently#31peteromallet wants to merge 1 commit into
peteromallet wants to merge 1 commit into
Conversation
The Shannon entrypoint patcher gated the entire helper blob (isRootProcess + rootSafeClaudeArgs + maybeSendStartupEnterKeys) on rootSafeClaudeArgs being absent. When an earlier patch had inserted only isRootProcess+rootSafeClaudeArgs, the next patch saw the gate satisfied and skipped the whole blob -- leaving maybeSendStartupEnterKeys undefined and the call site dangling. Result was a Bun ReferenceError at runtime and "Shannon readiness probe failed with exit code 1". Refactor each helper into its own gate-and-insert block so a partially-patched entrypoint heals on the next patch pass. Add regression test covering the partial-patch case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
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.
Bug
The Shannon entrypoint patcher in
_ensure_shannon_parent_timeout_controldefined three TypeScript helpers (
isRootProcess,rootSafeClaudeArgs,maybeSendStartupEnterKeys) as one multi-line blob and gated insertion ofthe entire blob on whether
rootSafeClaudeArgswas already present in thefile.
That gate fails on a partially-patched entrypoint. If an earlier megaplan
revision had injected only the first two helpers (no
maybeSendStartupEnterKeys), a newer megaplan would seerootSafeClaudeArgsalready present and skip the entire blob -- leavingmaybeSendStartupEnterKeysundefined. The downstream patch that insertsvoid maybeSendStartupEnterKeys(tmuxSession);runs independently andstill spliced the call site, so the patched entrypoint compiled but
exploded at runtime with a Bun
ReferenceError.Megaplan surfaced this as
Shannon readiness probe failed with exit code 1.Fix
Split the helper blob into three independent strings and gate each on its
own unique signature substring. Insertion order is preserved by inserting
in reverse before the same
buildClaudeArgsanchor, so a fullyunpatched entrypoint still ends up with
isRootProcess->rootSafeClaudeArgs->maybeSendStartupEnterKeys->buildClaudeArgs, while a partially-patched entrypoint only gets themissing helper(s) inserted.
Test plan
pytest tests/test_workers.py -k shannon-- existing patcher teststill passes (full unpatched entrypoint).
test_shannon_worker_heals_partially_patched_entrypointpasses -- starts from an entrypoint that already contains
isRootProcessandrootSafeClaudeArgs(and the danglingvoid maybeSendStartupEnterKeys(tmuxSession);call site) and assertsthe patch pass now inserts the missing definition without duplicating
the present helpers.
test_run_shannon_step_passes_prompt_with_print_flagfailure is unrelated to this change (fails on
maintoo).Scope note
The Shannon helper-patcher infrastructure plus a related non-root Shannon
runtime feature (
MEGAPLAN_SHANNON_DROP_ROOT/ nonroot home seeding)and a defensive
_normalize_worker_payloaddefaulting tweak werealready staged in the working tree but not yet committed on
main-- sothis PR also carries those in-flight files. The gate-fix patch sits on
top of that infrastructure; cherry-picking only the gate refactor would
modify code that doesn't yet exist on
main.