Commit Graph

1658 Commits

Author SHA1 Message Date
MoerAI 61b812ffa9 fix(keyword-detector): stop hyperplan firing on '.hpp' C++ header paths (fixes #4215)
The hyperplan trigger \b(hyperplan|hpp)\b/i matched 'hpp' inside common C++ header references like 'check interface.hpp' or 'open buffer.hpp'. The leading '.' is a non-word character, so \b is already satisfied and the false positive fires the hyperplan-mode prompt on routine code questions.

Split the alternation so 'hpp' additionally requires that the preceding character is neither a word character nor a '.'. This preserves every existing trigger ('hpp do this', '/hpp ...', mid-sentence usage, mixed case) while rejecting filename uses of the .hpp extension. The longer 'hyperplan' keyword keeps the original \b boundary semantics.

Reproduction (added regression tests):
- 'please help to check interface.hpp' must NOT fire
- 'open src/include/audio/buffer.hpp and fix the leak' must NOT fire

All 14 cases in hyperplan.test.ts pass (12 existing + 2 new), broader keyword-detector suite stays green (92 pass), typecheck clean.
2026-05-21 13:39:34 +09:00
YeonGyu-Kim 735b4d2997 Merge pull request #4070 from PeterPonyu/fix/4036-prompt-shield-system-directive-marker
fix(prometheus-md-only): replace SYSTEM DIRECTIVE marker with XML tag in external prompts (#4036)
2026-05-21 12:58:36 +09:00
YeonGyu-Kim d7d023bf27 Merge pull request #4072 from PeterPonyu/fix/3645-runtime-fallback-git-silent-fail
fix(runtime-fallback): fall back to synthetic continuation when session messages are empty (#3645)
2026-05-21 12:58:30 +09:00
YeonGyu-Kim 689ad9970b Merge pull request #4079 from PeterPonyu/refactor/3694-extract-analyze-constants
refactor(keyword-detector): consolidate analyze pattern/message into analyze/default and document delegate_task params (#3694)
2026-05-21 12:58:27 +09:00
YeonGyu-Kim acedacc5e7 Merge pull request #4084 from pizzav-xyz/feature/keyword-detector-enabled-expansions
feat(keyword-detector): add enabled_expansions config for allowlist control
2026-05-21 12:58:18 +09:00
YeonGyu-Kim ba5bc0ef4f Merge pull request #4092 from code-yeongyu/fix/status-timeout-hang
fix(shared): add timeout to isSessionActive to prevent infinite hang
2026-05-21 12:58:14 +09:00
YeonGyu-Kim b40426ca1b Merge pull request #4190 from herjarsa/feat/default-mode
feat(default-mode): auto-activate ultrawork and ralph loop without commands
2026-05-21 12:58:04 +09:00
YeonGyu-Kim d502900201 Merge pull request #4221 from heunghingwan/feat/plan-format-validator
Add plan format validator hook to detect malformed task labels
2026-05-21 12:58:01 +09:00
YeonGyu-Kim 4bbf1d9388 refactor(packages): rename rules-core to rules-engine
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-21 12:50:10 +09:00
YeonGyu-Kim 7c7aa28160 refactor(packages): extract agents-md-core package 2026-05-21 12:50:10 +09:00
YeonGyu-Kim 7028c1f40a refactor(packages): extract comment-checker-core package 2026-05-21 12:49:10 +09:00
ZeyuFu 9bd2a9d7a9 fix(runtime-fallback): fall back to synthetic continuation when session messages are empty (#3645)
When the working directory contains a .git folder the OpenCode server
normalises the project root to the git root before persisting messages.
This creates a race: the 429/503/529 error event can fire before the
user's message is committed to storage, so session.messages returns []
and getLastUserRetryParts returns an empty array.  The previous code
treated that as a silent no-op (cleared all retry state, Sisyphus stalled).

Fix: when fetchedParts is empty, emit a structured log explaining the
.git-directory race and fall back to a synthetic { type:"text", text:"continue" }
part — matching the pattern already used by autoContinueAfterFallback in
event.ts.  The fallback dispatch always proceeds regardless of whether
the messages API can return user parts.

Update four tests that fired two consecutive session.error events relying
on the old silent-stop behaviour: add top-level model fields to the second
error so the awaiting-fallback gate recognises it as coming from the
dispatched fallback model and lets it through normally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 22:29:59 -04:00
ZeyuFu 9791019366 fix(prometheus-md-only): replace SYSTEM DIRECTIVE marker with XML tag in external prompts (#4036)
PLANNING_CONSULT_WARNING was prepended to the prompt forwarded to
subagent LLMs via task(). Its leading bracket-enclosed marker
`[SYSTEM DIRECTIVE: OH-MY-OPENCODE - PROMETHEUS READ-ONLY]` is
exactly the indirect-prompt-injection signature that Azure OpenAI
Prompt Shield flags in user-role content; on GPT-5.4 through
Azure, the model returns "I'm sorry, but I cannot assist with
that request." before any planning work runs, making Prometheus
non-functional on Azure.

The bracket marker was designed for internal hook-to-hook
filtering, but PLANNING_CONSULT_WARNING leaks it to external LLM
payloads. Replace the header with a neutral XML-tag wrapper
(`<planning-context source="prometheus-read-only">`) that Azure's
filter does not match while preserving the human-readable warning
body. Internal isSystemDirective() consumers are unaffected.

Regression test asserts the post-hook task() prompt does not
begin with the flagged bracket sequence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 22:04:10 -04:00
heunghingwan 73b5a7eb0e Add plan format validator hook to detect malformed task labels
- Strengthen Prometheus plan template with FORMAT constraint
- Add task label format check to Oracle phase-2 (N/6 → N/7)
- Add format checks to self-review checklist
- New plan-format-validator hook: compares raw checkbox count
  against getPlanProgress() after plan writes, warns agent when
  labels are malformed (0/0 or partial skip scenarios)
2026-05-21 05:17:54 +08:00
YeonGyu-Kim a6e4691fcc fix: remove duplicate local isRecord declaration (conflicts with import) 2026-05-21 03:17:52 +09:00
YeonGyu-Kim 97c73b41bf Merge pull request #3147 from EZotoff/fix/notepad-directive-scope
fix(sisyphus-junior-notepad): scope plan directive to delegated workers
2026-05-21 00:59:10 +09:00
YeonGyu-Kim 70da8ad695 Merge pull request #3600 from hackerh3/hackerh3/start-work-session-affinity
fix(start-work): prefer current session plan
2026-05-21 00:55:57 +09:00
YeonGyu-Kim f5de4bf7be Merge pull request #3498 from Disaster-Terminator/fix/task-id-prompt-surface
fix(prompts): prefer task_id in continuation guidance
2026-05-21 00:54:47 +09:00
YeonGyu-Kim 467aa13e9f Merge pull request #4064 from PeterPonyu/fix/3923-team-error-propagation
fix(team-mode): surface member error to main agent (#3923)
2026-05-21 00:42:11 +09:00
YeonGyu-Kim b76e8d2e86 Merge pull request #4077 from PeterPonyu/fix/4013-todo-continuation-enforcer-loop
fix(todo-continuation-enforcer): stop looping after all todos complete (#4013)
2026-05-21 00:38:41 +09:00
YeonGyu-Kim 5eabeb80f9 Merge pull request #4082 from PeterPonyu/fix/3685-notepad-no-write-fallback
fix(notepad-guard): refuse Write tool for .sisyphus/notepads files (#3685)
2026-05-21 00:37:27 +09:00
YeonGyu-Kim aa3187bfbb Merge pull request #4180 from JacobZyy/fix/plugin-hooks-merge 2026-05-21 00:14:58 +09:00
YeonGyu-Kim 3ee0209a41 Merge pull request #4113 from PeterPonyu/fix/3937-runtime-fallback-quota-patterns
fix(runtime-fallback): classify more provider quota error names
2026-05-21 00:07:08 +09:00
YeonGyu-Kim f35bb95634 Merge pull request #4114 from PeterPonyu/fix/3607-detect-shell-windows-msystem
fix(non-interactive-env): use powershell syntax on Windows regardless of SHELL/MSYSTEM (#3607)
2026-05-21 00:04:45 +09:00
JacobZyy 33f121b113 fix: add PATH to restricted hook env, protect HOME/CLAUDE_PROJECT_DIR from allowlist override, reset plugin hooks state in tests
- P1: When allowedEnvVars is provided, PATH was missing from the base
  restricted env, causing non-builtin commands to fail at exec time
- P2: Allowlisted HOME/CLAUDE_PROJECT_DIR could overwrite normalized
  values from getHomeDirectory()/cwd with ambient process.env values
- P2: Test suite mutated shared pluginHooksState singleton without
  resetting it in afterEach, causing cross-test state leaks
2026-05-20 22:49:05 +08:00
JacobZyy 0a20844bd4 fix: address PR #4180 review - security, typing, and test coverage
- Apply mcp_env_allowlist to plugin hooks: intersect HTTP allowedEnvVars
  with MCP allowlist, set command allowedEnvVars to full MCP allowlist
- Scrub process.env in executeHookCommand when allowedEnvVars provided
- Add PluginHooksState class with per-directory Map storage
- Add PluginHooksConfig interface for typed boundary layer
- Pass directory context through hook-config-handler
- Add 16 tests across 4 files (40 assertions) covering allowlist
  filtering, env scrubbing, directory isolation, and edge cases
- Remove unnecessary 'as' type assertions, use discriminated union
  narrowing instead
2026-05-20 22:30:25 +08:00
YeonGyu-Kim 1e42c61026 fix(todo-continuation): normalize prompt agent
Todo continuation could reinject with a lowercase built-in config key such as hephaestus when no registered alias was available. OpenCode prompt dispatch expects the prompt-facing agent name, so the continuation failed with an agent-not-found error.

Normalize the dispatch fallback through the existing prompt agent display-name resolver and pin the lowercase Hephaestus regression.
2026-05-20 23:07:52 +09:00
YeonGyu-Kim 5a6955053b Merge pull request #4206 from jeongjin0/fix/session-ready-background-tasks
fix(notification): suppress ready alerts during background tasks
2026-05-20 19:44:46 +09:00
YeonGyu-Kim 69e7ab4723 Merge pull request #4083 from PeterPonyu/fix/3724-slash-command-content-duplicated 2026-05-20 19:07:18 +09:00
YeonGyu-Kim fbcc1435e2 fix(runtime-fallback): recognize completion progress events 2026-05-20 18:19:26 +09:00
YeonGyu-Kim 330e437f08 docs(agents): regenerate hierarchical AGENTS.md for 2026-05-20
Sync the AGENTS.md hierarchy to current code state:

Drift fixes in 11 existing files
- Root: 2026-05-20 commit 39aadbf9f, ~2167 TS files, 120 barrel index.ts,
  57 src/hooks dirs, 297 (179 non-test) src/shared files, 11 OpenCode hook
  handlers in plugin-interface.ts, packages list adds ast-grep-mcp + rules-core,
  first-prompt-watchdog 206 LOC, parent-wake-notifier 587 LOC
- src/AGENTS.md: file counts, plugin-interface handler count
- src/shared/AGENTS.md: title + counts 278/170 -> 297/179
- src/hooks/AGENTS.md: 57 dirs, note unwired WIP (task-reminder,
  hashline-edit-diff-enhancer)
- src/features/AGENTS.md: module map with NON-TEST counts + sub-AGENTS.md
  column, 7 modules without sub-doc
- src/features/background-agent/AGENTS.md: add 12 newer files (parent-wake-
  notifier 587 LOC, loop-detector, error-classifier, fallback-retry-handler,
  process-cleanup, subagent-spawn-limits, session-status-classifier,
  compaction-aware-message-resolver, etc.)
- src/plugin/AGENTS.md: 11 handlers, add system-transform.ts + command-
  execute-before.ts + build-team-idle-wake-hint-client.ts
- src/config/AGENTS.md: note schema/internal/permission.ts
- src/cli/AGENTS.md: 8 commands including 'version'
- src/plugin-handlers/AGENTS.md, packages/web/AGENTS.md: date bump

New AGENTS.md in 4 directories
- packages/AGENTS.md: index of 15 packages (11 platform binaries + 2 MCP
  packages + rules-core + web), role map, conventions
- docs/AGENTS.md: WHERE TO LOOK table for 19 docs across 6 subdirs
- .opencode/AGENTS.md: 5 skills + 4 slash commands + relationship to .agents/
- .agents/AGENTS.md: superset migration target (9 skills + 4 commands)
2026-05-20 17:18:44 +09:00
YeonGyu-Kim 39aadbf9f0 fix(context-recovery): handle idle sessions 2026-05-20 17:02:18 +09:00
신정진 60a23a557e fix(notification): suppress ready alerts during background tasks
Gate idle ready notifications on the existing background-task continuation marker so cmux does not receive premature ready alerts while delegated work is still active.

Constraint: Reuse marker state from background task lifecycle without adding new notification config

Rejected: Patch cmux directly | notification readiness belongs upstream in OMO

Confidence: high

Scope-risk: narrow
2026-05-20 16:40:45 +09:00
YeonGyu-Kim b24dc6eeb8 fix(rules-core): isolate package + block symlink escape from rule sources
- Drop the back-import of src/shared/logger so @oh-my-opencode/rules-core
  stays free of host-adapter dependencies (ROADMAP package layering
  invariant). Expose setSisyphusRuleDeprecationLogger(logger) for hosts to
  inject their own logger; default is a noop.
- Wire the host injection in src/hooks/rules-injector/rule-file-finder.ts
  as a module-level side effect so existing behavior is preserved.
- Add realpath boundary check to findRuleFilesRecursive and
  validFileRealPath. Project rule scanners now refuse entries whose
  realpath escapes the rule-source root, closing the symlink-escape
  vector where a malicious repo could point .github/copilot-instructions.md
  (or any .omo/rules/* entry) at ~/.ssh/id_rsa and have the rule injector
  pull the secret into model context.
2026-05-20 15:29:16 +09:00
YeonGyu-Kim 89f6902617 Merge pull request #4205 from code-yeongyu/fix/comment-checker-apply-patch-payloads
fix(comment-checker): handle apply_patch payloads
2026-05-20 15:28:35 +09:00
YeonGyu-Kim 3bd6302021 fix(comment-checker): handle apply_patch payloads
Accept apply_patch edits from nested result/metadata file lists and from raw patchText args when OpenCode does not provide direct metadata.files.

Forward tool args through the after-hook pipeline so comment-checker can inspect raw apply_patch inputs while preserving existing write, edit, and multiedit routing.

Tests: bun test src/hooks/comment-checker/hook.apply-patch.test.ts src/hooks/comment-checker/hook.before-after.test.ts src/plugin/tool-execute-after.test.ts

Tests: bun test src/hooks/comment-checker

Tests: bun run typecheck

Tests: bun run build
2026-05-20 15:21:12 +09:00
YeonGyu-Kim 0ebba9eba1 fix(rules-injector): retry storage writes after cleanup race
The full Bun suite can remove the shared rules-injector storage directory between a parent-directory check and the file write. Save operations now create the directory immediately before writing and retry once if ENOENT still wins the race.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 14:35:28 +09:00
YeonGyu-Kim fbe423a2d4 feat(rules-injector): hydrate dedup cache from session transcript
Ports the codex-rules transcript-aware dedup strategy: when a session cache is fresh (process restart or compaction-cleared cache), the injector now scans prior tool outputs for the `[Rule: <relativePath>]` banner and pre-populates the cache so duplicate rule injections are suppressed even when the persistent JSON has been lost. Hydration runs at most once per session per process, fails open on transport errors, and is short-circuited when the same banner reappears.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:58:13 +09:00
YeonGyu-Kim c6dc266f2f test(test-isolation): add diagnostic regression test for cross-suite leak
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:34:24 +09:00
YeonGyu-Kim 53ddc470e3 test(rules-injector): align duplicate-cache mock types
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:24:24 +09:00
YeonGyu-Kim 1f9a581e70 fix(rules-core): fall back to workspace directory when no project root marker is found
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:20:47 +09:00
YeonGyu-Kim f8f4b572dc fix(runtime-fallback,prompt-gate): recognize all OpenCode progress event shapes and boolean/completed finish markers
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:12:06 +09:00
YeonGyu-Kim 20efb79fbf test(runtime-fallback,prompt-gate): add red tests for event-shape and finish-marker blind spots (BUG-C+D)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:12:06 +09:00
YeonGyu-Kim 847a8db2dc fix(runtime-fallback): preserve accepted pending retries 2026-05-20 11:42:46 +09:00
YeonGyu-Kim 6df148f0f6 fix(team-mode): close peer message delivery races 2026-05-20 11:42:38 +09:00
YeonGyu-Kim d3e218f912 fix(prompt): treat post-dispatch failures as accepted 2026-05-20 11:42:32 +09:00
herjarsa 3cb6785d74 fix(ralph-loop): minimal continuation prompt for default_mode
Reduce the ralph loop continuation prompt from ~15 lines to ~3 lines:
- Keep system directive prefix for proper identification
- Keep the essential 'output <promise>DONE</promise>' instruction
- Keep the original task prompt (needed context)
- Remove verbose boilerplate about reviewing progress and not stopping
2026-05-19 20:12:47 +02:00
herjarsa 2f1380f52d refactor(default-mode): inject ultrawork via system prompt instead of visible text
When default_mode.ultrawork is enabled, inject the ultrawork behavioral
instructions into the system prompt (experimental.chat.system.transform)
instead of prepending them to the user's visible chat message.

- system-transform.ts: No-op handler now injects ultrawork message into
  output.system[] when defaultMode.ultrawork is active. Checks for existing
  <ultrawork-mode> tag to avoid re-injection after compaction.
- keyword-detector/hook.ts: Removes the visible text injection
  (output.parts[].text prepend) for default_mode.ultrawork path. Only
  shows the toast as the user-facing indicator.
- plugin-interface.ts: Wires getUltraworkMessage from keyword-detector
  into createSystemTransformHandler.

Result: Ultrawork mode activates silently via system prompt — the chat
stays clean, and only a toast shows 'Ultrawork Mode Active'.
2026-05-19 18:11:38 +02:00
herjarsa e5463e2db7 feat(default-mode): auto-activate ultrawork and ralph loop without commands
Add new `default_mode` config section with two boolean fields:
- `ultrawork`: Auto-inject ultrawork mode prompt on main session start
  without requiring the "ultrawork"/"ulw" keyword. Wired through the
  keyword-detector hook — injects once per session, respects existing
  guards (non-OMO agents, planner agents, subagent sessions).
- `ralph_loop`: Auto-start ralph loop on first main session message
  without requiring /ralph-loop or /ulw-loop commands. When ultrawork
  is also enabled, the loop starts in ultrawork mode.

Usage:
  ```jsonc
  {
    "default_mode": {
      "ultrawork": true,    // Always get ultrawork prompt on start
      "ralph_loop": true    // Auto-start ralph loop
    }
  }
  ```

Files: 7 modified/added, ~65 LOC added.
2026-05-19 18:11:37 +02:00
Evgeny Zotov 342954ca15 fix(sisyphus-junior-notepad): scope plan directive to delegated workers 2026-05-19 13:41:40 +02:00