Skip to content

fix: pass explicit argv to CLI entrypoint - #800

Closed
seonghobae wants to merge 2 commits into
feat/auto-embedding-model-selectionfrom
fix/explicit-cli-argv
Closed

fix: pass explicit argv to CLI entrypoint#800
seonghobae wants to merge 2 commits into
feat/auto-embedding-model-selectionfrom
fix/explicit-cli-argv

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Why

The local bootstrap wrapper had to replace sys.argv before importing the CLI entrypoint. That made the authenticated server invocation implicit and prevented a reliable local orchestrator boundary.

Change

  • add an optional argv parameter to contextual_orchestrator.__main__.main
  • keep normal console invocation unchanged
  • route subcommands and argparse through the supplied argument list
  • cover explicit argv and assert that the process argv is unchanged

LineageWeave can now call the upstream entrypoint without monkey patching.

Verification

  • uv run pytest tests/test_cli_auth.py -q
  • 9 passed

Open in Devin Review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f8ca96ed-be47-42c9-9b1a-0492db3a5f9a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@seonghobae
seonghobae changed the base branch from main to feat/auto-embedding-model-selection August 21, 2026 01:18
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head review complete at a2a3edc. The branch is a clean stack on PR #789 (base corrected from main to feat/auto-embedding-model-selection); the effective diff is only the explicit argv CLI boundary and its regression. Local proof: 13 tests passed (CLI auth plus API contract), Ruff, compileall, and git diff --check passed. Auto-merge is being armed; protected approval and hosted Checks remain required.

@seonghobae
seonghobae enabled auto-merge (squash) August 21, 2026 01:19

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@seonghobae

Copy link
Copy Markdown
Contributor Author

Stack reconciliation completed at exact HEAD 365442b (verify live SHA). Current PR #789 commits are now integrated without dropping its auto-discovery startup behavior; explicit argv is preserved and the effective stack diff remains the CLI boundary plus its regression. Local proof on the reconciled tree: 50 tests passed across CLI/API, discovery, embedding, and security suites; Ruff, compileall, and git diff --check passed. Hosted Checks are re-running on this exact head; protected auto-merge remains enabled and still requires independent approval.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +361 to +362
if args.auto_discover_model_agents:
_auto_discover_runtime_agents(orchestrator)

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.

🟡 Startup model discovery runs twice, doubling provider queries

When automatic model discovery is requested, the discovery routine is invoked twice back-to-back (_auto_discover_runtime_agents(orchestrator) at contextual_orchestrator/__main__.py:361-362) instead of once, so the server contacts every provider and re-syncs agents a second time for no reason.
Impact: Every server startup with auto-discovery enabled makes a redundant full round of provider network calls and agent syncing, wasting time and provider quota and doubling the chance of a startup failure.

Duplicated conditional block introduced by the PR

The original code had a single guarded call. This PR added an identical second copy:

    if args.auto_discover_model_agents:
        _auto_discover_runtime_agents(orchestrator)
    if args.auto_discover_model_agents:
        _auto_discover_runtime_agents(orchestrator)

_auto_discover_runtime_agents (contextual_orchestrator/__main__.py:254-262) calls discover_all_models() (provider queries) and orchestrator.sync_discovered_agents(...), both of which now execute twice. This duplication is unrelated to the PR's stated intent (passing explicit argv) and is almost certainly an accidental bad merge/edit.

Suggested change
if args.auto_discover_model_agents:
_auto_discover_runtime_agents(orchestrator)
if args.auto_discover_model_agents:
_auto_discover_runtime_agents(orchestrator)
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Superseded by stacked PR #801, which is based on the current #765 head carrying the required auto-discovery and body-limit options.

@seonghobae seonghobae closed this Aug 21, 2026
auto-merge was automatically disabled August 21, 2026 01:22

Pull request was closed

@seonghobae

Copy link
Copy Markdown
Contributor Author

Review repair at current HEAD 365442be60ec6da311d992ddaa69e2bfe2ab1a8a: removed a duplicate \ startup call and added a regression asserting discovery runs exactly once. Local verification: pytest -q tests/test_cli_auth.py tests/test_auto_discovery_server.py (12 passed), Ruff, compileall, and diff --check passed. Base is fb4691838ea193004a8a375a426ec328c3faf1f8; hosted Checks and protected review remain authoritative.

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