Repository navigation
fix: single submit_plan with text/path auto-detect for OpenCode - #333
Merged
Merged
Conversation
PR #318 replaced the original text-based submit_plan with a file-path-only version and split prompt injection between plan/non-plan agents. This caused regressions: the agent couldn't figure out file paths from non-plan agents, and the 80+ line prompt with TodoWrite replacements was fragile against OpenCode upstream changes. This restores the original submit_plan(plan) that accepts markdown text directly — the contract that worked uniformly across all agents — and keeps the file-based workflow as submit_plan_file(path) for users who want persistent plan files. Key changes: - Two tools: submit_plan (text) + submit_plan_file (path) - Unified prompt for all primary agents (not just plan mode) - Removed aggressive TodoWrite string replacements and system-reminder - Kept adversarial stripping of OpenCode's STRICTLY FORBIDDEN rules - Extracted shared server helpers to reduce duplication Addresses #328 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Collapses submit_plan + submit_plan_file back into one tool that auto-detects whether the argument is plan text or a file path. First submission: agent passes markdown text (simple, works from any agent). On deny: response includes the history path where the plan was saved, so the agent can Edit the file for targeted revisions and resubmit with the path. Key changes: - One tool: submit_plan(plan) accepts text or absolute .md file path - Server surfaces historyPath through waitForDecision (already saved by saveToHistory, just not returned before) - Deny response includes file path hint for Edit-based revision workflow - Unified prompt for all primary agents (~25 lines, no TodoWrite warfare) - Still strips OpenCode's STRICTLY FORBIDDEN rules and suppresses plan_exit Addresses #328 and rcdailey's feedback on PR #333 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…o-tier prompt - Remove historyPath from deny flow — internal history directory should not be exposed to agents. Text submissions get text feedback; file submissions get file feedback. No crossover. - Error when agent passes an absolute .md path that doesn't exist instead of silently treating it as plan text. - Restore two-tier prompt: plan agent gets full planning instructions, other primary agents get a minimal reminder (matching pre-v0.13.0 behavior). - Clean up stale prompt copy referencing historyPath-based revision flow. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…oisy logs - Override todowrite description to defer to submit_plan during active planning - Tool description now instructs agent to explore and ask questions before submitting - Sequenced planning prompt: explore, ask, then write - Remove success logs from integration saves (stderr was bleeding through) - Append resubmit reminder to OpenCode deny feedback Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
backnotprop
added a commit
to HyunmoAhn/plannotator
that referenced
this pull request
May 29, 2026
The MermaidBlock test imported the component, which runs mermaid.initialize() at module load. That throws 'Unsupported color format: "backnotprop#333"' in the headless CI environment, failing the test on import before any assertion runs. Move the pure SVG-normalization helper into mermaidSvg.ts (no React, no mermaid import) and have both the component and the test import it from there. App behavior is unchanged; the test no longer loads mermaid.
backnotprop
added a commit
that referenced
this pull request
May 29, 2026
* Pin Mermaid SVG sizing attrs into markup so they survive re-injection Mermaid 11.x emits the root <svg> with style="max-width: <natural-px>;" and no preserveAspectRatio / height attributes. The component fixed this via imperative setAttribute in a useEffect, but React's repeated dangerouslySetInnerHTML re-injections (4-5 times during mount) wipe the imperative attrs because the useEffect's `svg` state dep does not change. Result: short flowcharts (e.g. `X --> Y --> Z`) render at their natural 85x66 px "dot" size, long flowcharts overflow vertically past their container (~1667 px), and drag feels broken because pan-on-clipped-svg has nowhere to go. Bake max-width:none, preserveAspectRatio="xMidYMid meet", and height="100%" into the SVG markup string itself before setSvg(). Since the attributes live in the markup, every re-injection carries them along. The imperative useEffect is left in place as defense-in-depth. Co-Authored-By: Claude Opus 4.7 <[email protected]> * Memoize MermaidBlock to preserve zoomed viewBox across pinpoint hover After zooming a Mermaid diagram and toggling pinpoint mode on, hovering the viewer would reset the visible viewport back to the full diagram. The zoom ref / badge stayed at e.g. 150%, but the SVG snapped back to its natural extents. Root cause: the pinpoint hook calls setHoverTarget on every mousemove, which re-renders the parent Viewer, which re-runs MermaidBlock's dangerouslySetInnerHTML and replaces the live SVG with the cached markup string. The prior commit's markup normalization pins three sizing attrs, but viewBox is not in the markup -- zoom mutates viewBox via setAttribute, so each re-injection drops the zoomed value. Wrap MermaidBlock with React.memo and a custom comparator on block.id + block.content (matching HtmlBlock's convention). Upstream blocks come from useMemo([markdown]) in the editor App, so referential equality holds whenever content is unchanged -- memo skips the re-render and the live SVG keeps its zoomed viewBox across pinpoint mousemove storms. Co-Authored-By: Claude Opus 4.7 <[email protected]> * Skip pinpoint targeting inside Mermaid grab area to keep drag clean In pinpoint mode, releasing a Mermaid pan-drag created a whole-block annotation. mouseup is followed by a click event, and the pinpoint overlay's click handler caught it and called highlighter.fromRange() on the entire Mermaid block. Separate annoyance: the dashed hover border drawn by the pinpoint overlay was visually distracting while the user was clearly trying to drag the diagram. Add data-pinpoint-ignore="" to the grab container div. usePinpoint's existing SKIP_SELECTORS in blockTargeting.ts already matches that attribute, so this is a one-attribute opt-out using a public extension point -- no changes to the pinpoint hook itself. Trade-off: Mermaid blocks no longer support whole-block-annotation via pinpoint. Annotations on diagrams must go through standard selection. This is the deliberate behavior chosen for diagrams where drag/zoom ergonomics matter more than whole-block targeting. Co-Authored-By: Claude Opus 4.7 <[email protected]> * Extract normalizeMermaidSvgMarkup to a pure module The MermaidBlock test imported the component, which runs mermaid.initialize() at module load. That throws 'Unsupported color format: "#333"' in the headless CI environment, failing the test on import before any assertion runs. Move the pure SVG-normalization helper into mermaidSvg.ts (no React, no mermaid import) and have both the component and the test import it from there. App behavior is unchanged; the test no longer loads mermaid. --------- Co-authored-by: Claude Opus 4.7 <[email protected]> Co-authored-by: Michael Ramos <[email protected]>
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.
Summary
Collapses the two-tool approach (
submit_plan+submit_plan_file) back into a singlesubmit_plan(plan)that auto-detects whether the argument is markdown text or a file path, based on rcdailey's feedback that one tool is sufficient.Provenance
submit_plan(plan: string)— text-based, uniform across agentssubmit_plan(path: string)— file-only, 80+ line prompt, TodoWrite warfaresubmit_plan(plan)— text or path, one tool, ~25 line promptHow it works
First submission: Agent passes plan as markdown text →
submit_plan(plan: "# My Plan\n..."). Simple, works from any agent.On deny: Response includes the history path where the plan was saved:
On revision: Agent edits the file with Edit tool (targeted changes, not full rewrite), then calls
submit_plan(plan: "/path/to/plan.md"). Auto-detected as file path.Auto-detection logic
Plan markdown virtually never satisfies all three conditions (absolute path +
.mdextension + exists on disk).What changed
apps/opencode-plugin/index.ts: Single tool, auto-detect, unified ~25 line prompt for all primary agents, removed TodoWrite warfarepackages/server/index.ts: SurfacehistoryPaththroughwaitForDecision()(the server already saved plans to history viasaveToHistory()— just never returned the path)packages/shared/feedback-templates.ts: Deny response includes file path hint whenhistoryPathis providedpackages/shared/feedback-templates.test.ts: Updated test for new wording, added history path testWhat's preserved
stripConflictingPlanModeRules()— still strips "STRICTLY FORBIDDEN" from system promptexperimental.chat.messages.transform— still filters "STRICTLY FORBIDDEN" from user messagesplan_exitsuppression viatool.definitionhook.mdpermission override for plan agentTest plan
bun test apps/opencode-plugin/plan-mode.test.ts— 10 passbun test packages/shared/feedback-templates.test.ts— 6 passFixes #328
🤖 Generated with Claude Code