Commit Graph

448 Commits

Author SHA1 Message Date
YeonGyu-Kim 462b55efc7 Merge pull request #4040 from code-yeongyu/cleanup/typescript-ai-slop-20260515
Refactor TypeScript cleanup patterns
2026-05-15 16:42:10 +09:00
YeonGyu-Kim 0a3d1875f7 refactor(tools): narrow optional values
Avoid non-null assertions in tool and doctor code by preserving narrowed locals through each use site.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-15 16:31:13 +09:00
YeonGyu-Kim d92e78c956 refactor(sdk): narrow response fallbacks
Replace unsafe unknown-array assertions with generic fallback types and explicit todo status narrowing.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-15 16:31:13 +09:00
YeonGyu-Kim d8f52aae7f test: run suite without split runner 2026-05-15 16:26:57 +09:00
YeonGyu-Kim 9f6d0d2281 docs(agents-md): refresh hierarchical knowledge base for v4.1.2
- Bump root AGENTS.md header: 2026-05-14 → 2026-05-15, commit 5ffbe0e2453a740636, release v4.1.1 → v4.1.2
- Update file counts: 2034 (1337+697) → 2041 (1340+701), LOC ~292k → ~294k
- Fix STRUCTURE: openclaw lives at src/openclaw/ (not src/features/); list more accurate feature modules in the parenthetical
- Clarify interactive_bash gate: tmux binary on PATH via isInteractiveBashEnabled() (not 'tmux enabled')
- Fix docs/reference/features.md hook counts: Tool Guard 14→16, Total base 52→54, total with team-mode 59→61
- Bump 'Generated' date on all 43 subdir AGENTS.md files to 2026-05-15
- Preserve promptAsync injection cautions verbatim (per request)
2026-05-15 13:48:11 +09:00
YeonGyu-Kim c2aa180e7e fix(prompt-gate): pin duplicate prompt dispatches
Keep prompt reservations briefly after successful dispatch so rapid idle/message/error transitions cannot inject the same follow-up twice.

Route all production session prompt calls through the shared gate, restore skipped background resume state, release holds after abort/recovery paths, and preserve Ralph/ULW loop state when a dispatch is deferred.

Add regression coverage for session routing, static prompt route auditing, team-mode live messaging, model suggestion retries, call-omo-agent reuse, background parent wakes, runtime fallback, compaction recovery, Atlas, and Ralph/ULW loops.
2026-05-15 13:19:10 +09:00
YeonGyu-Kim 30adce9cad fix(prompt-gate): share message reservations 2026-05-15 12:55:56 +09:00
YeonGyu-Kim 1e7a7600a2 docs(agents-md): regenerate hierarchical AGENTS.md knowledge base for v4.1.1
Refresh all AGENTS.md files to reflect codebase state at 5ffbe0e24 (was cd31d2a1a, 197 commits behind).

Key drift corrections across 45 modified + 1 new file:

Root AGENTS.md:
- TS file counts: 1967 -> 2034 in src/ (1337 source + 697 test)
- LOC: 278k -> 292k
- Barrel index.ts: 120 -> 122
- Hook tier composition: 52/59 -> 54/61 (base/with team-mode)
- Tool Guard hooks: 14 -> 16 (add fsync-skip-warning, bash-file-read-guard)
- Add boulder feature, agent-ordering schema, .agents/ directory, v4.1.1 release tag
- Add generated/ directory entry

src/AGENTS.md:
- Subsystem inventory: agents 96->102, hooks 570->581, tools 306->314,
  features 389->400, shared 258->278, cli 150->158, plugin 55->56
- LOC totals refreshed for every subsystem
- Schema files: 32 -> 30

src/hooks/AGENTS.md:
- Tier 2 (Tool Guard): 14 -> 16 hooks, add fsyncSkipWarning row
- Total: 52 base / 59 team-mode -> 54 base / 61 team-mode
- zauc-mocks count: 7 -> 5

src/features/AGENTS.md:
- background-agent: 47 -> 57 files, mention archive fallback
- opencode-skill-loader: 33 -> 30
- tmux-subagent: 34 -> 32

