Commit Graph

622 Commits

Author SHA1 Message Date
YeonGyu-Kim 9dd0e14733 fix(bun-spawn-shim): match Bun.spawn semantics in Node fallback
Address cubic and oracle review feedback to make the Node/Electron
fallback faithful to Bun.spawn behavior so cross-runtime callers
behave identically.

Changes:
- resolveStdio() default stdio is now ["ignore", "pipe", "inherit"]
  to match Bun.spawn defaults (was ["pipe", "pipe", "pipe"]).
  Prevents hangs in dispatcher and on-complete-hook callers that
  did not explicitly set stdin and would otherwise wait forever
  for input on Node.
- spawn-with-windows-hide.ts uses the same defaults so the Windows
  Node helper aligns with the rest of the shim.
- wrapNodeProcess now rejects proc.exited with the original error
  on "error" events (previously swallowed the error and resolved
  to exit code 1, hiding ENOENT and friends).
- spawnSync result returns the real result.pid instead of -1 and
  exposes stdout/stderr as Buffer | undefined to match Node's
  spawnSync result shape when those streams are not piped.

Tests cover the new defaults, real pid surfacing, and missing
executable error propagation.

Refs cubic review and oracle audit on #3798.
2026-05-06 13:28:21 +09:00
YeonGyu-Kim f8defe2588 fix(node-runtime-compat): harden Bun spawn shim 2026-05-05 22:59:43 +09:00
YeonGyu-Kim 3ddc757b15 fix(bun-spawn-shim): eliminate globalThis.Bun top-level destructures for Electron/Node compat
Root cause: bun build --target bun inlines top-level
  var { spawn } = globalThis.Bun;
for every file that contains 'import { spawn } from "bun"'. On Node/Electron
where globalThis.Bun is undefined, this crashes with
  Cannot destructure property 'spawn' of 'globalThis.Bun' as it is undefined.
26 source files had this import; the bundled output had 25 top-level destructures.

Fix:
- Add src/shared/bun-spawn-shim.ts: a thin wrapper that
  - delegates to Bun.spawn/spawnSync when globalThis.Bun is present (real Bun)
  - falls back to static ESM imports of node:child_process otherwise
  - uses static 'import { spawn } from "node:child_process"' so Bun bundler
    does NOT emit any globalThis.Bun destructures for this module
- Replace all 26 'from "bun"' spawn/spawnSync imports with relative paths to shim
- Replace 4 direct Bun.spawn() call sites with shim's spawn()
- Remove src/electron-compat.ts and script/prepend-electron-shim.ts (no longer needed)
- Update src/electron-compat.test.ts to assert 0 top-level globalThis.Bun destructures

Verification: grep -c '} = globalThis.Bun;' dist/index.js → 0 (was 25)
All 5921 tests pass (1 pre-existing timeout failure unrelated to this change).

