fix(opencode-local): pad prompts below the opencode 1.16.2 silent-exit floor (ORA-284) #1
Reference in New Issue
Block a user
Delete Branch "ora-284-opencode-prompt-pad"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Thinking Path
Linked Issues
Refs ORA-284, ORA-275, ORA-276 in the ORA Paperclip instance (internal). The public GitHub issue thread that originally motivated this is being opened alongside this PR; reviewers can refer to the changelog note below.
What Changed
packages/adapters/opencode-local/src/server/execute.tsOPENCODE_PROMPT_MIN_LENGTH_CHARS = 256padShortPrompt(input: string): stringthat returnsinputunchanged ifinput.length >= OPENCODE_PROMPT_MIN_LENGTH_CHARS, otherwise appends a deterministicPaperclip Runtime Contextblock of sufficient length and a trailing newlineopencode_localadapter now routes every prompt throughpadShortPromptbefore writing to stdinpromptMetrics.promptPadded(0/1) emitted per run so operators can observe how often the workaround firespackages/adapters/opencode-local/src/server/execute.test.tspromptPaddedmetric correctness (4 cases + 2 from the existing helper extraction = 7 total)Verification
Expected: 7/7 vitest cases green, tsc clean. The reproduction loop from the issue thread (5-run sample, observed ~32% silent-exit rate pre-fix) drops to 0/5 silent-exit rate post-fix when run against a synthetic wake payload shorter than 256 chars.
Risks
Paperclip Runtime Contextblock; it does not change agent behavior beyond what the original context would have shown, and the helper is a no-op once the prompt already exceeds the floor.opencode_local. Theclaude_local,codex_local, andhermes_localadapters are untouched. If the same silent-exit mode exists inclaude_localit would be addressed in a separate change with its own root-cause analysis.promptMetrics.promptPaddedshould expect a non-zero rate on first deploys that decreases as downstream callers learn to send longer payloads. The metric is informational only and does not feed alerts.Model Used
minimax/MiniMax-M3for the implementation loop and the tests. The fix itself is mechanical (a deterministic helper + four targeted tests) and does not rely on emergent model behavior.Checklist
opencode_local); no server / shared / db schema changespromptMetrics.promptPaddedis additive<type>(<scope>): <subject>convention