-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
π feat: always-apply frontmatter: auto-prime skills every turn
#12746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
aafc133
2562128
fe078cc
e8e8cb7
abaf284
06b7aed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ const { filterFilesByAgentAccess } = require('~/server/services/Files/permission | |
| const { | ||
| getSkillToolDeps, | ||
| enrichWithSkillConfigurable, | ||
| buildManualSkillPrimedIdsByName, | ||
| buildSkillPrimedIdsByName, | ||
| } = require('./skillDeps'); | ||
| const { getModelsConfig } = require('~/server/controllers/ModelController'); | ||
| const { checkPermission, findAccessibleResources } = require('~/server/services/PermissionService'); | ||
|
|
@@ -194,7 +194,7 @@ const initializeClient = async ({ req, res, signal, endpointOption }) => { | |
| req, | ||
| ctx.accessibleSkillIds, | ||
| codeApiKey, | ||
| ctx.manualSkillPrimedIdsByName, | ||
| ctx.skillPrimedIdsByName, | ||
| ); | ||
| }, | ||
| toolEndCallback, | ||
|
|
@@ -291,19 +291,23 @@ const initializeClient = async ({ req, res, signal, endpointOption }) => { | |
| getCodeGeneratedFiles: db.getCodeGeneratedFiles, | ||
| filterFilesByAgentAccess, | ||
| listSkillsByAccess: db.listSkillsByAccess, | ||
| listAlwaysApplySkills: db.listAlwaysApplySkills, | ||
| getSkillByName: db.getSkillByName, | ||
| }, | ||
| ); | ||
|
|
||
| logger.debug( | ||
| `[initializeClient] Storing tool context for ${primaryConfig.id}: ${primaryConfig.toolDefinitions?.length ?? 0} tools, registry size: ${primaryConfig.toolRegistry?.size ?? '0'}`, | ||
| ); | ||
| /** Maps each manually-primed skill name to the `_id` of the exact doc | ||
| * that was primed. Plumbed to `enrichWithSkillConfigurable` so the | ||
| * read_file handler can pin same-name collision lookups to the | ||
| * resolver's chosen doc. */ | ||
| const manualSkillPrimedIdsByName = buildManualSkillPrimedIdsByName( | ||
| /** Maps each primed skill name (manual `$` or always-apply) to the | ||
| * `_id` of the exact doc that was primed. Plumbed to | ||
| * `enrichWithSkillConfigurable` so the read_file handler can pin | ||
| * same-name collision lookups to the resolver's chosen doc AND relax | ||
| * the disable-model-invocation gate for skills whose body is already | ||
| * in this turn's context. */ | ||
| const skillPrimedIdsByName = buildSkillPrimedIdsByName( | ||
| primaryConfig.manualSkillPrimes, | ||
| primaryConfig.alwaysApplySkillPrimes, | ||
| ); | ||
| agentToolContexts.set(primaryConfig.id, { | ||
| agent: primaryAgent, | ||
|
|
@@ -312,7 +316,7 @@ const initializeClient = async ({ req, res, signal, endpointOption }) => { | |
| tool_resources: primaryConfig.tool_resources, | ||
| actionsEnabled: primaryConfig.actionsEnabled, | ||
| accessibleSkillIds: primaryConfig.accessibleSkillIds, | ||
| manualSkillPrimedIdsByName, | ||
| skillPrimedIdsByName, | ||
| }); | ||
|
|
||
| const agent_ids = primaryConfig.agent_ids; | ||
|
|
@@ -389,6 +393,7 @@ const initializeClient = async ({ req, res, signal, endpointOption }) => { | |
| getCodeGeneratedFiles: db.getCodeGeneratedFiles, | ||
| filterFilesByAgentAccess, | ||
| listSkillsByAccess: db.listSkillsByAccess, | ||
| listAlwaysApplySkills: db.listAlwaysApplySkills, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the handoff-agent initialization path, Useful? React with πΒ / π.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 06b7aed. Valid finding β handoff agents go through the same |
||
| getSkillByName: db.getSkillByName, | ||
| }, | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block now injects
alwaysApplySkillPrimes, but tool execution still buildsmanualSkillPrimedIdsByNamefrom manual primes only (viabuildManualSkillPrimedIdsByName(...)in the agent init/service path). As a result,read_filedoes not treat always-applied skills as βprimed this turnβ: always-applied skills withdisable-model-invocation: trueget blocked from reading their own files, and same-name collisions can resolve files from a different skill document than the one whose body was primed.Useful? React with πΒ / π.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in fe078cc. Valid finding β the
read_filehandler was only receiving manual primes inskillPrimedIdsByName, so always-apply skills withdisable-model-invocation: truegot blocked reading their own bundled files and same-name collisions could shadow the primed doc. RenamedbuildManualSkillPrimedIdsByNameβbuildSkillPrimedIdsByName(accepts both manual + always-apply arrays), renamed the configurable field toskillPrimedIdsByNamethroughout, and expanded the gate-relaxation doc and tests. Manual wins on the rare overlap case. Added two new tests: gate-relaxation fires for always-apply, and_idpinning works for always-apply same-name collisions.