chore: deduplicate agent flags#2672
Conversation
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge — purely additive configuration with no changes to runtime logic outside the already-tested deduplication path. The deduplication logic in No files require special attention. All updated provider files follow the same straightforward pattern and are covered by the new tests.
|
| Filename | Overview |
|---|---|
| packages/core/src/agents/plugins/helpers/standard-command.ts | Core dedupeFlags helper is correct — O(n) filter over args, Set-based exact matching, first-occurrence wins (generated flags precede user extraArgs in build order) |
| packages/core/src/agents/plugins/helpers/standard-command.test.ts | New test confirms that a flag present in both autoApproveFlag and extraArgs is deduplicated to exactly one occurrence while non-singleton flags (--verbose) are preserved |
| packages/plugins/src/agents/impl/index.test.ts | Parameterised test covering all 21 updated providers verifies each deduplicateFlags entry is applied correctly; all flag lists match the actual flags used in each provider's spec |
| packages/plugins/src/agents/impl/codex/index.ts | Adds --dangerously-bypass-hook-trust to the existing deduplicateFlags list; matches the flag present in autoApproveFlag; pre-existing --dangerously-bypass-approvals-and-sandbox entry is a harmless defensive catch for a legacy flag |
| packages/plugins/src/agents/impl/gemini/index.ts | Multi-word autoApproveFlag (--approval-mode=yolo --skip-trust) is correctly split before deduplication; both tokens listed in deduplicateFlags |
| packages/plugins/src/agents/impl/commandcode/index.ts | Three flags (--trust, --skip-onboarding from defaultArgs, --yolo from autoApproveFlag) correctly listed in deduplicateFlags |
| packages/plugins/src/agents/impl/auggie/index.ts | --allow-indexing is a defaultArgs entry (always generated), not an autoApproveFlag; deduplication against user extraArgs is still correct because defaultArgs are prepended before extraArgs |
| packages/plugins/src/agents/impl/letta/index.ts | Both --yolo (autoApproveFlag) and --new (newConversationFlag) are included in deduplicateFlags; on resume sessions --new won't be generated so a user-supplied duplicate simply passes through once — correct behaviour |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[buildStandardCommand] --> B[Push defaultArgs]
B --> C[Push session/resume flags]
C --> D{ctx.autoApprove?}
D -->|yes| E[Push autoApproveFlag tokens]
D -->|no| F[Skip autoApproveFlag]
E --> G[Push modelFlag]
F --> G
G --> H[Push ctx.extraArgs]
H --> I{deduplicateFlags defined?}
I -->|yes| J[dedupeFlags: keep first occurrence of each singleton flag]
I -->|no| K[Use args as-is]
J --> L[Return AgentCommand]
K --> L
style J fill:#d4edda,stroke:#28a745
style H fill:#fff3cd,stroke:#ffc107
style E fill:#cce5ff,stroke:#004085
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[buildStandardCommand] --> B[Push defaultArgs]
B --> C[Push session/resume flags]
C --> D{ctx.autoApprove?}
D -->|yes| E[Push autoApproveFlag tokens]
D -->|no| F[Skip autoApproveFlag]
E --> G[Push modelFlag]
F --> G
G --> H[Push ctx.extraArgs]
H --> I{deduplicateFlags defined?}
I -->|yes| J[dedupeFlags: keep first occurrence of each singleton flag]
I -->|no| K[Use args as-is]
J --> L[Return AgentCommand]
K --> L
style J fill:#d4edda,stroke:#28a745
style H fill:#fff3cd,stroke:#ffc107
style E fill:#cce5ff,stroke:#004085
Reviews (1): Last reviewed commit: "test(codex): remove duplicate dedupe cas..." | Re-trigger Greptile
Description
Checklist
messages and, when possible, the PR title