Skip to content

Smart ctx - #152

Merged
mahaichuan-qq merged 3 commits into
mainfrom
smart_ctx
Mar 2, 2026
Merged

Smart ctx#152
mahaichuan-qq merged 3 commits into
mainfrom
smart_ctx

Conversation

@mahaichuan-qq

Copy link
Copy Markdown
Collaborator

Summary

  • What does this PR change?
  • Why is this change needed?

Scope (One PR One Thing)

  • Primary objective:
  • Out of scope:
  • I confirm this PR handles a single objective only: [ ] Yes

Changed Files (required)

List all touched files and why each file changed.

File Reason
path/to/file reason

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

  • Criteria 1
  • Criteria 2

Test Evidence (required)

  • Local commands run:
    • ...
  • CI links or job names:
    • ...
  • Evidence/output summary:
    • ...

If this PR changes high-risk runtime paths (auth/concurrency/execution control), include risk-matrix evidence.

Risk and Rollback

  • Risk level: Low / Medium / High
  • Main risk points:
  • Rollback plan:

Dependency and Lockfile Changes

  • Lockfile changed in this PR: [ ] Yes [ ] No
  • If yes, manifest updated in same PR (requirements.txt/pyproject.toml/package.json): [ ] Yes [ ] No [ ] N/A

Agent Rules Checklist (required)

Reference: docs/agent_rules.md

  • Only task-related files changed; no opportunistic refactor
  • Public interfaces/data structures unchanged unless explicitly required
  • Tests added/updated and evidence attached
  • Any skip/only/exclude usage is explained and reviewed
  • Merge will be done by approved reviewer (no self-merge auto-ship)

@bouillipx

Copy link
Copy Markdown
Collaborator

@codex review

@mahaichuan-qq
mahaichuan-qq merged commit 518e715 into main Mar 2, 2026
8 checks passed
@mahaichuan-qq
mahaichuan-qq deleted the smart_ctx branch March 2, 2026 14:52

@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: 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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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +190 to +192
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

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