Update Codex environment config#52
Conversation
Add --agent flag that enables AI-friendly command interpretation: - Flexible entity ID parsing: q42, Q42, q-42 all normalized to Q42 - Intent recognition: 'wsearch get Q42' → 'entity get Q42' - Detailed error messages with context, examples, and fix hints - Flag aliases: --net → --network, --j → --json, etc. New source files: - src/agent.ts: Intent parsing, error help, fuzzy matching - src/cli-errors.ts: Shared CliError class Updated: - src/cli.ts: Integrate agent mode in fail handlers - src/types.ts: Add agent flag to CliGlobals - README.md: Add agent mode section - docs/AGENTS.md: Comprehensive agent integration guide All 103 tests pass. Backward compatible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mark agent mode features as completed in implementation plan. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ort, function or class' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ort, function or class' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ort, function or class' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Update project license to Apache License 2.0. - Replace LICENSE file with Apache 2.0 text - Update package.json license field - Update README badge and license reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
P1: Preserve JSON error envelope when agent mode is enabled - Check JSON mode first in emitUnhandledCliError - Include agent help text within JSON error message when both --agent and --json are used - Ensures consistent machine-parseable output for automation P2: Gate relaxed entity-ID coercion behind --agent flag - assertEntityId now only accepts flexible formats (q-42, q_42) when agent=true - Strict validation (Q42 only) for normal mode - Prevents silent conversion of malformed IDs in scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AGENTS.md: - Fix shell example with comments after backslashes - Add --user-agent to example commands that were missing it agent.ts: - Fix fixFlagOrder to handle flag-with-value pairs (e.g., --output file) cli.ts: - Add --agent to booleanOptions in isHelpLikeInvocation - Add parseAgentIntent pre-parsing when --agent flag is detected - Import normalizeEntityId and suggestCommand for agent preprocessing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AGENTS.md: - Fix shell example: remove comments after backslashes - Add --user-agent to examples that were missing it README.md: - Add --user-agent to all API command examples - Change "All commands require" to "API commands require" CLI_SPECIFICATION.md: - Add --agent to global flags table - Document flexible entity ID format in agent mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update INTENT_PATTERNS regex to handle q-42, q_42 formats - Update transform functions to normalize IDs (remove separators, uppercase) - Fix search pattern to stop at first flag (avoid swallowing --json etc.) - Update normalizeEntityId to handle optional separators - Simplify fixFlagOrder to preserve caller intent (return [...args]) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add stub commands for harness CI pipeline: - check-environment: Verify environment setup - risk-policy-gate: Evaluate risk policy for files - review-gate: Check PR review status - evidence-verify: Verify evidence files - remediate run: Run remediation tasks These commands return success by default to allow the harness pipeline to complete. They output JSON when --json flag is used. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixed 5 file(s) based on 9 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
- Fix parseAgentIntent to skip option values when finding first command - Fix resolveErrorContext to detect --json from raw argv (avoiding yargs defaults) - Improve agent mode processing to handle option values correctly - Always validate URL format in global check (catches invalid URLs in preview mode) Fixes test failures: - api-url validation now returns E_VALIDATION instead of E_POLICY - JSON output with -o flag now creates parent directories correctly - CLI args are properly preserved through intent parsing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
P1: Relax SPARQL intent regex to allow --agent flag in argv P1: Replace CommonJS require with ESM imports in attestation handler P2: Add new harness commands to trailing-help allowlist P2: Gate intent preprocessing on enabled --agent mode only P2: Treat --agent=false as disabled in agent detection P2: Accept hyphenated queries in search intent shorthand Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add --findings, --contract, and --mode options to remediate run command for Harness CI compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add typecheck, lint, and check scripts as aliases to existing scripts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused fixFlagOrder function (dead code) - Fix fail handler to include agent-formatted error in JSON output for consistency with emitUnhandledCliError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix shell snippet in AGENTS.md (move comments before command) - Fix rate limiting example to include --user-agent - Remove exit code 4 from spec (not implemented) - Fix normalizeEntityId regex to match assertEntityId flexibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Why: generated prek hooks default to ~/.cache/prek, which can fail in sandboxed environments.\n\nWhat: patch installed prek shim scripts with a repo-local PREK_HOME export after prek install and route Makefile hooks through the setup script.\n\nImpact: git hook execution no longer depends on writable home-directory cache paths. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Why: project-local governance defaults and environment/tooling checks needed to be executable inside this repo without relying on workspace-level scripts. What: add local hook-governance scripts with explicit required inputs, add verify-work wrapper with explicit workspace mode, add repo scope artifacts/docs, and wire minimal mise + check-environment canonical tooling generation. Impact/Risk: governance checks now default local and workspace checks are opt-in; low runtime risk, but docs and scripts changed across the repo. Co-authored-by: Codex <noreply@openai.com>
Refresh the repo-local Codex environment file from the canonical harness template so setup and action commands stay aligned with current project scripts. Co-authored-by: Codex <noreply@openai.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d49f7851e
ℹ️ 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".
| const maxTierIndex = tierOrder.indexOf(maxTier); | ||
|
|
||
| for (const [tierName, tierConfig] of Object.entries(contract.tiers || {})) { | ||
| const tierIndex = tierOrder.indexOf(tierName); | ||
| if (tierIndex > maxTierIndex) continue; // Skip tiers above max allowed |
There was a problem hiding this comment.
Reject unknown max-tier values before evaluating policy
The gate never validates --max-tier, so an unrecognized value (for example --max-tier med) yields maxTierIndex === -1 and causes every configured tier to be skipped by if (tierIndex > maxTierIndex) continue, letting all file changes pass policy checks. This creates a silent policy bypass on typos or misconfigured automation and should fail fast with a usage/validation error when the tier is not one of low|medium|high|critical.
Useful? React with 👍 / 👎.
| const reviews = await reviewsResponse.json() as Array<{ state?: string }>; | ||
| const approvals = reviews.filter((r: { state?: string }) => r.state === "APPROVED").length; | ||
| const minApprovals = contract.minApprovals || 1; |
There was a problem hiding this comment.
Count approvals per reviewer, not per review event
This counts every APPROVED review event, but GitHub review history can contain multiple approvals from the same reviewer, so a single person re-approving can satisfy minApprovals incorrectly. In repos that require distinct approvers, this can produce false passes for review-gate; approvals should be computed from each reviewer’s latest state (or unique approved reviewers), not raw event count.
Useful? React with 👍 / 👎.
| const isAgentMode = isAgentEnabled(rawArgv); | ||
| if (isAgentMode) { | ||
| // Only run intent parsing when agent mode is explicitly enabled |
There was a problem hiding this comment.
Enable agent aliases during pre-parse activation
Agent pre-processing is gated by isAgentEnabled(rawArgv), but that helper only recognizes --agent forms. As a result, aliases declared in src/agent.ts (like --ai, --robot, --auto) never activate agent parsing/normalization and are treated as unknown flags in strict mode. If these aliases are intended to work, activation must also recognize them before the pre-parse gate.
Useful? React with 👍 / 👎.
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 684ddc8abe
ℹ️ 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".
| if (value === "true") return true; | ||
| if (value === "false") return false; | ||
| // Don't treat other --flag=* forms as enabled (must be explicit true) |
There was a problem hiding this comment.
Normalize aliased agent flags with explicit boolean values
isAgentEnabled now treats --ai=true/--robot=true as enabling agent mode (and =false as disabling), but the preprocessing path only rewrites exact alias tokens like --ai to --agent. That leaves --ai=true (or --ai=false when preprocessing is skipped) in processedArgv, and .strict() later rejects it as an unknown option, so explicit boolean alias forms still fail despite being recognized here. Normalize --ai|--robot|--auto=<value> to --agent=<value> before yargs parsing.
Useful? React with 👍 / 👎.
Summary
feat/agent-modebranch against currentmain.--ai,--robot, and--auto.risk-policy-gate --max-tiervalues instead of silently passing an unknown tier.Checklist
main.Testing
npm ci./node_modules/.bin/tsc -p tsconfig.json --noEmit./node_modules/.bin/vitest runnpm audit --audit-level=moderatenpm run buildgit diff --check && git diff --cached --checkReview artifacts
--max-tierno longer silently passes.Notes