mirror of
https://github.com/hansjone/dsh-ops-cron.git
synced 2026-10-09 00:43:22 +08:00
Normalize doubled provider/model routes on cron create and fire.
Agents often pass zte/Qwen3-… as both provider and model; split combined routes so scheduled runs resolve a real model. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3ce60b200c
commit
4472a9c74b
5 changed files with 95 additions and 15 deletions
|
|
@ -116,6 +116,42 @@ test('resolveCreateCwd prefers explicit cwd then the calling session', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('resolveCreateModel / normalizeJobModel split doubled provider/model routes', async (t) => {
|
||||
const { normalizeJobModel, splitProviderModel } = await import('../lib/store.js')
|
||||
assert.deepEqual(
|
||||
splitProviderModel('zte/Qwen3-235B-A22B', 'zte/Qwen3-235B-A22B'),
|
||||
{ provider: 'zte', model: 'Qwen3-235B-A22B' },
|
||||
)
|
||||
assert.deepEqual(
|
||||
splitProviderModel('zte', 'zte/Qwen3-235B-A22B'),
|
||||
{ provider: 'zte', model: 'Qwen3-235B-A22B' },
|
||||
)
|
||||
assert.deepEqual(
|
||||
splitProviderModel('', 'zte/Qwen3-235B-A22B'),
|
||||
{ provider: 'zte', model: 'Qwen3-235B-A22B' },
|
||||
)
|
||||
// Legitimate model id with slash under a distinct provider stays intact.
|
||||
assert.deepEqual(
|
||||
splitProviderModel('openai', 'org/custom-model'),
|
||||
{ provider: 'openai', model: 'org/custom-model' },
|
||||
)
|
||||
assert.deepEqual(
|
||||
normalizeJobModel({ provider: 'zte/Qwen3-235B-A22B', model: 'zte/Qwen3-235B-A22B' }),
|
||||
{ provider: 'zte', model: 'Qwen3-235B-A22B', reasoningEffort: '' },
|
||||
)
|
||||
assert.deepEqual(
|
||||
resolveCreateModel(
|
||||
{ provider: 'zte/Qwen3-235B-A22B', model: 'zte/Qwen3-235B-A22B' },
|
||||
{ agent: { options: { provider: 'other', model: 'other-model' } } },
|
||||
),
|
||||
{ provider: 'zte', model: 'Qwen3-235B-A22B', reasoningEffort: '' },
|
||||
)
|
||||
assert.deepEqual(
|
||||
resolveCreateModel({}, { agent: { options: { provider: 'zte/Qwen3-235B-A22B', model: 'zte/Qwen3-235B-A22B' } } }),
|
||||
{ provider: 'zte', model: 'Qwen3-235B-A22B', reasoningEffort: '' },
|
||||
)
|
||||
})
|
||||
|
||||
test('cron_create hour+minute uses today and rejects a guessed past calendar date', async (t) => {
|
||||
const dir = await mkdtemp(join(tmpdir(), 'dsh-cron-tools-'))
|
||||
t.after(() => rm(dir, { recursive: true, force: true }))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue