Skip to content

feat(providers): add omo provider sharing pi transcript pipeline - #362

Open
Guihal wants to merge 2 commits into
alexei-led:mainfrom
Guihal:feat/omo-provider
Open

Guihal wants to merge 2 commits into
alexei-led:mainfrom
Guihal:feat/omo-provider

Conversation

@Guihal

@Guihal Guihal commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

Adds omo (omo-ai on top of
@code-yeongyu/senpi, a Pi fork) as a first-class provider alongside Pi.

omo keeps Pi's JSONL v3 session format and TUI behaviour, so the provider
subclasses PiProvider and only overrides identity, state location and the
detection hints a JS launcher needs. Pi itself is untouched: its tests and the
_pi_sessions_dir module seam still behave exactly as before (tests monkeypatch
that seam, and they pass unchanged).

What changes

  • providers/omo.py — new OmoProvider: state dir, capability overrides, title
    detection.
  • providers/pi.py — session scanning factored into _scan_sessions, a
    provider_sessions_dir helper for forks, and the module seam preserved;
    PI_LIKE_PROVIDERS is the single authority for the pi-family rule.
  • providers/__init__.py — registration, omo in the basename table, transcript
    path inference, and the YOLO flag.
  • providers/process_detection.py — omo basename and @code-yeongyu/senpi
    path markers (agterm path).
  • session_protocol/messages.py — pi-family transcript parsing.
  • session_protocol/backend.py — structured history for the family, family
    follow-up, guarded history set.
  • session_protocol/actions.py, handlers/commands/forward.py, session_map.py
    — family follow-up validation, /clear + /followup aliases, replay.
  • config.py, handlers/agent_command.py, toolbar_config.py — default enabled
    providers, /agent keyboard, explicit toolbar layout mirroring Pi.
  • README.md, docs/providers.md — documented.

Behaviour notes

  • Agent dir: OMO_CODING_AGENT_DIR → SENPI_CODING_AGENT_DIR →
    PI_CODING_AGENT_DIR → ~/.omo/agent, matching omo's own resolution order
    (omo-ai/bin/lib/agent-dir.js).
  • Detection: the omo launcher is a JS entry point, so tmux reports
    pane_current_command=bun. The provider therefore requests the pane title on
    bun/node panes and matches omo's window title (OmO - <project>). A process
    named omo and the @code-yeongyu/senpi argv markers are recognised too.
  • YOLO: maps to --permission-preset full-access. CCGram launches in YOLO by
    default; without the flag the agent would stop on approval prompts that cannot
    be answered from Telegram.
  • Hooks: omo ships no cc-thingz hook runner, so supports_hook=False and
    ccgram doctor reports “hook check skipped”.
  • Model picker: /model prints the model list into the transcript rather than
    opening a modal, so model is not advertised in tui_picker_commands.

Testing

  • uv run ruff format --check src/ tests/ — clean
  • uv run ruff check src/ tests/ — clean
  • uv run pyright src/ccgram/ — 0 errors
  • uv run deptry src — no issues
  • uv run pytest tests/ -m "not integration and not e2e" — 8595 passed, 25 skipped
  • Manual check on a real tmux window running omo: detect_provider_from_pane
    and detect_provider_from_runtime both return omo, while a real pi argv still
    returns pi; discovery resolves omo sessions from ~/.omo/agent/sessions.

Update: exact window → session binding (2nd commit)

Newest-file discovery misbinds whenever another omo process writes into the
same cwd (probes, cron runs, a second window): the topic then tracks a file
that never grows and deliveries stall with a frozen watermark. omo records
ownership as session-holders/<session-id>/<pid>.json, so the provider now
resolves the window through its pane process tree instead: holder pid →
session id, parents walked up to 8 hops, stale holders rejected by comparing
processStartedAtMs with the live process start (5 s tolerance for pid
reuse). Falls back to the inherited newest-file scan when no holder matches.

Only src/ccgram/providers/omo.py changed in this commit (+153/-1); the
first commit is untouched.

Testing (2nd commit)

  • verify.py (local behavioural suite) — ALL CHECKS PASSED, incl. 7 new
    pid-binding checks (holder map, exact resolve, stale-holder rejection,
    foreign-pane rejection)
  • uv run pytest tests/ccgram/providers -m "not integration and not e2e" —
    847 passed, 23 skipped
  • uv run pytest tests/ccgram/session_protocol tests/ccgram/test_doctor_cmd.py tests/ccgram/test_config.py —
    637 passed
  • uv run ruff format --check src/ccgram/providers/omo.py — clean
  • uv run ruff check src/ccgram/providers/omo.py — clean
  • installed-tree gate: install.sh --status → applied, verify.py green

