Skip to content

Change skill mounting behaviour#43

Merged
ScriptSmith merged 2 commits into
mainfrom
skill-mounting
Jun 2, 2026
Merged

Change skill mounting behaviour#43
ScriptSmith merged 2 commits into
mainfrom
skill-mounting

Conversation

@ScriptSmith
Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 1, 2026

Greptile Summary

This PR changes how skill bundles are mounted in the sandbox: stored skills now mount at /skills/<name>-<version> (mirroring OpenAI's naming scheme) instead of /skills/<skill_id>, and inline skills move from /skills/skill_inline_<hash> to /skills/<name> directly. Inline skill names are now required to be lowercase slugs, which also serves as a path-traversal guard since the name is written to the sandbox verbatim.

  • Replaces the hash-based synthetic-id mount path for inline skills with the plain name slug, ensuring the same stable path across foreground/background dispatch lanes without relying on content-based hashing.
  • Adds validate_skill_name enforcement for inline skill names at both request time and container creation time, with a new MountPathConflict error to prevent two skills from silently clobbering each other's files at mount time.
  • Updates documentation, OpenAPI schemas, and test coverage to reflect the new <name>-<version> / <name> layout.

Confidence Score: 5/5

Safe to merge; the path-traversal guard is correctly implemented and all new error paths are properly wired up.

The logic changes are well-contained: slug validation is enforced at both container creation and request resolution time, the new ensure_unique_mount_paths check prevents silent file clobbering, and the new error variants map cleanly to HTTP 400 responses. Tests cover the security-critical path-traversal case and the collision detection. The only gap — not detecting duplicate inline names at container creation — degrades UX for a specific misconfigured container but never causes silent data loss or a security bypass.

src/routes/api/containers.rs — the per-entry validation loop could be extended to detect duplicate inline skill names before persisting.

Important Files Changed

Filename Overview
src/services/responses_pipeline.rs Core skill resolution logic: changes stored mount path to <name>-<version>, inline path to <name>, adds InvalidInlineName / MountPathConflict error variants, ensure_unique_mount_paths helper, and path-traversal guard via validate_skill_name. Well-tested, but inline-duplicate conflicts in containers are deferred to request time rather than caught at creation.
src/routes/api/containers.rs Adds slug validation for inline skill names at container creation time, matching what the resolver enforces at request time. Cross-skill conflict detection (two inline skills with the same name) is not checked here.
src/routes/api/chat.rs Adds InvalidInlineName and MountPathConflict to the error-code mapping; both map to sensible HTTP 400 responses with descriptive error codes.
src/runtimes/mod.rs Doc comment on SkillMount.mount_path updated to reflect new <name>-<version> format; no logic changes.
src/api_types/responses.rs Doc strings updated to reflect new mount path conventions; no logic changes.
src/services/shell_tool.rs Comment on mounted_skill_ids updated to describe new path format; no logic changes.
agent_instructions/containers.md Documentation updated to reflect new skill reference resolution, mount paths, and inline skill slug requirements.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[RequestSkill list] --> B{Skill type?}
    B -->|skill_reference| C[resolve_version_for_reference\nDB lookup by id / name / version]
    B -->|inline| D[resolve_inline_skill\nvalidate slug name\ndecode base64]
    C --> E[mount_path = /skills/name-version_seq]
    D --> F[mount_path = /skills/name]
    E --> G[ensure_unique_mount_paths\nquadratic scan over resolved list]
    F --> G
    G -->|conflict| H[SkillResolutionError::MountPathConflict\nHTTP 400 skill_mount_conflict]
    G -->|ok| I[build_preamble per skill\nprepend to instructions]
    I --> J[Vec SkillMount to ShellExecutor\nfiles written to sandbox at mount_path]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/routes/api/containers.rs:593-597
**Missing duplicate-name check for inline skills at creation time**

The comment at `validate_skill_entry` says it mirrors the resolver's checks "so a misshaped inline skill never makes it onto a stored row," and this PR adds the slug-validity check to match. However, a container created with two inline skills that share the same `name` (both pass per-entry validation) will have `skill_mount_conflict` returned on every subsequent request that uses the container, because `ensure_unique_mount_paths` is only called at request resolution time — not here.

Unlike stored-skill conflicts (which can't be predicted at creation because the resolved version is unknown), inline skill mount paths are entirely determined by `name`, so the clash is detectable right now. A simple duplicate-name scan over the inline entries in `body.skills` before persisting would catch this class of always-broken containers at creation time, consistent with the stated motivation for the existing slug check.

Reviews (3): Last reviewed commit: "Review fixes" | Re-trigger Greptile

@ScriptSmith
Copy link
Copy Markdown
Owner Author

@greptile-apps

@ScriptSmith ScriptSmith merged commit 08a785b into main Jun 2, 2026
19 of 20 checks passed
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