src/plugin/AGENTS.md:
- Tool Guard composer count: 14 -> 16
- Aggregator total: 43 -> 45

src/cli/AGENTS.md:
- Add new boulder subcommand (BoulderState inspector)
- Command count: 6 -> 7

NEW: src/features/boulder-state/AGENTS.md
- Document the new Boulder work tracking feature
- Schema v2 with BoulderState/BoulderWorkState/TaskSessionState
- Lifecycle, storage, integration points with atlas/ralph-loop hooks

All other AGENTS.md files: Generated date 2026-05-08 -> 2026-05-14.
2026-05-14 12:57:46 +09:00
YeonGyu-Kim d5fbada13d test: make unsafe test coercion explicit
Move test coercion out of a hidden global and require each test to import the helper so review tools and runtime scripts can see the unsafe boundary.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-12 15:51:31 +09:00
YeonGyu-Kim 7365163885 test(cli): remove unsafe test assertions
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-12 15:41:17 +09:00
YeonGyu-Kim 11529394aa refactor(cli): use Response(stream).text() instead of Bun.readableStreamToText
bun-install.ts streamToText() was reachable from the plugin bundle via
the cli/config-manager barrel re-export. Replace with the WHATWG
standard `new Response(stream).text()` pattern which works
identically in Bun and Node and avoids the last raw Bun.* runtime
call in dist/index.js.
2026-05-12 12:46:50 +09:00
YeonGyu-Kim 14b9a434d7 fix(cli/boulder): strip ANSI in formatter test so FORCE_COLOR CI passes
picocolors emits ANSI escape codes when FORCE_COLOR is set (GitHub
Actions default), so the literal toContain('status: active') assertion
fails against the wrapped 'status: \x1b[36mactive\x1b[39m' output.
Reuse the existing stripAnsi helper from src/cli/doctor/format-shared.ts
in the test before assertion.

Reproduced locally with FORCE_COLOR=1 bun test src/cli/boulder/formatter.test.ts.
2026-05-11 14:11:28 +09:00
YeonGyu-Kim c34508235f feat(cli/boulder): implement boulder() entry point and register subcommand 2026-05-11 13:41:18 +09:00
YeonGyu-Kim 30984939eb feat(cli/boulder): add types and formatter for boulder subcommand 2026-05-11 13:41:09 +09:00
YeonGyu-Kim f983b6b19e fix(installer): avoid empty-version success on delayed stdout 2026-05-11 09:30:33 +09:00
YeonGyu-Kim 5d1c8718d7 fix(installer): bound outputPromise wait after kill to prevent indirect hang
After SIGTERM/SIGKILL escalation, the stdout stream may not close immediately on all platforms. The unconditional await on outputPromise could then hang indefinitely, defeating the bounded process lifetime guarantee. Race outputPromise against a short follow-up timeout to ensure getOpenCodeVersion always returns within a bounded time.

Refs #3766
2026-05-11 09:24:42 +09:00
YeonGyu-Kim 84073897c6 test(installer): stabilize timeout signal escalation assertion 2026-05-11 08:50:59 +09:00
YeonGyu-Kim 7464d7e005 fix(installer): timeout opencode --version probe to avoid Desktop binary hang
When the binary resolved as 'opencode' on PATH is the OpenCode Desktop GUI (not the CLI), it does not respond to --version with prompt exit. proc.exited then waits forever, freezing the installer at 'Checking OpenCode installation'.

Fix: race proc.exited against OPENCODE_VERSION_CHECK_TIMEOUT_MS=1500. On timeout, proc.kill() and treat the binary as failed so the next candidate is tried. Success requires both timedExitCode === 0 and proc.exitCode === 0.

Fixes #3766
2026-05-11 08:45:21 +09:00
acamq cfab5caea3 fix(installer): add opencode-go fallback entries for deep and artistry categories
The deep and artistry category fallback chains had no opencode-go provider
entries, causing them to fall through to the ultimate fallback
(opencode/gpt-5-nano) which is not available to opencode-go users.