omo is an omo-ai distribution built on the @code-yeongyu/senpi fork of pi: sessions use the same JSONL v3 format and the TUI parser is compatible, so the provider subclasses PiProvider and only overrides identity, state location and detection hints.

Highlights: agent dir resolution OMO_CODING_AGENT_DIR > SENPI_CODING_AGENT_DIR > PI_CODING_AGENT_DIR; no hook runner so doctor skips hook checks; yolo mode maps to --permission-preset full-access; pane-title detection for bun/node panes because the launcher is a JS entry point; pi-family transcript parsing, follow-up, replay and /agent surfaces.
@archfit-review

archfit-review Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

✓ change → ● check

⚠️ Archfit: unknown, no verdict

Archfit could not check this pull request. The record below says what to do.

tool the check finished without an uploaded result

  • next: run the Archfit check again

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 2/5

[Medium impact] The changes extend provider selection and session workflows to omo.

Do not merge yet: the new backend call breaks the type check, and the typed-launch and shared-directory findings remain unresolved.

Findings

  1. P1 Type check fails ▶
  2. P1 Typed omo requests launch incorrectly ▶
  3. P1 Shared paths mislabel omo sessions ▶
  4. P2 Saved sessions slow polling ▶
  5. P2 Omo behavior lacks tests ▶

Summary

Adds omo as a Pi-family provider, sharing transcript parsing, history, follow-up commands, and resume support.

  • CCGram can launch omo and match each window to its session.
  • Omo sessions use Pi's transcript and follow-up workflows.

Reviews (2) · Last reviewed commit: "feat(providers): bind omo window to sess..." · Reviewed by Greptile

Comment thread src/ccgram/config.py
"antigravity",
"claude",
"codex",
"omo",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Typed omo requests launch incorrectly

Adding omo to the enabled providers does not add it to AGENT_ALIASES. In an unbound topic, omo /repo fix this is treated as an instruction for the default provider, not an omo launch. With a remembered project, CCGram can launch the wrong agent and send it the entire line. Add omo to the typed-plan aliases so this entry point recognizes the new provider.

Comment on lines +310 to +315
for marker, provider in (
("/.omo/agent/sessions/", "omo"),
("/.pi/agent/sessions/", "pi"),
):
if marker in normalized:
return provider

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Shared paths mislabel omo sessions

If PI_CODING_AGENT_DIR points to ~/.pi/agent and the omo-specific overrides are unset, omo uses Pi's session directory. This function always identifies that path as pi, and SessionMapSync replaces the correct omo claim with pi. The mismatch can hide history while omo runs and make Resume launch pi after it exits. Keep an explicit Pi-family provider claim when both providers can use the same store.

Comment on lines +44 to +49
class OmoProvider(PiProvider):
"""AgentProvider implementation for the omo coding agent CLI."""

def _sessions_dir(self) -> Path:
return provider_sessions_dir(
(_AGENT_DIR_ENV, *_AGENT_DIR_FALLBACKS), (".omo", "agent")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Omo behavior lacks tests

The new provider has no automated tests. Existing Pi tests do not cover omo's directory precedence, interpreter-title detection, capability overrides, or registration. Add focused omo tests, including negative title matches and shared-directory behavior, so these new branches cannot regress unnoticed.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Newest-file discovery misbinds when another omo process writes into the same cwd (probes, cron runs, a second window): the topic then tracks a file that never grows and deliveries stall with a frozen watermark. omo records ownership as session-holders/<session-id>/<pid>.json, so resolve the window through its pane pids instead: map holder pid to session id, walk parents up to 8 hops, and reject stale holders by comparing processStartedAtMs with the live process start (5s tolerance for pid reuse). Fall back to the inherited newest-file scan when no holder matches. Verified: local verify.py ALL CHECKS PASSED incl. 7 new pid-binding checks; providers suite 847 passed; session_protocol+doctor+config 637 passed; ruff format --check and ruff check clean.
# Lazy: the multiplexer is wired by bootstrap and absent in imports.
from ccgram.multiplexer import get_multiplexer

session = get_multiplexer("tmux").get_session()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Type check fails

_pane_pids calls get_session() on the result of get_multiplexer(), whose declared return type is Multiplexer. That interface has no get_session() method, so this call fails the required Pyright check and blocks CI. Expose the lookup through a typed interface, or narrow the backend type before calling its extra methods.

"""
holders: dict[int, str] = {}
try:
entries = sessions_dir.glob("*/session-holders/*/*.json")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Saved sessions slow polling

_holder_pid_map scans holder files for every project before checking which process belongs to this window. Discovery repeats on every poll, even after the session is already bound. With a large session history or several omo windows, these repeated reads delay updates for later windows, which are polled in order. Limit the scan to the relevant project and cache or bound the repeated work.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant