feat(iii-directory): alias bare worker name to <worker>/index in skills::get#177
Conversation
…ls::get
LLM agents calling `directory::skills::get` naturally reach for the worker
name (e.g. `sandbox`, `provider-lmstudio`) when they want the worker's
overview — that's the shortest form and the one referenced in our own
error hints ("browse worker overviews via directory::skills::index").
The bare form previously failed with `Skill not found: <worker>` because
the canonical id on disk is `<worker>/index` (file at
`<skills_folder>/<worker>/index.md`).
This mirrors the existing filesystem-side alias (`SKILLS.md` → `index.md`
in fs_source::rel_to_id) onto the request side. `find_fs_skill` now does
a single-pass lookup that prefers an exact match and falls back to
`<id>/index` only when `id` has no `/`. The response carries the
canonical id (`<worker>/index`), so the agent still learns the real form
on the way through.
Guarded against the obvious failure modes:
- Multi-segment ids (`sandbox/exec`) must match literally — no recursive
`/index` expansion, so a typo never silently resolves to a wrong skill.
- A literal root skill (`<root>/sandbox.md`) wins over the bare-name →
index alias.
Why in `find_fs_skill`, not `normalize_get_id`:
- `normalize_get_id` runs before `validate_id`. Rewriting bare ids
pre-validation would change the semantic of "valid bare id" globally
for any future API taking ids.
- Bare ids ARE legitimate at the fs layer (`hello.md` at the skills root
has id `hello`). The alias only fires when no exact match exists — a
lookup concern, not a parse concern.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR enhances skill lookup resolution by introducing bare worker name aliasing and improving error diagnostics. ChangesSkill lookup with aliasing and improved error guidance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skill-check — worker0 verified, 11 skipped (no docs/).
Three for three. Nicely done. |
Summary
directory::skills::get { id: "sandbox" }now resolves to the same body as{ id: "sandbox/index" }whenever<skills_folder>/sandbox/index.mdexists. The response carries the canonical id ("sandbox/index") so the agent still learns the real form on the way through.SKILLS.md→index.mdinfs_source::rel_to_id) onto the request side.find_fs_skill), not parse-time. Bare ids stay legitimate at the filesystem layer (hello.mdat the skills root has idhello); the alias only fires when no exact match exists.Why
LLM agents calling
directory::skills::getreach for the worker name (sandbox,provider-lmstudio) when they want the worker overview — it's the shortest form and the one already referenced in our own error hints. The bare form previously failed withSkill not found: <worker>, surfacing through the gate asgate_unavailable/handler error. Observed in QA againstzai-org/glm-4.7-flash(sandbox flow): the agent burned turns recovering from this exact miss.Guard rails
Pinned via tests:
sandbox/execdoes NOT auto-alias tosandbox/exec/index. Without this guard, a typo would silently resolve to the wrong skill.<root>/sandbox.mdand<root>/sandbox/index.mdexist, baresandboxreturns the literal root skill.Test plan
cargo test --lib— 4 new unit tests pass:get_accepts_bare_worker_name_as_alias_for_indexbare_name_and_explicit_index_return_same_bodymulti_segment_id_does_not_auto_alias_to_slash_indexbare_id_with_literal_root_skill_wins_over_index_aliascargo test --lib functions::skills::tests— 54 passed (50 pre-existing + 4 new), 0 regressions.cargo test --test bdd— new Gherkin scenario (bare worker name as alias for <worker>/index) passes all 5 steps. 6 pre-existing failures remain indirectory::engine::trigger-types::list/workers::list/function-infoschema, none touchdirectory::skills::get— same engine-side breakage from commit 241509a.cargo fmt -- --check— clean.iii-directoryworker so the new binary loads. Manual smoke:iii trigger directory::skills::get '{"id":"sandbox"}'→ returns{ "id": "sandbox/index", ... }.iii trigger directory::skills::get '{"id":"sandbox/index"}'→ identical body.iii trigger directory::skills::get '{"id":"sandbox/exec"}'→ returns the literalsandbox/exechow-to (no alias cascade).iii trigger directory::skills::get '{"id":"no-such-worker"}'→ existing not-found hint mentioningdirectory::skills::listanddirectory::skills::index.Summary by CodeRabbit
Release Notes
New Features
worker/index.Bug Fixes
Tests