Add opencode-go entries:
- deep: deepseek-v4-pro -> kimi-k2.6 -> glm-5.1
- artistry: kimi-k2.6 -> glm-5.1

Fixes #3924
2026-05-10 10:11:59 -06:00
YeonGyu-Kim 98da8b675b fix(installer): apply extractSemverFromOutput to opencode-binary version probe
The same output.trim() bug fixed in PR #3909 for doctor exists in the
installer's opencode-binary.ts. Without this fix, `bunx oh-my-opencode
install` would store polluted Electron stdout (e.g., `00:24:25.202 >
app starting { version: '1.14.33', packaged: true }`) as the OpenCode
version in config, breaking downstream version-dependent logic.

- Extract extractSemverFromOutput to src/shared/extract-semver.ts
  (precedent: spawn-with-windows-hide is in shared because used by
  both doctor and installer)
- src/cli/doctor/checks/system-binary.ts now imports from shared and
  re-exports for backward compat
- src/cli/config-manager/opencode-binary.ts uses the shared helper
  with `?? output.trim()` fallback to preserve legacy behavior on
  non-semver-shaped successful outputs (e.g., custom builds)
- Add 4 installer regression tests covering: clean semver, polluted
  Electron stdout (regression for #3765 installer caller), fallback
  for non-semver, null when no binary on PATH

Refs #3765
2026-05-10 15:32:36 +09:00
YeonGyu-Kim dc4f248947 fix(doctor): extract semver from opencode --version stdout
The Electron-based OpenCode build leaks log lines like
`00:24:25.202 > app starting { version: '1.14.33', packaged: true }`
into stdout, so `getOpenCodeVersion` was returning the entire log
line as the 'version'. `compareVersions` then split that string on
'.' and produced a nonsensical numeric array (e.g., `[0, 0, 14, 0]`),
which it judged as < the minimum 1.4.0. Result: doctor incorrectly
flagged OpenCode 1.14.x as below the minimum required version.

Replace the raw `stdout.trim()` return with a small
`extractSemverFromOutput` helper that runs a semver-shaped regex
across the output. A negative lookbehind `(?<![\d:])` skips the
milliseconds segment of timestamps (e.g., `25.202` in
`00:24:25.202`), so the parser locks onto the real version token.

Adds 12 unit tests covering plain semver, v-prefix, pre-release,
build metadata, the Electron regression, timestamp-only stdout,
and various invalid inputs.

Fixes #3765
2026-05-10 14:43:30 +09:00
YeonGyu-Kim 39cf5a89bf fix(test): update model-fallback snapshots after metis switch to claude-sonnet-4-6
Commit 2dfa6336f changed Metis primary model from claude-opus-4-7 max
to claude-sonnet-4-6 in src/shared/model-requirements.ts but only
updated the unit test in model-requirements.test.ts. The CLI installer
end-to-end snapshot test (src/cli/model-fallback.test.ts) generates
configs from those same fallback chains via generateModelConfig and
captures them as snapshots, so 17 snapshot assertions broke.

Snapshots regenerated with `bun test src/cli/model-fallback.test.ts -u`.
Verified 86/86 pass across model-requirements + model-fallback +
openai-only-model-catalog test files.

The change is a no-op for the web import that this PR is primarily
about — including it here to unblock CI on dev (where the breakage
landed) rather than spinning up a separate hotfix PR.
2026-05-08 13:41:14 +09:00
YeonGyu-Kim 838b5ae216 docs(agents): refresh hierarchical AGENTS.md with team-mode coverage
Update root + 43 directory-level AGENTS.md files to reflect current state:
- Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source +
  663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook
  composition, and full Team Mode section (12 team_* tools, eligibility,
  storage layout, config gate)
- src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table
- src/tools/AGENTS.md documents conditional gates (team-mode +12, task
  system +4, hashline +1, interactive_bash +1, look_at +1) with always-on
  baseline of 20
- src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks
- src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents,
  spawn-race-safe invariants, and integration points
- src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode
- src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated
  for team-mode awareness, accurate counts, and current schema field list
- All other AGENTS.md files refreshed to 2026-05-08 generation date
2026-05-08 12:08:42 +09:00
YeonGyu-Kim 8586cb8965 fix(posthog): disable feature flags, remove plugin_loaded event for billing optimization
- Remove plugin_loaded telemetry from index.ts (was 46.5% of all events, ~2.83M/month)
- Add enableLocalEvaluation: false to prevent feature flag polling/decide calls
- Add strictLocalEvaluation: true to prevent server fallback requests
- Add disableRemoteConfig: true to prevent remote config network requests
- Remove 'plugin_loaded' from PostHogActivityReason type
- Update tests: remove stale mocks, add SDK options verification test
- enableExceptionAutocapture: false already present (kept)

Estimated billing reduction: ~$960+/month from feature flag requests,
plus ~2.83M fewer events/month from plugin_loaded removal.
2026-05-07 16:44:05 +09:00
YeonGyu-Kim 1ad0fd4ac8 Merge pull request #3748 from code-yeongyu/fix/simple-github-bugs-1948-3564
fix: resolve simple triaged GitHub bugs
2026-05-06 18:43:58 +09:00
MoerAI 2971322952 fix(doctor): catch unexpected failures and provide actionable diagnostics (fixes #3345) 2026-05-06 17:17:56 +09:00
YeonGyu-Kim 7ac1109611 Merge pull request #3636 from lucasyounger/codex/fix-3629-worktree-plan-path
fix(boulder): resolve continuation progress from worktree plan
2026-05-06 17:15:21 +09:00
Samuele Domenico Ruffino 6cd40df4cb feat(opencode-go): upgrade glm-5 → glm-5.1 and kimi-k2.5 → kimi-k2.6 in fallback chains 2026-05-06 16:45:30 +09:00
Samuele Domenico Ruffino 0727d9a1a3 fix(opencode-go): replace non-existent minimax-m2.7-highspeed with qwen3.5-plus 2026-05-06 16:45:30 +09:00
YeonGyu-Kim 2fd6be06c2 test(cli): update model fallback snapshots
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-06 14:20:50 +09:00
YeonGyu-Kim a475e456b3 feat(cli): add doctor check for team-mode dependencies 2026-05-06 14:19:39 +09:00
YeonGyu-Kim e699f3388d Merge pull request #3455 from CHLK/fix/cli-run-premature-exit-with-background-tasks
fix(cli-run): prevent premature exit when background tasks are active
2026-05-04 23:58:34 +09:00
YeonGyu-Kim 81d36ae749 test(cli-installer): cover telemetry shutdown failure isolation
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-05-04 01:44:04 +09:00
YeonGyu-Kim 14568db278 refactor(telemetry): drop run lifecycle events and captureException from runner 2026-05-02 00:10:57 +09:00
YeonGyu-Kim be2eee6306 refactor(telemetry): drop install events from cli-installer 2026-05-02 00:10:54 +09:00
YeonGyu-Kim c3beb370a5 fix(doctor): detect gh when Bun.which misses it
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-01 18:56:09 +09:00
MoerAI 2f3291d280 fix(bun-install): forward process.env so child bun install inherits proxy settings (fixes #3528)
Root cause: runBunInstallWithDetails() invoked spawnWithWindowsHide() without passing env, so the child bun install lost https_proxy / http_proxy / NO_PROXY and other parent env vars. @npmcli/agent then received an empty proxy URL and rejected fetch with 'fetch() proxy.url must be a non-empty string', breaking plugin auto-install on networks that require an outbound proxy.

Fix: pass env: process.env to spawnWithWindowsHide so the child bun install inherits the full parent environment, including proxy variables.

Verification: added a regression test that sets https_proxy/http_proxy on process.env and asserts those values are forwarded to the spawn options. Test fails before the fix and passes after. typecheck clean. Other pre-existing path-separator test failures on Windows are unrelated to this change.
2026-04-27 20:23:15 +09:00
YeonGyu-Kim 333ad3aadd refactor(agents): drop ZWSP prefixes from agent display names
The sort shim from the previous commit enforces canonical core ordering at runtime, so ZWSP prefixes are no longer needed. Removing them eliminates the Bun.stringWidth vs terminal-width drift that broke the TUI status bar (#3259).

Drop AGENT_LIST_SORT_PREFIXES and getAgentRuntimeName from agent-display-names; switch all call sites to getAgentDisplayName. getAgentListDisplayName stays as a thin alias for external importers.

Keep stripInvisibleAgentCharacters and the ZWSP regex paths so legacy session state and configs from v3.14.0-v3.16.0 still resolve.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 18:59:49 +09:00
YeonGyu-Kim e95a37fd3c fix(doctor): parse multi-slash model IDs
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 18:21:06 +09:00
YeonGyu-Kim 136a54f467 fix(doctor): avoid warnings for resolved model capabilities
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 15:31:48 +09:00
acamq 0afacfa756 test: fix remaining stale gpt-5.4 expectations after gpt-5.5 promotion
Commit 708891dab fixed most test expectations after the gpt-5.5 model
promotion but missed 13 tests across 6 files that still expected
openai/gpt-5.4 in DEFAULT_CATEGORIES and AGENT_MODEL_REQUIREMENTS.

Updates all remaining stale expectations to openai/gpt-5.5:
- agents/utils.test.ts: atlas/metis resolution, buildAgent category,
  override.category expansion (5 tests)
- plugin-handlers/config-handler.test.ts: ultrabrain config resolution
  and fallback (2 tests)
- shared/agent-variant.test.ts: sisyphus chain variant and category
  fallback (2 tests)
- shared/model-capability-guardrails.test.ts: built-in requirement
  model ID assertion (1 test)
- tools/look-at/multimodal-fallback-chain.test.ts: multimodal-looker
  hardcoded variant metadata (1 test)
- cli/config-manager/generate-omo-config.test.ts: sisyphus model and
  fallback_models expectations (2 tests)
2026-04-26 13:20:46 -06:00
lucasyounger 828c2634bd Fix #3629: resolve boulder progress from worktree plan 2026-04-25 16:34:34 +08:00
YeonGyu-Kim fbd4cfba9e Update OpenAI defaults to GPT-5.5 2026-04-25 00:41:32 +09:00
YeonGyu-Kim 708891dabe test: fix stale expectations after gpt-5.5 model promotion
Updates test expectations across agent, cli, shared, plugin, and tools tests

to match gpt-5.5 as the new default for oracle, hephaestus, and deep agents.

Includes snapshot updates for model-fallback tests.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-24 16:17:44 +09:00
柯杨 eaa3837d0b Merge remote-tracking branch 'origin/dev' into fix/cli-run-premature-exit-with-background-tasks 2026-04-22 09:45:56 +08:00
YeonGyu-Kim 3a6bd93252 fix(cli): keep mini-fast primary in openai-only install catalog
OPENAI_ONLY_AGENT_OVERRIDES was rewriting explore and librarian back to
gpt-5.4 medium for OpenAI-only installs. Match the runtime primary so the
install default stays on gpt-5.4-mini-fast.
2026-04-21 14:23:39 +09:00
YeonGyu-Kim ceadf4bdbc fix(cli): prefer mini-fast for install fallback
Default the install-time fallback chain to gpt-5.4-mini-fast for librarian and explore when OpenAI is available.\nKeep the snapshot and catalog tests aligned with the new resolution path.

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-21 13:30:02 +09:00
Sisyphus 017e4ef1c7 Merge pull request #3514 from andomeder/fix/cli-attach-auth 2026-04-19 02:38:19 +09:00
William Obino 69315fcad7 fix(cli): restrict attach auth injection to loopback URLs 2026-04-18 18:12:58 +03:00
William Obino ef5c74e972 fix(cli): inject server auth for attach clients 2026-04-18 17:49:05 +03:00