Skip to content

fix(provider): preserve explicit Gemini approval stance - #484

Open
HsienW wants to merge 2 commits into
HarnessMD:mainfrom
HsienW:fix/gemini-approval-mode-stance
Open

HsienW wants to merge 2 commits into
HarnessMD:mainfrom
HsienW:fix/gemini-approval-mode-stance

Conversation

@HsienW

@HsienW HsienW commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What & why

Global Auto Mode did not recognize Gemini --approval-mode=<value> arguments as an existing approval stance, so an explicit mode such as plan could receive an additional --approval-mode=yolo.

Gemini's legacy --yolo and -y aliases could also receive the modern approval flag, creating a combination that Gemini CLI rejects. This change matches auto mode by CLI option identity, treats the legacy aliases as explicit stances, and stops stance detection at the first -- argument terminator while preserving the normal auto mode fallback when no stance is present.

Closes #483

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs
  • Build / CI

Evidence

Before

On main, Global Auto Mode appended --approval-mode=yolo even when Gemini already had an explicit approval stance.

--approval-mode=plan received a second approval mode, and the legacy --yolo form received the conflicting modern flag.

Image

After

On the fixed revision, explicit Gemini approval stances are preserved.

--approval-mode=plan, --yolo, and -y remain unchanged, while a command with no explicit approval stance still inherits --approval-mode=yolo.

2026-09-09-164601

How I tested it

  • OS: Windows 11
  • Steps:
    • Ran the same buildWorkerLaunch() reproduction before and after the change.
    • Verified gemini --approval-mode=plan remains unchanged.
    • Verified gemini --yolo and gemini -y remain unchanged.
    • Verified gemini --model pro still receives --approval-mode=yolo.
    • Ran node test/agent-provider.test.cjs: PASS.
    • Ran node --test test/worker-launch.test.cjs: 17/17 PASS.
    • Ran npm run typecheck: PASS.
    • Ran npm run build: PASS.
    • Ran git diff --check: PASS.
    • Ran the full npm run test:focused suite. The Gemini regressions pass, while the suite still reports existing unrelated Windows/sandbox failures involving symlink EPERM, temporary HOME handling, and existing static assertions.
2026-09-09-164706

Checklist

  • Before and after evidence is attached above, under both headings.
  • npm run typecheck passes.
  • npm run test:focused passes.
  • npm run build succeeds.
  • This PR is one change. Unrelated fixes belong in their own PR.
  • I read the diff myself before opening this, and there is no debug output,
    commented-out code, or unrelated formatting churn in it.
  • Any new UI derives from DESIGN.md / tokens.ts — no ad-hoc colors,
    spacing, or fonts.
  • If I added art, it's my own or compatibly licensed, and listed in
    ATTRIBUTION.md.

- Normalize auto-mode stance matching by CLI option identity so
  --approval-mode=<value> is recognized as an explicit stance.

- Treat Gemini --yolo and -y as explicit legacy approval aliases to avoid
  appending --approval-mode=yolo and triggering upstream flag conflicts.

- Stop stance detection at the first -- argument terminator so positional
  literals are not mistaken for permission options.

- Add provider and worker-launch regressions for explicit approval modes,
  legacy aliases, terminator handling, and normal auto-mode fallback.
@chaitanyagiri

Copy link
Copy Markdown
Collaborator

Thank you, @HsienW. We took this whole into 0.5.5, so it is already in the installers people are running. We want to merge it here too, so the credit sits on your pull request.

One thing stands in the way, and it is not your code: the Typecheck check is red because a links check inside that job was failing on main itself on 10 Sep. main is fixed now. Could you merge main into this branch, or push an empty commit, so the checks run again? Once they are green, we merge it.

- Retrigger CI after the upstream main branch fix.

- Keep the existing pull request code unchanged.

- Refresh the required checks against the current base branch.
@HsienW

HsienW commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@chaitanyagiri Thanks!
I pushed an empty commit to retrigger CI, and all checks are green now. Appreciate you taking another look.

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.

Global Auto Mode appends Gemini YOLO over an explicit approval stance

2 participants