Skip to content

feat(cli): orca search over the agent session index - #20514

Merged
Jinwoo-H merged 9 commits into
mainfrom
session-search-pr6-cli
Sep 16, 2026
Merged

Jinwoo-H merged 9 commits into
mainfrom
session-search-pr6-cli

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1057 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1050
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​522 $\color{#cf222e}{\Huge{\mathbf{−}}}$​30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​492

ELI5

You can now find an old agent conversation from the terminal. Type orca search "that resize bug" and Orca prints the sessions whose transcripts mention it, one line each, with the snippet that matched underneath. orca search --index-status tells you how much of the index has been built.

What Changed

orca search over PR 5's session-search contract. It calls aiVault.searchSessions and aiVault.searchStatus on the CLI's existing runtime RPC client, against the host --environment / --pairing-code selects and no other. One host per invocation, no fan-out. In an Orca SSH terminal, the forwarded CLI defaults to the controlling Orca runtime's index. --path filters results on the selected runtime; it does not select the SSH host.

Flags map one-to-one onto the contract request and add nothing it does not have:

Flag Contract field
positional <query>, or --query query
--scope conversation|all scope
--fresh freshness: 'wait-until-current'
--limit <n> limit
--cursor <c> cursor
--agent <id> (repeatable) filters.agents
--path <p> (repeatable) filters.scopePaths
--since <iso> filters.since
--sort relevance|newest filters.sort
--debug debug: true
--index-status aiVault.searchStatus

Exit codes:

Outcome Exit
results, including zero hits 0
unavailable (disabled, not-ready, no-service) 0
stale-cursor 0
bad input, malformed-cursor, transport failure 1

Supporting changes:

  • CommandSpec.repeatableFlags and a third specs argument to parseArgs. Repeatability is per-command vocabulary: --agent must repeat for search and stay single-valued for worktree create, which one global set cannot express. Every other command keeps last-wins, and there is a test for that.
  • --fresh, --debug and --index-status join the global boolean-flag set. None of the three collides with an existing flag.
  • skills-command-flag-help.ts becomes command-scoped-flag-help.ts and carries both the skills and the search tables. help.ts was sitting exactly on its max-lines limit, so this keeps the call site the same size instead of adding a disable.
  • One bullet in docs/reference/agent-session-search-contract.md naming the CLI boundary.

Why

PR 5 shipped the contract with no consumer. The CLI is the cheapest proof that the API answers without a panel, which is the test question behind reviewer finding F3, and it is the form an agent can drive today.

Three shape decisions worth reviewing:

One command, not a search status subcommand. The query is a bare positional, so orca search status cannot be told apart from searching for the word "status". --status is also unavailable, because orchestration task-list --status <state> already owns that name as a valued flag and the boolean set is global. --index-status is unambiguous and reads correctly next to the existing orca status. The query is also accepted as --query, which is how linear search and repo search-refs already spell it.

No new runtime capability, and RemoteRuntimeCompatGate is untouched. PR 5 decided that an explicit -32601 / method_not_found refusal maps to unavailable/no-service. Reusing createSessionSearchClient gives that for free, so an old host gets a plain sentence rather than a raw JSON-RPC error. It also applies the same exposure policy the host applied: a paired runtime is a relay caller and gets no resume command or source path. Verified end to end below.

--json keeps the CLI envelope. The contract answer sits verbatim under result. --json failures already print { ok: false, error } through reportCliError, so a bare contract object on success would leave an agent with two different success signals.

[[ ]] marks pass through unchanged. The CLI emits no ANSI anywhere in its output, so a highlight scheme invented here would be the only one in the surface. Transcript text is still stripped of escape and control bytes before printing, so an OSC 52 sequence in a tool log cannot reach the reader's terminal.

Linked Issue

Part of the session-search stack, consuming the contract and transport from #20277. This PR targets main.

Fixes #

Visual Proof

A result page, from the handler test's fake response:

Claude  2026-09-12T18:04:11.000Z  Terminal resize race  host=ssh:build-01
    assistant: the [[resize]] handler drops the first event
    resume: claude --resume session-1

1 result on this page, 18 ms.
more pages: re-run with --cursor eyJ2IjoxfQ

Truncation flags in words, and a hit with no text evidence:

Claude  2026-09-12T18:04:11.000Z  Terminal resize race on Windows  host=ssh:build-01
    assistant: the [[resize]] handler drops the first event
    resume: claude --resume session-1
Codex  unknown time  Index sweep budget
    no text evidence for this match

2 results on this page, 18 ms.
more pages: re-run with --cursor eyJ2IjoxfQ
ranking saw only the first batch of candidate sessions, so a better match may be missing
freshness wait timed out; these results come from the index as it stood
2 snippets were shortened

An unavailable / disabled answer, which exits 0 because it is an answer:

$ orca search "kernel panic"
Session search is off on this host.
$ echo $?
0

The built CLI against a live released Orca host that predates PR 5, which is the old-host path:

$ node out/cli/index.js search "resize race"
This host runs no session search service.
An Orca host older than session search answers the same way; update it and try again.
$ echo $?
0

$ node out/cli/index.js search --index-status
enabled: false
phase: idle
filesIndexed: 0
filesDue: 0
filesFailed: 0
lastReconcileAt: never
lastSweepCompletedAt: never
generation: 0
degradedRoots: 0

Bad input, from the same built binary:

$ node out/cli/index.js search q --scope files
Unsupported --scope "files". Use conversation or all.            # exit 1
$ node out/cli/index.js search q --since 2026-08-01
Invalid --since "2026-08-01". Use an ISO 8601 timestamp with an offset, for example 2026-08-01T00:00:00Z.   # exit 1
$ node out/cli/index.js search q --index-status
--index-status reports on the index and takes no query, so it cannot be combined with --query.   # exit 1

Testing

Latest parser refactor validation on macOS: 1,309 CLI tests passed, including nested-command and alias regression coverage; CLI typecheck and changed-code quality checks passed. A temporary comparison against the previous parser passed across the command registry and flag placements. The final availability/help wording changes passed all 59 affected tests.

79 new tests across four files: spec and help registration (13), argument parsing including every flag, repeatables and bad values (29), text rendering for results, unavailable, stale-cursor, truncation, debug and status (18), and the handler against a fake ctx.client that records method and params per flag combination (19).

Gates, all exit 0 on macOS:

  • pnpm tc, pnpm run tc:cli
  • pnpm test src/cli src/main/startup src/shared: 9,608 passed, 124 skipped, 885 files
  • pnpm run check:code-quality:changed and pnpm run check:react-doctor:changed against the PR base: 0 new findings across 19 files
  • pnpm run audit:code-quality:type-aware
  • pnpm build:cli, then the built out/cli/index.js run against a live local Orca host

Cross-platform: no shell assumptions in the output, paths printed exactly as the host sent them, times printed as ISO 8601. The --path filter is a literal execution-host path and is never expanded or resolved against the current directory, so a Windows path survives a macOS caller.

Not tested: Linux, Windows, and a live SSH or paired-server host. No index exists in production until PR 3b constructs the service, so every live run here took the no-service path. The result-page rendering above is from test fixtures, not a real index.

Known rough edge, not fixed: an unquoted multi-word query (orca search strict mode violation) fails with a bare "Unknown command". Every other positional command behaves the same way. The command notes tell the reader to quote, and --query is accepted; a variadic trailing positional would be a shared-parser change no other command has asked for.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: transcript text is stripped of ANSI escape and C0/C1 control bytes before printing, so a hostile tool log cannot drive the reader's terminal. The client re-applies redactForTransport, so a paired runtime's hits carry source presence only, with no filePath, codexHome, or resumeCommand.

Backwards compatibility: no wire change. No new RPC method, no new stream opcode, no new capability. An old host's refusal becomes unavailable/no-service, which is the behaviour PR 5's contract already specifies.

Performance: one RPC per invocation. The parser collects flag entries in order, resolves the command-specific repeatability rules once, then combines the entries. No lookahead or mutable spec cache is needed.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

`orca search <query>` calls PR 5's `aiVault.searchSessions` over the CLI's
existing runtime RPC, against the host `--environment` / `--pairing-code`
selects and no other. `orca search --index-status` calls `aiVault.searchStatus`.
It is the proof the contract works with no panel.

Every flag maps onto a contract field and nothing else: `--scope`, `--fresh`,
`--limit`, `--cursor`, repeatable `--agent` and `--path`, `--since`, `--sort`,
`--debug`, `--json`. No fan-out, no merged output, no `--host`.

One command rather than a `search status` subcommand: the query is a bare
positional, so `orca search status` could not be told apart from searching for
the word "status". `--status` is unavailable because `orchestration task-list
--status <state>` already owns the name as a valued flag.

No new runtime capability. PR 5 decided an explicit `method_not_found` refusal
maps to `unavailable/no-service`, so reusing `createSessionSearchClient` gives
an old host a plain "this host runs no session search service" answer at exit 0
instead of a raw JSON-RPC error.

`CommandSpec.repeatableFlags` scopes repeatability per command, because
`--agent` must repeat for search and stay single-valued for `worktree create`.
`help.ts` sat exactly at max-lines, so `skills-command-flag-help.ts` becomes
`command-scoped-flag-help.ts` carrying both tables at the same call-site size.
…w rejects

Main gained a `consistent-type-assertions: never` scan in the changed-code gate
after this branch was cut, and it reported twelve assertions in the new files.

The four in the argument parser were avoidable. `readEnum` now keeps the value
`find` returns, which already carries the narrow type, and the agent filter goes
through an `isAiVaultAgent` predicate over a `Set<string>` instead of widening
the agent tuple.

The test now narrows the printed envelope by shape and re-reads the printed
result through `AiVaultSearchResponseSchema`, so the JSON assertions are checked
rather than claimed, and the flag table is typed so its callback needs no cast.
One assertion is left, for the structural fake client, with the SAFETY rationale
AGENTS.md requires.
@Jinwoo-H
Jinwoo-H force-pushed the session-search-pr6-cli branch from 276c181 to 1c9cc44 Compare September 13, 2026 22:14
@Jinwoo-H
Jinwoo-H changed the base branch from session-search-pr5-contract to main September 13, 2026 22:14

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The text formatter sanitizes transcript text but not every host-supplied string it prints. updatedAt and executionHostId reach the terminal raw, which contradicts the security property the PR describes.

Reviewed changes

  • orca search command — new src/cli/specs/search.ts, src/cli/search-command-arguments.ts, src/cli/handlers/search.ts, and src/cli/agent-session-search-format.ts. Flags map one-to-one onto PR5's aiVault.searchSessions/searchStatus; the handler reuses createSessionSearchClient, so an old host's method_not_found becomes unavailable/no-service and the paired-caller exposure policy is applied.
  • Command-scoped repeatable flags — CommandSpec.repeatableFlags and a third specs argument to parseArgs (specForPathPrefix + a depth-memoised repeatableFlags), so --agent/--path repeat for search while label/skill keep their global repeatability.
  • Global boolean flags — debug, fresh, index-status added to CLI_BOOLEAN_FLAGS; no existing command used them.
  • Help/discovery plumbing — skills-command-flag-help.ts becomes command-scoped-flag-help.ts, plus root help entries, handler-group registration, CLI_COMMAND_NAMES, and the contract doc bullet.

I traced two cross-cutting risks and both came back clean: orca search does not reach the SSH legacy formatRemoteCli (healthy hosts use the host-CLI passthrough; the legacy dispatcher rejects search outright rather than printing raw JSON), and the parser change does not alter any existing command's behavior (label/skill remain repeatable via the union, and no existing spec names the three new booleans).

Technical details
# Unsanitized host strings in the text output

## Affected sites
- `src/cli/agent-session-search-format.ts:36-41` — the hit header interpolates `hit.updatedAt` and `hit.executionHostId` directly; both are `z.string()` in `AiVaultSearchHitSchema` (`src/shared/ai-vault-search-contract.ts:34,44`) with no escape/control-byte constraint.
- `src/cli/agent-session-search-format.ts:71` — `debug.repairedTerms.join(' ')` is printed raw.

## Required outcome
Every host-supplied string that reaches stdout should pass through `terminalSafe` / `oneLine`, exactly as `title`, `evidence.snippet`, `resumeCommand`, and the status root/reason already do. An OSC 52 or cursor sequence in `updatedAt`/`executionHostId`/`repairedTerms` should not reach the reader's terminal.

## Suggested approach
Wrap `hit.updatedAt` and `hit.executionHostId` in `terminalSafe` (they are single-line fields), and run `repairedTerms` through `oneLine`.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/cli/agent-session-search-format.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ Incremental review of the new commit — no new issues. The earlier terminal-sanitization finding is unchanged and still open.

Reviewed changes

  • refactor(cli): drop the search type assertions — src/cli/search-command-arguments.ts (readEnum keeps the value find returns, which already carries TValue, and agent filtering goes through an isAiVaultAgent predicate over a Set<string>) and src/cli/handlers/search.test.ts (typed flagCases, plus printedEnvelope/printedResults helpers that narrow the printed JSON by shape and re-read it through AiVaultSearchResponseSchema). Behavior-preserving; the JSON assertions are stronger than the casts they replace, and the one remaining as never carries the required SAFETY: rationale.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6520ec98-092e-4fc6-b0ba-85e62c0a2a41

📥 Commits

Reviewing files that changed from the base of the PR and between a211210 and 8f8d2e3.

📒 Files selected for processing (4)
  • src/cli/agent-context.test.ts
  • src/cli/agent-context.ts
  • src/cli/specs/search.test.ts
  • src/cli/specs/search.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Adds the hidden orca search command with query, filter, pagination, freshness, debug, and index-status options. Adds command-scoped repeatable flag parsing and validation. Connects the command to runtime search handlers and formatted text or JSON output. Adds terminal-safe rendering, runtime exposure rules, help integration, hidden-command discovery behavior, routing documentation, and comprehensive tests.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 8f8d2

The hidden session-search CLI behavior has no established merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 36 functions across 22 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding orca search support for the agent session index.
Description check ✅ Passed The description is detailed and mostly complete. It includes the ELI5 summary, changes, rationale, testing, visual behavior examples, security and compatibility notes, and checklist completion. It ref…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5f9d7535-bc97-4a3e-a411-45b61d6f14e8

📥 Commits

Reviewing files that changed from the base of the PR and between 2fc84cb and 1c9cc44.

📒 Files selected for processing (21)
  • docs/reference/agent-session-search-contract.md
  • src/cli/agent-session-search-format.test.ts
  • src/cli/agent-session-search-format.ts
  • src/cli/args.ts
  • src/cli/command-scoped-flag-help.ts
  • src/cli/command-spec.ts
  • src/cli/handler-group-manifest.ts
  • src/cli/handlers/search.test.ts
  • src/cli/handlers/search.ts
  • src/cli/help.ts
  • src/cli/index.ts
  • src/cli/root-help-text-primary.ts
  • src/cli/root-help-text-secondary.ts
  • src/cli/search-command-arguments.test.ts
  • src/cli/search-command-arguments.ts
  • src/cli/skills-command-flag-help.ts
  • src/cli/specs/index.ts
  • src/cli/specs/search.test.ts
  • src/cli/specs/search.ts
  • src/main/startup/cli-command-names.ts
  • src/shared/cli-argument-boundary.ts
💤 Files with no reviewable changes (1)
  • src/cli/skills-command-flag-help.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/cli/agent-session-search-format.ts Resolved
Comment thread src/cli/args.ts Resolved
@Jinwoo-H Jinwoo-H closed this Sep 13, 2026
@Jinwoo-H Jinwoo-H reopened this Sep 13, 2026
Route every host-supplied string the search formatter prints through the
escape stripper, and resolve the repeatable-flag set from the command
tokens ahead when a flag sits before the command.
@pullfrog

pullfrog Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

the model provider had a temporary upstream failure.

The provider refused or dropped the request mid-run — nothing in your repo or your credentials is at fault. Re-trigger Pullfrog; if it keeps happening, check the provider's status page.

provider error: {"code":502,"message":"Upstream error from Together: Stream error: h2 protocol error: error reading a body from connection","metadata":{"error_type":"provider_unavailable"}}

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Sanitized the remaining host-supplied strings — agent-session-search-format.ts now routes the hit updatedAt and executionHostId, the next-page cursor, each repairedTerms entry, and the degraded root/reason through oneLine, closing the only outstanding finding. The new escape-sequence tests cover each field, and both agent-session-search-format.test.ts and search-command-arguments.test.ts pass locally (59 tests).
  • Scoped repeatable flags across the command boundary — parseArgs now derives the command scope from the tokens at findCliCommandIndex when no command path has been read yet, so --agent/--path placed before search still repeat while a pre-command --agent stays single-valued for worktree create. Tests cover both directions.

Enum-constrained fields (agent, route, plannerScope, phase, evidence role) and fixed messages remain deliberately unsanitized; the earlier SSH/legacy-formatter and parser-regression traces still hold.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog

pullfrog Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

the model provider had a temporary upstream failure.

The provider refused or dropped the request mid-run — nothing in your repo or your credentials is at fault. Re-trigger Pullfrog; if it keeps happening, check the provider's status page.

provider error: {"code":502,"message":"Upstream error from Together: Stream error: h2 protocol error: error reading a body from connection","metadata":{"error_type":"provider_unavailable"}}

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Simplified the disabled answer — formatUnavailable now returns the single line Session search is off on this host. The removed "Turn on Agent Session History in Orca settings to build the index" hint was premature: the contract still assigns consent/settings application and production-service registration to PR 3b (docs/reference/agent-session-search-contract.md:141-144), so there is no user action to name yet. The format and handler tests now assert the exact one-line output rather than a loose join.
  • Clarified SSH host scope — the contract doc and the command's notes now state that in an Orca SSH terminal the forwarded CLI defaults to the controlling Orca runtime's index, that --path only filters that index rather than selecting the SSH host, and that --environment / --pairing-code can name a paired runtime. search is absent from shouldIgnoreRemoteSelection (src/cli/index.ts:29-43), so those routing flags are live for this command.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

`orca search` stays dispatchable but leaves every discovery surface: root
help, group help, unknown-command suggestions, and `agent-context --json`.
`buildAgentContext` did not filter hidden specs, so it also stops leaking
the hidden `terminal stop`.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Withheld orca search from every discovery surface — SEARCH_COMMAND_SPECS[0] now sets hidden: true, and buildAgentContext filters hidden specs, so a command that still dispatches no longer appears in root help, agent-context, group help, or typo suggestions. The earlier root-help additions for the command were reverted. specs/search.test.ts now pins the whole hidden contract — absent from ROOT_HELP_TEXT_PRIMARY/SECONDARY, absent from buildAgentContext, not offered by suggestCommands, yet still resolved by findCommandSpec for dispatch and still printing its own help — and agent-context.test.ts adds a direct hidden-spec omission test.
  • No dispatch or parser regression — findCommandSpec does not consult hidden, COMMAND_PATHS is built from unfiltered specs, and CLI_COMMAND_NAMES keeps search for the launch redirect. The affected CLI suites (specs/search, agent-context, search-command-arguments, args-repeatable-flags, command-name parity, registry parity) pass locally: 74 tests.

The effect is intentional per the commit: the command is reachable only by a caller who already knows it until the settings toggle ships, so the agent-driving proof is no longer discoverable through agent-context. I noted this in the PR summary snapshot rather than as a finding.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 3e5eb03 into main Sep 16, 2026
57 of 59 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
* feat(cli): orca search over the agent session index

`orca search <query>` calls PR 5's `aiVault.searchSessions` over the CLI's
existing runtime RPC, against the host `--environment` / `--pairing-code`
selects and no other. `orca search --index-status` calls `aiVault.searchStatus`.
It is the proof the contract works with no panel.

Every flag maps onto a contract field and nothing else: `--scope`, `--fresh`,
`--limit`, `--cursor`, repeatable `--agent` and `--path`, `--since`, `--sort`,
`--debug`, `--json`. No fan-out, no merged output, no `--host`.

One command rather than a `search status` subcommand: the query is a bare
positional, so `orca search status` could not be told apart from searching for
the word "status". `--status` is unavailable because `orchestration task-list
--status <state>` already owns the name as a valued flag.

No new runtime capability. PR 5 decided an explicit `method_not_found` refusal
maps to `unavailable/no-service`, so reusing `createSessionSearchClient` gives
an old host a plain "this host runs no session search service" answer at exit 0
instead of a raw JSON-RPC error.

`CommandSpec.repeatableFlags` scopes repeatability per command, because
`--agent` must repeat for search and stay single-valued for `worktree create`.
`help.ts` sat exactly at max-lines, so `skills-command-flag-help.ts` becomes
`command-scoped-flag-help.ts` carrying both tables at the same call-site size.

* refactor(cli): drop the search type assertions main's casting gate now rejects

Main gained a `consistent-type-assertions: never` scan in the changed-code gate
after this branch was cut, and it reported twelve assertions in the new files.

The four in the argument parser were avoidable. `readEnum` now keeps the value
`find` returns, which already carries the narrow type, and the agent filter goes
through an `isAiVaultAgent` predicate over a `Set<string>` instead of widening
the agent tuple.

The test now narrows the printed envelope by shape and re-reads the printed
result through `AiVaultSearchResponseSchema`, so the JSON assertions are checked
rather than claimed, and the flag table is typed so its callback needs no cast.
One assertion is left, for the structural fake client, with the SAFETY rationale
AGENTS.md requires.

* fix(cli): sanitize host strings and scope pre-command repeatable flags

Route every host-supplied string the search formatter prints through the
escape stripper, and resolve the repeatable-flag set from the command
tokens ahead when a flag sits before the command.

* refactor(cli): resolve repeatable flag rules once per command

* fix(cli): clarify session search availability and SSH scope

* feat(cli): hide orca search until the settings toggle ships

`orca search` stays dispatchable but leaves every discovery surface: root
help, group help, unknown-command suggestions, and `agent-context --json`.
`buildAgentContext` did not filter hidden specs, so it also stops leaking
the hidden `terminal stop`.
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