Fixes #3797
2026-05-05 22:41:45 +09:00
YeonGyu-Kim 7b28298b2a Merge pull request #3414 from garnetlyx/fix/sandbox-cache-availability-check
fix: use in-process flag instead of existsSync for cache availability
2026-05-04 23:58:19 +09:00
YeonGyu-Kim 3ae9f5f104 fix(background-agent): prevent false task completion on status API outage
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-04 16:30:06 +09:00
YeonGyu-Kim 1a881b374e test(agents): cover OpenCode Agent.list sort with runtime-name prefixes
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-05-04 01:44:07 +09:00
YeonGyu-Kim 92dab9285c refactor(telemetry): narrow PostHog client and mark omo_daily_active anonymous 2026-05-02 00:11:01 +09:00
YeonGyu-Kim b8a5f27dee refactor(telemetry): drop plugin_loaded capture from plugin entry 2026-05-02 00:10:59 +09:00
YeonGyu-Kim bae62ab582 fix(agents): allow Momus and Metis delegation
Keep Momus and Metis read-only for file edits while allowing task-based invocation for planning review workflows.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-01 19:27:25 +09:00
YeonGyu-Kim f7270a0f97 fix(model-error-classifier): scope forbidden-provider retry to specific phrase
Bare "403" and "forbidden" substring patterns (added in 034744cb to
retry the "Selected provider is forbidden" case from PR #3706) matched
any error message containing those tokens — tool-level 403s, file-perm
"forbidden" messages, unrelated upstream errors that happened to spell
"forbidden". The legacy model-fallback path then armed setPendingModelFallback
on those unrelated errors, jumping Sisyphus to claude-opus-4-7 (first
entry of its fallback chain) regardless of the user's configured model.

Replace the bare patterns with the specific phrases PR #3706 actually
targeted, and add regression tests asserting unrelated 403/forbidden
messages stay non-retryable.

Reported-by: ilove_borshch on Discord (#omo-help)
2026-05-01 01:25:01 +09:00
Choi Kijin / 최 기진 / チョイ キジン 7adb725960 Merge remote-tracking branch 'origin/dev' into fix/retry-recovery-and-observability 2026-04-29 12:25:02 +09:00
YeonGyu-Kim ece8fd4f25 perf(shared): cache context window usage per session
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-28 17:59:25 +09:00
Choi Kijin / 최 기진 / チョイ キジン 3fc9e6bafd Merge remote-tracking branch 'origin/dev' into opencode/mighty-wolf 2026-04-28 15:47:58 +09:00
Choi Kijin / 최 기진 / チョイ キジン 25548f2561 fix(model-fallback): retry forbidden provider errors
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-28 15:29:33 +09:00
YeonGyu-Kim 669e0667be fix(telemetry): dedupe plugin_loaded event to once per UTC day
The plugin_loaded event was emitted on every plugin reload, generating
high event volume on PostHog (proportional to opencode restarts per
user per day). With MAU > 60K and active power users restarting
frequently, this drove unnecessary event spend.

Add a separate daily dedup state field (lastPluginLoadedDayUTC) so the
plugin_loaded capture only fires once per UTC day per machine. The
existing daily activity dedup (lastActiveDayUTC, used by
omo_daily_active) is preserved as an independent gate so the two
dimensions cannot overwrite each other in the activity state file.
2026-04-28 15:01:40 +09:00
YeonGyu-Kim 58e4b8f519 fix(telemetry): remove PostHog HAU tracking, keep DAU only 2026-04-28 14:51:33 +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 dffe5a305b feat(agents): add narrowly-scoped agent sort shim and install at plugin entry
OpenCode 1.4.x ignores the agent `order` field (sst/opencode#19127), so its
`Agent.list()` sorts purely by `agent.name` via Remeda `sortBy` which uses
native string `<`/`>` comparison. Without intervention, the four core agents
fall into alphabetical order (Atlas -> Hephaestus -> Prometheus -> Sisyphus),
which is not the canonical sisyphus -> hephaestus -> prometheus -> atlas order
the project ships.

Prior attempts to bias the sort key with invisible characters (ZWSP,
U+2060 WORD JOINER, U+00AD SOFT HYPHEN, ANSI escape) all caused
`Bun.stringWidth()` vs terminal-width drift, producing visible gaps and
column truncation in the TUI status bar (#3259, #3238).

Solution: a narrowly-scoped shim of `Array.prototype.toSorted` and
`Array.prototype.sort` that activates only when the array contains two or
more agent objects whose `.name` matches a canonical core display name.
The activation predicate guards against mixed-type arrays so unrelated
`.sort()` / `.toSorted()` calls (string arrays, number arrays, mixed
objects) execute native behavior unchanged. Install is idempotent.

Cubic P1 mitigations from PR #3267:
- `isAgentArray` rejects any array with non-object or null elements,
  eliminating the throw-on-mixed-array failure mode.
- Strict activation predicate (>= 2 ranked elements) keeps the global
  prototype patch from affecting unrelated sort calls.

Remove this shim once OpenCode honors the agent `order` field
(sst/opencode#19127).

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 18:55:33 +09:00
YeonGyu-Kim a46b7b8240 fix(file-reference-resolver): expand env vars in path references
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 17:45:27 +09:00
YeonGyu-Kim a835fefea5 Merge pull request #3665 from code-yeongyu/fix/posthog-arch-cpus-crash
fix(posthog): guard os.cpus() against Bun /sys/firmware permissions error (fixes #3496)
2026-04-27 17:31:00 +09:00
YeonGyu-Kim 71c29c8fe0 fix(model-capabilities): disable thinking for minimax and non-thinking kimi
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 17:15:56 +09:00
YeonGyu-Kim d1bc25a6ce fix(posthog): guard CPU telemetry collection
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-27 17:14:00 +09:00
YeonGyu-Kim 1da7df1aee Revert "Merge pull request #3657 from code-yeongyu/refactor/replace-zwsp-with-real-spaces"
This reverts commit f1a11f2c92, reversing
changes made to 62c19ce0ef.
2026-04-27 15:54:05 +09:00
YeonGyu-Kim 9823462994 Merge pull request #3661 from code-yeongyu/fix/doctor-heuristic-model-status
fix(doctor): suppress resolved model capability warnings
2026-04-27 15:44:38 +09:00
YeonGyu-Kim 8e785963cf fix(model-capabilities): recognize current provider aliases
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
YeonGyu-Kim f100a8565b fix(agents): keep object keys clean by separating list display from runtime name
Discovered via post-implementation review (Oracle goal verification): the
prior commit's prefix swap (ZWSP -> ASCII spaces) inherited a pre-existing
architectural bug from the ZWSP era. `getAgentListDisplayName()` was an
alias for `getAgentRuntimeName()`, which meant every callsite that used
the "list display" name as an OBJECT KEY (config.agent keys, lookup keys,
HTTP-header-bound paths) ended up carrying the sort prefix.

This worked silently with ZWSP because zero-width characters are visually
invisible. With ASCII space prefixes, the same bug becomes user-visible
and violates the explicit RFC 7230 constraint documented in AGENTS.md:
"ZWSP MUST NOT appear in object keys (used as HTTP header values)."

Fix: separate the two concepts that were conflated.

- `getAgentListDisplayName(key)` now returns the CLEAN display name
  (alias of `getAgentDisplayName`). Used for object keys, config keys,
  and any path where the name will be sent over HTTP.
- `getAgentRuntimeName(key)` keeps its prefixed return value. Used ONLY
  for the `.name` field that OpenCode reads for `localeCompare` sort.

`agent-key-remapper.ts` was already correct: it uses `getAgentRuntimeName`
for the `.name` field. The bug was that `getAgentListDisplayName` (used
as the object key) also returned the prefix.

Test updates:
- agent-display-names.test.ts splits the assertions: getAgentListDisplayName
  asserts clean names, new getAgentRuntimeName describe asserts prefixes
- All other tests using getAgentListDisplayName as an expected object key
  continue to pass because they always wanted clean names

Verification:
- bun test: 5769 pass / 10 pre-existing failures (unchanged)
- bun run typecheck: clean
- Manual: agent-key-remapper output keys verified RFC 7230 safe (no
  leading whitespace, no ZWSP); name fields preserve descending-space
  prefix for canonical core agent ordering
2026-04-27 15:30:20 +09:00
YeonGyu-Kim 0e9bb5969d refactor(agents): replace broken ZWSP sort prefixes with leading ASCII spaces
The ZWSP-based core agent sort prefixes silently failed to produce the
canonical sisyphus -> hephaestus -> prometheus -> atlas order.

Empirical testing of OpenCode's Agent.list() sort behavior shows that
Unicode collation treats zero-width characters as ignorable at the primary
level, so ZWSP-prefixed names sorted alphabetically with non-core agents
interleaved (e.g. Sisyphus, athena, Atlas, explore, Hephaestus, ...).

This commit replaces the ZWSP prefixes with leading ASCII spaces in
descending lengths (sisyphus=4, hephaestus=3, prometheus=2, atlas=1).
ASCII spaces sort reliably before alphabetic characters in localeCompare
under all locales and render correctly in every terminal.

Changes:
- AGENT_LIST_SORT_PREFIXES: ZWSP -> leading spaces (4-3-2-1 descending)
- stripAgentListSortPrefix: now strips both legacy ZWSP and new leading
  whitespace, preserving backward compatibility with existing sessions
- normalizeStoredAgentName / normalizeRegisteredAgentName: extract a
  shared stripSortPrefix helper that handles both prefix formats
- agent-config-handler: resolve user-provided default_agent display
  names through getAgentConfigKey before applying the runtime prefix,
  so configs like default_agent="Hephaestus - Deep Agent" are normalized
- agent-runtime-name-sort.test.ts: new regression test simulating
  OpenCode's exact sortBy logic (default_agent desc + name asc localeCompare)
  to verify canonical core agent order under randomised input permutations
- AGENTS.md: document the empirical finding that ZWSP was broken, why
  ASCII spaces work, and the descending prefix-length contract

Existing strip functions retain ZWSP support so legacy session state and
configs continue to resolve correctly without migration.
2026-04-27 13:48:09 +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
YeonGyu-Kim 33ac355645 Preserve migration history during config migration 2026-04-25 00:41:32 +09: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
YeonGyu-Kim 6b46b9b4be fix(model-capabilities): add gpt-5.5 capability snapshot
Adds missing capability entry for gpt-5.5 to supplemental-entries.ts.

This model was promoted as default for oracle, hephaestus, and deep agents,

but the capability snapshot was missing, causing resolution failures.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-24 16:17:37 +09:00
YeonGyu-Kim 3875b40c17 feat(migration): auto-upgrade openai/gpt-5.4 to openai/gpt-5.5
Now that oracle, hephaestus, and the deep category ship gpt-5.5-native
prompts and default to gpt-5.5 in their fallback chains, user configs
that pin openai/gpt-5.4 should follow the same upgrade on next load.

The existing migration pipeline (migrateModelVersions) picks this up
automatically from MODEL_VERSION_MAP, records the upgrade in the
sidecar file to stay idempotent, and leaves gpt-5.4-mini / -mini-fast
/ -nano alone since those cost-tier variants are intentional picks
and do not have direct gpt-5.5 counterparts yet.
2026-04-24 13:13:14 +09:00
YeonGyu-Kim 3bab66b96c feat(models): promote gpt-5.5 as default for oracle, hephaestus, and deep
Now that each of these agents ships a native gpt-5.5 prompt variant,
their default OpenAI model is bumped from gpt-5.4 to gpt-5.5. The
gpt-5.4 entries are removed from the same-provider position in each
fallback chain (a single provider doesn't need both version entries -
if gpt-5.5 isn't available there, cross-provider fallback kicks in).

- oracle.fallbackChain: gpt-5.5 high (openai) -> gemini-3.1-pro -> claude -> glm
- hephaestus.fallbackChain: gpt-5.5 medium (openai only, requiresProvider)
- deep category.fallbackChain: gpt-5.5 medium -> claude -> gemini
- deep category.config: openai/gpt-5.5 medium

No changes to sisyphus, sisyphus-junior, ultrabrain, momus, or other
agents that still point at gpt-5.4; those stay on the shared regex-
based routing in the gpt-5-4 prompt family.
2026-04-24 13:06:50 +09:00
Choi Kijin / 최 기진 / チョイ キジン 034744cbf2 fix(model-error-classifier): retry forbidden provider errors
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-22 18:38:38 +09:00
YeonGyu-Kim fe44363bf8 fix(model-capabilities): drop pdf modality from gpt-5.4-mini-fast
OpenAI's mini-fast variant only accepts text and image input; advertising
pdf risks unsupported requests hitting runtime errors.
2026-04-21 13:38:23 +09:00
YeonGyu-Kim d2e5ddd73d fix(model-requirements): route primary agents to mini-fast
Use gpt-5.4-mini-fast as the primary runtime model for librarian and explore.\nKeep the fallback chain intact so older providers still resolve.

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-21 13:29:55 +09:00
YeonGyu-Kim 680dd161b4 fix(model-capabilities): bundle gpt-5.4-mini-fast caps
Keep the supplemental OpenAI model available when the bundled snapshot omits it.\nMerge its capabilities at runtime so downstream model resolution can use it.

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-21 13:29:49 +09:00
Sisyphus 017e4ef1c7 Merge pull request #3514 from andomeder/fix/cli-attach-auth 2026-04-19 02:38:19 +09:00
William Obino ef5c74e972 fix(cli): inject server auth for attach clients 2026-04-18 17:49:05 +03:00
YeonGyu-Kim e35ac38bbf test(tmux): rewrite stale-sweep tests via DI to eliminate cross-file mock leak
Oracle flagged that the previous test file monkey-patched process.kill
and relied on mock.module for 5 modules. Running it after manager.test.ts
in the same Bun process reproduced 2 failures - the test resolution of
`./session-kill` specifier interacted badly with manager.test.ts's
`../../shared/tmux` barrel mock.

Solution: refactor stale-session-sweep.ts to expose
`sweepStaleOmoAgentSessionsWith(deps)` that accepts a SweepDeps record
(isInsideTmux, getTmuxPath, listCandidateSessions, killSession,
processAlive, currentPid, log). The public `sweepStaleOmoAgentSessions()`
still uses runtime-built deps so call sites are unchanged.

The test file now imports the pure function directly and constructs a
fixture with fake deps. Zero mock.module calls, zero process.kill
patching, zero cache-bust dynamic imports. 8 tests (up from 6) run
deterministically in any order with any neighbor.

Before: combined run with manager.test.ts = 2 fail, 50 pass.
After:  combined run with manager.test.ts = 0 fail, 54 pass.
2026-04-18 21:00:34 +09:00
YeonGyu-Kim d1fc46da42 test(tmux): restore process.kill in afterEach to prevent cross-file leak
Oracle noted that loadSweeper() monkey-patches process.kill without
ever restoring it. Added afterEach hook to set process.kill back to the
captured original. Individual file runs already passed, and
script/run-ci-tests.ts confirms the full CI suite - 4781 pass, 0 fail
across 491 files - but this makes the test file safe under non-isolated
local runs as well.
2026-04-18 20:51:24 +09:00
YeonGyu-Kim 104523051d feat(tmux): sweep stale omo-agents-<pid> sessions on first spawn
Follow-up to PR #3507 addressing the Oracle-noted operational limitation:
per-PID isolated session names (getIsolatedSessionName(process.pid)) mean
that when an opencode process is SIGKILL'd (or the machine hard-reboots),
the old omo-agents-<old-pid> tmux session survives forever because nothing
is around to kill it.

Added sweepStaleOmoAgentSessions() that:
1. Lists tmux sessions matching /^omo-agents-(\d+)$/
2. For each, checks process.kill(pid, 0) to detect a dead PID
3. Skips our own PID
4. Calls killTmuxSessionIfExists for every session whose owner process is gone

Wired into TmuxSessionManager.onSessionCreated() as a one-shot (guarded by
staleSweepCompleted flag) so it runs lazily on the first subagent spawn when
isolation="session". The flag is reset in cleanup() so subsequent process
restarts re-run the sweep.

6 new tests cover: outside-tmux no-op, no matching sessions, multiple dead
PIDs, current PID skip, live PID skip, list-sessions failure.

Manual E2E verified on real tmux:
- Created omo-agents-99999, sweep killed it
- Spawned our own omo-agents-<pid>, closeTmuxPane returned true even after
  pane auto-destroy from Ctrl+C
- Final tmux list-sessions shows zero omo-agents-* orphans
2026-04-18 20:22:00 +09:00
YeonGyu-Kim 257b6cf951 fix(tmux): scope isolated session name per plugin instance (Oracle review)
Oracle flagged the previous commit: "omo-agents" was a shared constant,
so when two plugin instances ran in the same tmux server they wrote into
the same session. One instance's cleanup would then kill-session on the
shared name and tear down the other instance's live attached panes.

Replace the const ISOLATED_SESSION_NAME with getIsolatedSessionName(pid)
which defaults to process.pid, so every opencode process owns its own
"omo-agents-<pid>" session. spawnTmuxSession and cleanup both resolve
the name through this helper. Discovery is straightforward from the
host tmux via 'tmux list-sessions | grep omo-agents-'.

Manager test covers two concurrent managers and asserts each kills a
per-pid session name, proving they no longer collide on a global name.
2026-04-18 19:47:36 +09:00
YeonGyu-Kim ea4f3c81f4 fix(tmux): treat pane-already-closed as success in closeTmuxPane
After send-keys C-c the subprocess running inside the pane (for example
"opencode attach") exits on SIGINT, which causes tmux to destroy the
pane automatically. The subsequent kill-pane then returns exit 1 with
stderr "can't find pane: %NN" even though the end state is exactly
what we wanted.

Before this fix closeTmuxPane reported failure for that branch, which
kept TmuxSessionManager's retryPendingCloses loop marking the (now
deleted) pane as still-pending forever and left stale entries behind
in the tracked sessions map. This is the behavior the user observed
as "screen opens, streaming runs, but cleanup doesn't finish" when
running with tmux.isolation="session".

Now we detect the "can't find pane" stderr and return true, treating
the auto-destroy path the same as an explicit successful kill.
2026-04-18 19:34:54 +09:00
YeonGyu-Kim de8a0167e6 feat(tmux): add killTmuxSessionIfExists utility for explicit session teardown
Adds killTmuxSessionIfExists(sessionName), a best-effort no-op when the
named session is absent. Drains both stdio streams so it does not leak
pipe buffers the way closeTmuxPane historically did.

Also exports ISOLATED_SESSION_NAME ("omo-agents") from session-spawn so
callers can tear down the shared isolated session without hard-coding
the name in multiple places.
2026-04-18 19:31:22 +09:00
YeonGyu-Kim 2a99a524ea fix(tmux): drain kill-pane stdout to prevent pipe backpressure hang
closeTmuxPane spawned kill-pane with stdout: "pipe" but never drained the
stream, which could leave the subprocess hanging indefinitely when tmux
wrote anything to stdout (for example under --force-close race conditions).

- send-keys now uses stdout: "ignore" so there is no pipe to drain
- kill-pane keeps the pipe but drains stdout/stderr alongside proc.exited
- switch imports to the new spawn-process helper so the behavior is
  covered by hermetic tests that mock the spawn boundary
2026-04-18 19:31:04 +09:00
Sisyphus e47a6aa7f6 Merge branch 'fix/perf-q10' into fix/perf-omo-in-tree 2026-04-18 14:43:37 +09:00
Sisyphus 38990ec76f Merge branch 'fix/perf-q02' into fix/perf-omo-in-tree 2026-04-18 14:43:37 +09:00
YeonGyu-Kim 6dc2234d89 fix(shared): memoize detectPluginConfigFile per process
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-18 14:12:55 +09:00