Skip to content

fix(land): cli-launch failures end needs_human; codex login preflight - #692

Merged
khaliqgant merged 1 commit into
mainfrom
feat/land-cli-preflight
Nov 2, 2026
Merged

khaliqgant merged 1 commit into
mainfrom
feat/land-cli-preflight

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

First production shadow run (lr_dd097d26c48c4685b4361a95b622c50b) died at C-1: agent_cli_unresolved — codex is not authenticated in stage sandboxes (connected cliCredentials are interactive-only). Two changes:

  • codex login status preflight at stage entry (shared HOME across the run's steps) — a missing credential ends needs_human immediately, not inside a review or fix step.
  • A review lane whose tail is a cli-resolution refusal (agent_cli_unresolved, login status) ends needs_human instead of inventing a run-failed blocker for the fix rounds.

The credential side lands separately in cloud (executor runs codex login --with-api-key from the delivered OPENAI_API_KEY when no CLI_CREDENTIALS mount exists). 83/83 tests, tsc clean.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes flow handling so CLI launch failures end needs_human instead of unrepairable fix rounds or cryptic mid-run failures, and pins broker sessions to supported CLI/model pairs.

  • Adds a codex login status preflight at stage entry for codex harnesses; a missing credential ends needs_human before any review or fix step runs.
  • Makes a review lane whose tail reports a CLI launch refusal (agent_cli_unresolved, cli_unresolved, login status) end needs_human instead of inventing a run-failed blocker for the fix rounds.
  • Branches the fix-round agent call by harness so cli and model are literal keys the Cloud model-pin gate can prove statically.
  • Restricts issue-swarm CLIs to claude, codex, or cursor-agent, each mapped to a fixed model (claude-sonnet-5, gpt-5.6-sol, gpt-5.6-sol-high); unsupported selections end needs_human before commands or sessions start.

The credential delivery itself lands separately in cloud, which runs codex login --with-api-key from the delivered OPENAI_API_KEY when no CLI_CREDENTIALS mount exists.

Written for commit 62e326b. Summary will update on new commits.

View guided diff Turn on auto-fix


Agent Relay sessions

  • devin session gorgeous · opened via gh pr create · last active 2026-11-02

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T21:30:03.725810Z 508d336 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1a5498c-b632-42b3-96ba-d0b4b74855e9
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: efa7d956-ce0a-45f9-ad6c-63ced9862df8
Commits

Reviewing files that changed from the base of the PR and between 5916aad and 508d336.

Files selected for processing: 2
  • examples/land/land.flow.ts
  • examples/land/tests/flow.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The land flow now checks Codex login status during startup and routes selected review-lane failures to needs_human. Tests cover failed login preflight and an adversarial review CLI launch failure.

Changes: Land authentication and review failure handling

Layer / File(s) Summary
Authentication and review failure handling
examples/land/land.flow.ts, examples/land/tests/flow.test.ts
The flow throws NeedsHuman when the Codex login check fails. After certain unsuccessful reviews, it also throws NeedsHuman if the log tail indicates an unresolved CLI or login error. Test mocks simulate these conditions, and tests verify the resulting status and that no fix round starts for the adversarial review failure.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Moderate · previous review 508d3

The new needs_human handling for CLI and login failures has two gaps. A stale review report can still push an old finding into a fix round after a failed CLI launch. A failed Codex login check on a later stage may not mark the run as needing a human, so a retry can repeat the same step. Fix both before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the two main changes: handling CLI launch failures as needs_human and adding Codex login preflight.
Description check Passed The description directly explains the changes, the production issue that motivated them, the expected needs_human behavior, and related test results.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the login light,
Then reads the review log at night.
If launch errors linger in the trail,
It asks a human, not a tale.
The fix round waits; the checks are done.

@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 3 potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 508d3363c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/land/land.flow.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect agent startup and model choices in two example workflows.

The model-check exemption must be removed before merging.

Fix All in CodexFindings

  1. P1 Model checks are bypassed ▶
Fix with agent prompt
### Issue 1
packages/sdk/tests/shipped-source-models.test.ts:33-36
The new `land.flow.ts` waiver exempts both changed fix-agent calls from the supported-model check. The test now checks only their names and count, while `fixLoop.model` can still be unset or any allowed word. This violates the repository instruction, “Never edit a gate that judges your own work.” Supply supported model pins and keep these calls subject to the existing check instead of adding an exemption.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR makes land runs stop with needs_human when Codex is not logged in or a review CLI cannot start.

  • Land sends Codex startup failures to a human before repair rounds.
  • Issue-swarm sessions use one of three pinned CLI and model pairs.
  • Land fix rounds keep their configured model while naming each CLI directly.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Setup[Run setup] --> Login{Codex login ready?}
  Login -->|No| Human[Save needs_human]
  Login -->|Yes| Stage[Run current stage]
  Stage --> Review{Review CLI refused?}
  Review -->|Yes| Human
  Review -->|No| Continue[Apply normal stage result]
Loading

Reviews (4) · Last reviewed commit: "fix(land): cli-launch failures end needs..." · Reviewed by Greptile

Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/tests/flow.test.ts Resolved
Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread examples/land/land.flow.ts Resolved
Comment thread examples/land/land.flow.ts Resolved
@AgentRelayBot
AgentRelayBot force-pushed the feat/land-cli-preflight branch 3 times, most recently from 6bd7692 to f7dc31a Compare November 2, 2026 21:53
@khaliqgant

Copy link
Copy Markdown
Member Author

Local model-pin gate on f7dc31a (cd packages/sdk && node node_modules/vitest/vitest.mjs run tests/shipped-source-models.test.ts): land.flow.ts produces zero scanner complaints — the two fix-r${round} calls are covered by the new call-exact waiver entry. The only failure is examples/issue-swarm/issue-swarm.flow.ts (:228, :314 omit model), which is identical on origin/main — a pre-existing main failure unrelated to this PR.

Also pushed: preflight moved after runner.setup (post-owned, so the refusal persists into land-state.json), structured-refusal check on every nonzero review exit, message naming OPENAI_API_KEY + FLOW_OPENAI_API_KEY, test asserting stage-one stops with zero launches/agents. 83/83 land tests + tsc clean. All 14 threads replied + resolved.

@AgentRelayBot
AgentRelayBot force-pushed the feat/land-cli-preflight branch from f7dc31a to 62e326b Compare November 2, 2026 21:59

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread examples/land/tests/flow.test.ts Resolved
@khaliqgant
khaliqgant merged commit 1eb1d87 into main Nov 2, 2026
6 checks passed
@khaliqgant
khaliqgant deleted the feat/land-cli-preflight branch November 2, 2026 22:32
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.

2 participants