Skip to content

fix(context): add set_skill to unbreak auto_skill_mode - #227

Merged
bouillipx merged 2 commits into
mainfrom
feat/context-set-skill
Mar 25, 2026
Merged

fix(context): add set_skill to unbreak auto_skill_mode#227
bouillipx merged 2 commits into
mainfrom
feat/context-set-skill

Conversation

@terrenceeLeung

@terrenceeLeung terrenceeLeung commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

Allow mounting or replacing the current skill at runtime via Context.set_skill().

Summary

  • Adds Context.set_skill() method and IContext.set_skill() abstract declaration so the execute engine can mount a skill after search_skill tool returns.
  • Without this, enable_skill_tool=True (the default) crashes with AttributeError when the LLM invokes search_skill, because _mount_skill_from_result calls context.set_skill() which didn't exist.

Scope (One PR One Thing)

  • Primary objective: Fix AttributeError crash in auto_skill_mode when LLM calls search_skill
  • Out of scope: N/A
  • I confirm this PR handles a single objective only: [x] Yes

Changed Files (required)

File Reason
dare_framework/context/kernel.py Add set_skill abstract method to IContext interface (consistent with set_tool_gateway pattern)
dare_framework/context/context.py Add `set_skill(self, skill: Skill
docs/features/fix-context-set-skill.md Update feature doc with merged Intent PR link

Intent / Implementation Gate (required)

Acceptance Criteria

  • IContext declares set_skill as abstract method
  • Context.set_skill() exists and sets _sys_skill
  • _mount_skill_from_result no longer raises AttributeError
  • Persistent skill mode (enable_skill_tool=False) is unaffected

Acceptance Pack (required)

  • Contract Delta: schemaIContext gains set_skill(Skill | None) -> None abstract method; error semantics — none; retry — none
  • Golden Cases: none — 4-line setter + 4-line abstract declaration, exercised by existing _mount_skill_from_result call path
  • Regression Summary: existing tests pass (pytest)
  • Observability and Failure Localization: none — no new events; fixes an uncaught AttributeError in execute_engine.py:244
  • Structured Review Report attached: [x] Yes (below)

Test Evidence (required)

  • Local commands run: pytest
  • CI links or job names: PR CI
  • Evidence/output summary: No regressions; the fix bridges the gap between DareAgent._mount_skill_from_result (caller) and Context/IContext (callee)

Risk and Rollback

  • Risk level: Low
  • Main risk points: None — additive change, no existing behavior modified
  • Rollback plan: Revert commit

Structured Review Report (required)

Changed Module Boundaries / Public API

  • IContext.set_skill() added as abstract method (kernel.py)
  • Context.set_skill() added as concrete implementation (context.py)

New State

  • New cache/global/singleton state: None
  • Lifecycle and cleanup: set_skill(None) clears the skill

Concurrency / Timeout / Retry

  • New concurrency points: None
  • Timeout/retry locations: None
  • Upper bounds: N/A

Side Effects and Idempotency

  • Side effects: Mutates _sys_skill on Context instance
  • Anti-duplication strategy: N/A — last-write-wins by design (one active skill at a time)

Coverage and Residual Risk

  • Covered tests/evaluations: Existing execute engine path exercises this via _mount_skill_from_result
  • Residual risks not covered: Custom IContext implementations must now implement set_skill (enforced by ABC)

Dependency and Lockfile Changes

  • Lockfile changed in this PR: [ ] No

Agent Rules Checklist (required)

  • 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 — N/A
  • Merge will be done by approved reviewer (no self-merge auto-ship)

Tianyi Liang and others added 2 commits March 25, 2026 10:26
When enable_skill_tool=True (the default), the LLM calls search_skill
at runtime. The execute engine then invokes _mount_skill_from_result,
which calls context.set_skill() — but Context had no such method,
causing an uncaught AttributeError that crashes the execute loop.

Added Context.set_skill() so the runtime can mount/replace the active
skill after build time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Declare set_skill() as abstract method on IContext (kernel.py),
  consistent with the set_tool_gateway pattern
- Update feature doc with merged Intent PR link

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@terrenceeLeung
terrenceeLeung force-pushed the feat/context-set-skill branch from 5ea0194 to 63cf0d5 Compare March 25, 2026 02:31
@bouillipx
bouillipx merged commit 77bf798 into main Mar 25, 2026
9 of 11 checks passed
@bouillipx
bouillipx deleted the feat/context-set-skill branch March 25, 2026 02:39
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