Skip to content

Suppress fallback path warnings in agents#66

Merged
ainetx merged 1 commit into
mainfrom
fix-cfs
Jul 22, 2026
Merged

Suppress fallback path warnings in agents#66
ainetx merged 1 commit into
mainfrom
fix-cfs

Conversation

@ainetx

@ainetx ainetx commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Improved path validation during agent and kit integration generation.
    • Added clearer warnings when configured paths fall outside the project or approved resource locations.
    • Improved handling of portable project-relative paths, including safe fallback behavior.
    • Prevented invalid paths from being silently accepted or ignored.

Signed-off-by: ainetx <[email protected]>
Co-authored-by: Constructor Studio <291158726+constructor-studio[bot]@users.noreply.github.com>
Studio-Generated-By: Constructor Studio
Studio-Source-Repo: https://github.com/constructorfabric/studio
Constructor-Fabric: https://github.com/constructorfabric
Studio-Version: skill=1.0.0, cli=1.5.10
Studio-Workflows: cf-coding-review,cf-coding-fix,cf-coding-ci,cf-git-commit
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Agent integration path handling now resolves paths before containment checks, preserves portable and project-relative fallbacks, warns on registered-path escapes, simplifies trusted-root validation, and expands tests for fallback and warning behavior.

Changes

Path Resolution Safety

Layer / File(s) Summary
Target path resolution
skills/studio/scripts/studio/commands/agents.py, tests/test_agents_coverage.py
_target_path_from_root uses resolved containment checks to select portable or fallback paths, with tests confirming quiet project-relative fallback behavior.
Registered path validation
skills/studio/scripts/studio/commands/agents.py, tests/test_agents_coverage.py
Registered kit and resource paths warn when project and legacy resolutions escape allowed roots; trusted-root checks and warning-count assertions cover matching, rejection, and register-mode behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is relevant to the warning-behavior changes, though it understates the broader path-resolution and safety updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-cfs

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/studio/scripts/studio/commands/agents.py`:
- Around line 2292-2296: Update _warn_registered_path_escape so its warning uses
neutral wording that applies to both registered-kit paths and resource bindings,
removing the “registered kit path” terminology while preserving the existing
escape details. Update the corresponding assertion in test_agents_coverage.py to
expect the revised neutral message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a123050-310e-40f8-8f9e-c9b18eff69e6

📥 Commits

Reviewing files that changed from the base of the PR and between ab90cd9 and 18b765d.

📒 Files selected for processing (2)
  • skills/studio/scripts/studio/commands/agents.py
  • tests/test_agents_coverage.py

Comment on lines +2292 to +2296
def _warn_registered_path_escape(raw_path: str, project_root: Path, studio_root: Path) -> None:
"""Warn once when neither registered-kit path base keeps *raw_path* in-project."""
_warn_agents(
"registered kit path escapes project root after checking project and studio roots: "
f"{raw_path!r} (project={project_root.resolve()}, studio={studio_root.resolve()})"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a path-neutral warning.

This helper is also called for resource bindings (Lines 2351-2352), but logs every rejected binding as a “registered kit path.” Use generic wording so operators investigate the correct configuration field.

Proposed fix
 def _warn_registered_path_escape(raw_path: str, project_root: Path, studio_root: Path) -> None:
-    """Warn once when neither registered-kit path base keeps *raw_path* in-project."""
+    """Warn once when neither registered-path base keeps *raw_path* in-project."""
     _warn_agents(
-        "registered kit path escapes project root after checking project and studio roots: "
+        "registered path escapes project root after checking project and studio roots: "
         f"{raw_path!r} (project={project_root.resolve()}, studio={studio_root.resolve()})"
     )

Update the assertion at tests/test_agents_coverage.py Line 162 to match the neutral message.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _warn_registered_path_escape(raw_path: str, project_root: Path, studio_root: Path) -> None:
"""Warn once when neither registered-kit path base keeps *raw_path* in-project."""
_warn_agents(
"registered kit path escapes project root after checking project and studio roots: "
f"{raw_path!r} (project={project_root.resolve()}, studio={studio_root.resolve()})"
def _warn_registered_path_escape(raw_path: str, project_root: Path, studio_root: Path) -> None:
"""Warn once when neither registered-path base keeps *raw_path* in-project."""
_warn_agents(
"registered path escapes project root after checking project and studio roots: "
f"{raw_path!r} (project={project_root.resolve()}, studio={studio_root.resolve()})"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/studio/scripts/studio/commands/agents.py` around lines 2292 - 2296,
Update _warn_registered_path_escape so its warning uses neutral wording that
applies to both registered-kit paths and resource bindings, removing the
“registered kit path” terminology while preserving the existing escape details.
Update the corresponding assertion in test_agents_coverage.py to expect the
revised neutral message.

@ainetx
ainetx merged commit 940c63c into main Jul 22, 2026
21 checks passed
@ainetx
ainetx deleted the fix-cfs branch July 22, 2026 04:37
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.

1 participant