Smart ctx - #152
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75be00b492
ℹ️ 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".
| print(f"Error: 目标工程路径不存在: {project_path}") | ||
| sys.exit(1) | ||
|
|
||
| api_key = os.getenv("OPENROUTER_API_KEY", "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") |
There was a problem hiding this comment.
Remove hardcoded OpenRouter key fallback
This line embeds a concrete API key as the default for OPENROUTER_API_KEY, so running the example without environment setup silently uses a committed credential instead of failing fast; that creates credential-leak and unintended billing risk from source code alone (the same pattern is also present in examples/10-react-agent-code-recon/main.py). Examples should require the env var and exit when it is missing.
Useful? React with 👍 / 👎.
| if "/" not in relative_path and ("**/" in pattern or pattern in ("**/*", "**")): | ||
| suffix = pattern.split("/")[-1] if "/" in pattern else "*" | ||
| return fnmatch.fnmatch(file_name, suffix) |
There was a problem hiding this comment.
Preserve prefix when handling
**/ glob fallback
The new fallback reduces any **/ pattern to only its final suffix, so patterns with directory prefixes are matched incorrectly; for example, pkg/**/*.py now matches a root file like a.py but fails to match pkg/c.py, which makes search_file return wrong paths for common recursive queries. This should keep the directory prefix semantics instead of matching only *.py on root files.
Useful? React with 👍 / 👎.
Summary
Scope (One PR One Thing)
Changed Files (required)
List all touched files and why each file changed.
If this PR is a large diff (>300 changed lines), explain why split PRs are not possible and provide a split follow-up plan.
Acceptance Criteria
Test Evidence (required)
.........If this PR changes high-risk runtime paths (auth/concurrency/execution control), include
risk-matrixevidence.Risk and Rollback
Dependency and Lockfile Changes
requirements.txt/pyproject.toml/package.json): [ ] Yes [ ] No [ ] N/AAgent Rules Checklist (required)
Reference:
docs/agent_rules.mdskip/only/excludeusage is explained and reviewed