Merge branch 'master' into cleanup/compact-persistence-schema
This commit is contained in:
commit
41c10a62c2
551 files changed
+10611
-1713
No files matched your search
@@ -112,6 +112,37 @@ describe('archived Agent Notes', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it.each([
|
||||
{
|
||||
path: 'feature/2026-08-10-durable-workflow-runs-in-chat.md',
|
||||
before: 'sha256:f9f5290cd880908d17b1080ae5776f22e182f5253471f90cf8bead418b33b502',
|
||||
after: 'sha256:6018de4a89ca99d6cbfd618aff1c8136b23d8e4854a30f7b12a602f0417cbdc2',
|
||||
},
|
||||
{
|
||||
path: 'feature/2026-08-10-durable-workflow-runs-in-chat.zh.md',
|
||||
before: 'sha256:f4ffd2700bc9c2a0cc4b9d90f84e1d0a576939e2e6f0b130c5b142fd8cd518b0',
|
||||
after: 'sha256:0080859221773122022d5880efa3d52f29c0872b52d63e170250d94f214ff37a',
|
||||
},
|
||||
{
|
||||
path: 'feature/2026-08-10-durable-workflow-runs-in-chat.i18n.yaml',
|
||||
before: 'sha256:0db3c21a3c8785e56d5d7b90df990b158069cd1cea664e62fc4786c6d7588450',
|
||||
after: 'sha256:03eadb60c8ba4fde262cd61e3f911d8cd68ea4a58f57adeb8dd7bb9a97d08ca2',
|
||||
},
|
||||
])('accepts only the authorized seal transition for $path', ({ path, before, after }) => {
|
||||
const manifest = (hash: string): ArchiveManifest => ({ version: 1, files: { [path]: hash } })
|
||||
expect(validateArchiveManifestExtension(manifest(before), manifest(after))).toEqual([])
|
||||
expect(validateArchiveManifestExtension(manifest(after), manifest(before))).toEqual([
|
||||
`${path}: sealed manifest hash changed`,
|
||||
])
|
||||
expect(validateArchiveManifestExtension(manifest(before), manifest('sha256:' + '0'.repeat(64)))).toHaveLength(1)
|
||||
expect(validateArchiveManifestExtension(manifest('sha256:' + '0'.repeat(64)), manifest(after))).toHaveLength(1)
|
||||
expect(validateArchiveManifestExtension(manifest(before), { version: 1, files: {} })).toHaveLength(1)
|
||||
expect(validateArchiveManifestExtension(
|
||||
{ version: 1, files: { 'process/other.md': before } },
|
||||
{ version: 1, files: { 'process/other.md': after } },
|
||||
)).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('round-trips the deterministic manifest schema', () => {
|
||||
const content = renderArchiveManifest({ 'process/z.md': `sha256:${'a'.repeat(64)}` })
|
||||
expect(parseArchiveManifest(content)).toEqual({
|
||||
|
||||
@@ -53,7 +53,26 @@ export function renderArchiveManifest(files: Readonly<Record<string, string>>):
|
||||
}, null, 2)}\n`
|
||||
}
|
||||
|
||||
/** Reject changes or removals of entries sealed by a prior manifest. */
|
||||
// Exact seals for the authorized Figma-link removal and its bilingual sidecar.
|
||||
const figmaLinkRemovals = [
|
||||
{
|
||||
path: 'feature/2026-08-10-durable-workflow-runs-in-chat.md',
|
||||
before: 'sha256:f9f5290cd880908d17b1080ae5776f22e182f5253471f90cf8bead418b33b502',
|
||||
after: 'sha256:6018de4a89ca99d6cbfd618aff1c8136b23d8e4854a30f7b12a602f0417cbdc2',
|
||||
},
|
||||
{
|
||||
path: 'feature/2026-08-10-durable-workflow-runs-in-chat.zh.md',
|
||||
before: 'sha256:f4ffd2700bc9c2a0cc4b9d90f84e1d0a576939e2e6f0b130c5b142fd8cd518b0',
|
||||
after: 'sha256:0080859221773122022d5880efa3d52f29c0872b52d63e170250d94f214ff37a',
|
||||
},
|
||||
{
|
||||
path: 'feature/2026-08-10-durable-workflow-runs-in-chat.i18n.yaml',
|
||||
before: 'sha256:0db3c21a3c8785e56d5d7b90df990b158069cd1cea664e62fc4786c6d7588450',
|
||||
after: 'sha256:03eadb60c8ba4fde262cd61e3f911d8cd68ea4a58f57adeb8dd7bb9a97d08ca2',
|
||||
},
|
||||
]
|
||||
|
||||
/** Reject sealed changes except the exact authorized Figma-link removal hashes. */
|
||||
export function validateArchiveManifestExtension(
|
||||
baseline: ArchiveManifest,
|
||||
current: ArchiveManifest,
|
||||
@@ -62,7 +81,9 @@ export function validateArchiveManifestExtension(
|
||||
for (const [path, expected] of Object.entries(baseline.files)) {
|
||||
const actual = current.files[path]
|
||||
if (actual === undefined) errors.push(`${path}: sealed manifest entry is missing`)
|
||||
else if (actual !== expected) errors.push(`${path}: sealed manifest hash changed`)
|
||||
else if (actual !== expected && !figmaLinkRemovals.some(change =>
|
||||
change.path === path && change.before === expected && change.after === actual,
|
||||
)) errors.push(`${path}: sealed manifest hash changed`)
|
||||
}
|
||||
return errors
|
||||
}
|
||||
|
||||
@@ -52,7 +52,9 @@ export { REGION_BEGIN, REGION_END }
|
||||
export const SERVICE_PAGE: Record<string, string> = {
|
||||
speechToText: 'voice-input.md',
|
||||
speechController: 'voice-input.md',
|
||||
otel: 'otel.md',
|
||||
productTelemetry: 'product-telemetry.md',
|
||||
productAnalytics: 'product-telemetry.md',
|
||||
connection: 'web-server.md',
|
||||
pluginManager: 'boot.md',
|
||||
pluginRegistryProbe: 'boot.md',
|
||||
@@ -273,6 +275,12 @@ export const EVENT_WALK_EXEMPTIONS: Record<string, string> = {
|
||||
* appear on more than one page.
|
||||
*/
|
||||
export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
EventLogOptions: 'otel.md',
|
||||
EventLogReporter: 'otel.md',
|
||||
SessionLogOptions: 'otel.md',
|
||||
SessionLogReporter: 'otel.md',
|
||||
OTelEventRecord: 'otel.md',
|
||||
OTelEventScalar: 'otel.md',
|
||||
ProductTelemetryRecord: 'product-telemetry.md',
|
||||
ProductTelemetryScalar: 'product-telemetry.md',
|
||||
WorkspaceChangesSummary: 'deliverables.md',
|
||||
@@ -827,6 +835,7 @@ export const FOUNDATION_TYPE_NAMES: ReadonlySet<string> = new Set([
|
||||
|
||||
/** Project types deliberately documented outside the subsystems catalog. */
|
||||
export const TYPE_LINK_EXEMPTIONS: Readonly<Record<string, string>> = {
|
||||
ProductEvent: 'Desktop event fields are owned by packages/client/product-analytics/README.md and src/events.ts',
|
||||
ConnectionFetchHandler: 'shared Fetch dispatch is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionRequestRejection: 'transport rejection status is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionTrustRequest: 'transport authentication input is owned by packages/client/connection/src/rpc.ts',
|
||||
|
||||
@@ -405,6 +405,21 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
consumers: ['llm-pi-ai'],
|
||||
note: 'Flows are registered by the plugin that knows how to obtain one credential and keyed by the record they write; the seam owns the conversation and the one-attempt-per-key lifecycle, never the protocol.',
|
||||
},
|
||||
{
|
||||
key: 'productAnalytics',
|
||||
pkg: 'client-product-analytics',
|
||||
title: 'Desktop interaction collection',
|
||||
mode: 'service',
|
||||
note: 'Accepts selected Desktop events, enriches available login identity, and observes live compaction under the live Host collection policy.',
|
||||
},
|
||||
{
|
||||
key: 'otel',
|
||||
pkg: 'otel',
|
||||
title: 'Shared OTel reporting channels',
|
||||
mode: 'service',
|
||||
consumers: ['host-product-telemetry-otel', 'session-telemetry-otel'],
|
||||
note: 'Product analytics and Session feedback adapters create independent reporting channels through one injected service.',
|
||||
},
|
||||
{
|
||||
key: 'productTelemetry',
|
||||
pkg: 'host-product-telemetry-otel',
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
* `Events` parameter tuple. Zero matches require `@dshScopeScan unsupported`;
|
||||
* multiple matches are ambiguous and always fail loud.
|
||||
*
|
||||
* `tsx scripts/gen-scoped-events.ts` -> write the generated source
|
||||
* `tsx scripts/gen-scoped-events.ts --check` -> exit 1 when it is stale
|
||||
* `pnpm run gen-scoped-events` -> write the generated source
|
||||
* `pnpm run verify-scoped-events` -> exit 1 when it is stale
|
||||
*/
|
||||
|
||||
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
|
||||
@@ -374,6 +374,18 @@ async function waitForLockTestBarrier(path) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Windows can deny access to a deleted lock until its last reader closes it. */
|
||||
async function accessInstallLock(operation, deadline) {
|
||||
while (true) {
|
||||
try {
|
||||
return operation()
|
||||
} catch (error) {
|
||||
if (process.platform !== 'win32' || errorCode(error) !== 'EPERM' || Date.now() >= deadline) throw error
|
||||
await new Promise(resolveWait => setTimeout(resolveWait, INSTALL_LOCK_POLL_MS))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function acquireInstallLock(commonDirectory) {
|
||||
const lockPath = join(commonDirectory, INSTALL_LOCK)
|
||||
const deadline = Date.now() + INSTALL_LOCK_TIMEOUT_MS
|
||||
@@ -382,7 +394,7 @@ async function acquireInstallLock(commonDirectory) {
|
||||
let observeBarrier = process.env.DSH_TEST_LEFTHOOK_LOCK_OBSERVE_BARRIER
|
||||
while (true) {
|
||||
try {
|
||||
const lockHandle = openSync(lockPath, 'wx', 0o600)
|
||||
const lockHandle = await accessInstallLock(() => openSync(lockPath, 'wx', 0o600), deadline)
|
||||
let ownedStat
|
||||
try {
|
||||
ownedStat = fstatSync(lockHandle)
|
||||
@@ -405,14 +417,14 @@ async function acquireInstallLock(commonDirectory) {
|
||||
return () => releaseInstallLock(lockPath, ownedRecord, ownedStat)
|
||||
} catch (error) {
|
||||
if (errorCode(error) !== 'EEXIST') throw error
|
||||
const existingStat = installLockStat(lockPath)
|
||||
const existingStat = await accessInstallLock(() => installLockStat(lockPath), deadline)
|
||||
if (existingStat === undefined) continue
|
||||
if (!existingStat.isFile() || existingStat.isSymbolicLink()) {
|
||||
throw manualLockRecoveryError(lockPath, 'invalid')
|
||||
}
|
||||
const existingRecord = readInstallLock(lockPath)
|
||||
const existingRecord = await accessInstallLock(() => readInstallLock(lockPath), deadline)
|
||||
if (existingRecord === undefined) continue
|
||||
const verifiedStat = installLockStat(lockPath)
|
||||
const verifiedStat = await accessInstallLock(() => installLockStat(lockPath), deadline)
|
||||
if (verifiedStat === undefined) continue
|
||||
if (!verifiedStat.isFile() || verifiedStat.isSymbolicLink()) {
|
||||
throw manualLockRecoveryError(lockPath, 'invalid')
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
mkdtempSync,
|
||||
lstatSync,
|
||||
readFileSync,
|
||||
realpathSync,
|
||||
renameSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
@@ -158,9 +159,15 @@ function gitDirectory(fixture: Fixture, root: string): string {
|
||||
return git(fixture, root, ['rev-parse', '--absolute-git-dir'])
|
||||
}
|
||||
|
||||
// The installer resolves the common directory against Git's own top-level path, and the host
|
||||
// spells that path differently from the fixture directory this file created: Git canonicalizes
|
||||
// Windows 8.3 short names and the macOS `/var` symlink, while `mkdtempSync` returns the temp
|
||||
// directory's own spelling. Canonicalizing the fixture-side directory collapses both spellings
|
||||
// onto the one directory the installer touches, so an injected failure on this path reaches the
|
||||
// installer's own lock instead of a differently spelled name for it.
|
||||
function commonDirectory(fixture: Fixture): string {
|
||||
const output = git(fixture, fixture.main, ['rev-parse', '--git-common-dir'])
|
||||
return isAbsolute(output) ? output : resolve(fixture.main, output)
|
||||
return realpathSync.native(isAbsolute(output) ? output : resolve(fixture.main, output))
|
||||
}
|
||||
|
||||
function hooksPath(fixture: Fixture, root: string): string {
|
||||
@@ -183,9 +190,10 @@ function runInstaller(
|
||||
fixture: Fixture,
|
||||
root: string,
|
||||
extraEnv: NodeJS.ProcessEnv = {},
|
||||
nodeArgs: string[] = [],
|
||||
): Promise<CommandResult> {
|
||||
return new Promise((resolveResult, reject) => {
|
||||
const child = spawn(process.execPath, [installer], {
|
||||
const child = spawn(process.execPath, [...nodeArgs, installer], {
|
||||
cwd: root,
|
||||
env: { ...fixture.env, ...extraEnv },
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
@@ -320,6 +328,76 @@ describe('worktree-local Lefthook installer', { timeout: 90_000 }, () => {
|
||||
expect(existsSync(join(hooksPath(fixture, fixture.main), '.fake-lefthook-running'))).toBe(false)
|
||||
})
|
||||
|
||||
/** Inject one lock-access failure and assert the installer's documented outcome. */
|
||||
async function expectInjectedLockAccessFailure(
|
||||
fixture: Fixture,
|
||||
{ operation, code, expires }: { operation: string; code: string; expires: boolean },
|
||||
): Promise<void> {
|
||||
const lockPath = installLockPath(fixture)
|
||||
const probe = join(fixture.container, 'lock-access-probe')
|
||||
const preload = join(fixture.container, 'lock-access.cjs')
|
||||
if (operation !== 'openSync') {
|
||||
writeFileSync(lockPath, `${process.pid} 00000000-0000-4000-8000-000000000001\n`)
|
||||
}
|
||||
// The subprocess owns the injected filesystem error and clock; the test process stays unchanged.
|
||||
writeFileSync(preload, `
|
||||
const fs = require('node:fs')
|
||||
const { syncBuiltinESMExports } = require('node:module')
|
||||
const lockPath = ${JSON.stringify(lockPath)}
|
||||
const operation = ${JSON.stringify(operation)}
|
||||
const original = fs[operation]
|
||||
const now = Date.now
|
||||
let injected = false
|
||||
fs[operation] = function(path, ...args) {
|
||||
if (path === lockPath && !injected) {
|
||||
injected = true
|
||||
fs.writeFileSync(${JSON.stringify(probe)}, 'injected')
|
||||
if (operation !== 'openSync') fs.unlinkSync(lockPath)
|
||||
if (${expires}) Date.now = () => now() + 31000
|
||||
throw Object.assign(new Error('injected lock access failure'), { code: ${JSON.stringify(code)} })
|
||||
}
|
||||
return original.call(this, path, ...args)
|
||||
}
|
||||
syncBuiltinESMExports()
|
||||
`)
|
||||
|
||||
const result = await runInstaller(fixture, fixture.main, {}, ['--require', preload])
|
||||
|
||||
expect(existsSync(probe), `lock injection missing: exit ${result.status}\n${result.stderr}`).toBe(true)
|
||||
expect(readFileSync(probe, 'utf8')).toBe('injected')
|
||||
const recovers = process.platform === 'win32' && code === 'EPERM' && !expires
|
||||
expect(result.status, result.stderr).toBe(recovers ? 0 : 1)
|
||||
if (recovers) {
|
||||
expect(existsSync(join(hooksPath(fixture, fixture.main), 'pre-push'))).toBe(true)
|
||||
expect(existsSync(lockPath)).toBe(false)
|
||||
} else {
|
||||
expect(result.stderr).toContain('injected lock access failure')
|
||||
expect(existsSync(hooksPath(fixture, fixture.main))).toBe(false)
|
||||
}
|
||||
}
|
||||
|
||||
it.each([
|
||||
{ operation: 'openSync', code: 'EPERM', expires: false },
|
||||
{ operation: 'readFileSync', code: 'EPERM', expires: false },
|
||||
{ operation: 'lstatSync', code: 'EPERM', expires: false },
|
||||
{ operation: 'openSync', code: 'EPERM', expires: true },
|
||||
{ operation: 'openSync', code: 'EACCES', expires: false },
|
||||
])('handles $operation $code with expired deadline=$expires', async ({ operation, code, expires }) => {
|
||||
await expectInjectedLockAccessFailure(createFixture(), { operation, code, expires })
|
||||
})
|
||||
|
||||
// The alias forces the installer's resolved common directory to differ from the path this spec
|
||||
// composes on every host — a junction on Windows, a directory symlink elsewhere — instead of
|
||||
// depending on a runner whose temp directory happens to carry a short name.
|
||||
it('handles an injected lock failure through an aliased worktree root', async () => {
|
||||
const fixture = createFixture()
|
||||
const alias = join(fixture.container, 'main-alias')
|
||||
symlinkSync(fixture.main, alias, process.platform === 'win32' ? 'junction' : 'dir')
|
||||
fixture.main = alias
|
||||
|
||||
await expectInjectedLockAccessFailure(fixture, { operation: 'openSync', code: 'EPERM', expires: false })
|
||||
})
|
||||
|
||||
it('waits for a concurrent installer to finish publishing its lock record', async () => {
|
||||
const fixture = createFixture()
|
||||
const lockPath = installLockPath(fixture)
|
||||
|
||||
@@ -619,9 +619,6 @@
|
||||
"packages/client/ui-plan/tests/plan-resource.client.spec.ts": {
|
||||
"fa53d5cd55d87b522c83a98968e3a2bf933b1cc1b84d2f009e79d6c702099786": 1
|
||||
},
|
||||
"packages/client/ui-plugin-manager/tests/browser-plugin.client.spec.tsx": {
|
||||
"04984a2ce1486250236e638e0197da0a1a840855ed3975c59130a85358c7e5fe": 1
|
||||
},
|
||||
"packages/client/ui-primitives/tests/highlight-viewport.client.spec.tsx": {
|
||||
"6061de0a1e01547eb1abf9d4e1b5fa79fda112fa35dda980775491123413dcce": 1
|
||||
},
|
||||
|
||||
@@ -41,13 +41,39 @@ describe('optional bundles', () => {
|
||||
it.each(OPTIONAL_BUNDLES)('%s composes over the Web profile without a skipped patch', (name) => {
|
||||
const { patches } = bundle(name)
|
||||
const warnings: string[] = []
|
||||
const ids = new Set(composeEntries([...shipped, patches], message => warnings.push(message)).map(entry => entry.id))
|
||||
const composed = composeEntries([...shipped, patches], message => warnings.push(message))
|
||||
const ids = new Set(composed.map(entry => entry.id))
|
||||
expect(warnings).toEqual([])
|
||||
// Inserted rows carry stable ids at the profile root, so a later profile patch can configure or disable them.
|
||||
for (const row of patches.flatMap(patch => patch.insert ?? [])) {
|
||||
expect(typeof row.id).toBe('string')
|
||||
expect(ids.has(row.id)).toBe(true)
|
||||
}
|
||||
// One top-level row per id: a duplicate declaration leaves the Loader with the last one, silently
|
||||
// replacing the layer that declared the id first.
|
||||
const topLevelIds = composed.flatMap(entry => typeof entry.id === 'string' ? [entry.id] : [])
|
||||
expect(topLevelIds).toHaveLength(new Set(topLevelIds).size)
|
||||
// An id-targeted patch reaches a row another layer inserted: the id resolves to exactly one top-level
|
||||
// row, and the override keeps the package the shipped layer declared on it.
|
||||
const shippedComposed = composeEntries([...shipped])
|
||||
for (const patch of patches) {
|
||||
if (patch.insert !== undefined || typeof patch.id !== 'string') continue
|
||||
const matches = composed.filter(entry => entry.id === patch.id)
|
||||
expect(matches).toHaveLength(1)
|
||||
expect(matches[0]?.name).toBe(shippedComposed.find(entry => entry.id === patch.id)?.name)
|
||||
}
|
||||
})
|
||||
|
||||
it('adds the three Schedule rows the shipped Web composition leaves out', () => {
|
||||
const { patches } = bundle('@deepseek-ai/dsh-experimental-schedule-bundle')
|
||||
const scheduleRows = (entries: ReturnType<typeof composeEntries>) =>
|
||||
entries.filter(entry => ['time-context', 'schedule', 'ui-schedule'].includes(entry.id))
|
||||
expect(scheduleRows(composeEntries(shipped))).toEqual([])
|
||||
expect(scheduleRows(composeEntries([...shipped, patches]))).toEqual([
|
||||
{ id: 'time-context', name: '@deepseek-ai/dsh-time-context' },
|
||||
{ id: 'schedule', name: '@deepseek-ai/dsh-schedule' },
|
||||
{ id: 'ui-schedule', name: '@deepseek-ai/dsh-client-ui-schedule' },
|
||||
])
|
||||
})
|
||||
|
||||
it.each(OPTIONAL_BUNDLES)('%s resolves a title, description, and icon in both shipped languages', (name) => {
|
||||
|
||||
@@ -62,6 +62,7 @@ describe('release families', () => {
|
||||
'@deepseek-ai/dsh-experimental-computer-use-cua-driver-native',
|
||||
'@deepseek-ai/dsh-experimental-inspector',
|
||||
'@deepseek-ai/dsh-experimental-ptc-runtime-python',
|
||||
'@deepseek-ai/dsh-experimental-schedule-bundle',
|
||||
'@deepseek-ai/dsh-experimental-speech-to-text-sensevoice',
|
||||
'@deepseek-ai/dsh-experimental-speech-to-text',
|
||||
'@deepseek-ai/dsh-experimental-tool-agent-team',
|
||||
|
||||
@@ -105,6 +105,11 @@ RESTART_SECOND_PROMPT = "Complete the second isolated Python SDK process turn."
|
||||
RESTART_SECOND_TEXT = "PROCESS_TWO_OK"
|
||||
RESTART_FIRST_SESSION_ID = "process-one"
|
||||
RESTART_SECOND_SESSION_ID = "process-two"
|
||||
RECOVERY_PROMPT = "Run three todo updates; the scheduler will reject the second call."
|
||||
RECOVERY_CONTINUE_PROMPT = "Continue after the scheduler failure without repeating any tools."
|
||||
RECOVERY_TEXT = "SCHEDULER_RECOVERY_OK"
|
||||
RECOVERY_SESSION_ID = "scheduler-recovery"
|
||||
RECOVERY_CALL_IDS = ("scheduler-complete", "scheduler-fail", "scheduler-unstarted")
|
||||
SNAPSHOT_WORKFLOW_SCRIPT = (
|
||||
"phase('Delegate')\n"
|
||||
f"const reply = await agent('{SNAPSHOT_WORKFLOW_CHILD_PROMPT}', {{ label: 'workflow-child' }})\n"
|
||||
@@ -136,6 +141,10 @@ RESTART_SNAPSHOT_DIRECTORY = (
|
||||
RESTART_SNAPSHOT_FILENAMES = (
|
||||
"result.json", "requests.json", "session.1.v3.jsonl", "session.2.v3.jsonl",
|
||||
)
|
||||
RECOVERY_SNAPSHOT_DIRECTORY = (
|
||||
Path(__file__).resolve().parent / "snapshots" / "python-sdk-single-exe" / "scheduler-recovery"
|
||||
)
|
||||
RECOVERY_SNAPSHOT_FILENAMES = ("result.json", "requests.json", "session.v4.jsonl")
|
||||
MCP_SERVER_SCRIPT = """\
|
||||
import json
|
||||
import os
|
||||
@@ -316,6 +325,32 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]:
|
||||
if not isinstance(latest, dict):
|
||||
raise AssertionError(f"model request has an invalid latest message: {body}")
|
||||
|
||||
recovery_prompt = next((
|
||||
block.get("text")
|
||||
for block in latest.get("content", [])
|
||||
if isinstance(block, dict) and block.get("type") == "text"
|
||||
and block.get("text") in {RECOVERY_PROMPT, RECOVERY_CONTINUE_PROMPT}
|
||||
), None)
|
||||
if recovery_prompt == RECOVERY_PROMPT:
|
||||
assert_advertised_tool(body, "todo_write")
|
||||
chunks = [message_start()]
|
||||
for index, call_id in enumerate(RECOVERY_CALL_IDS):
|
||||
call = tool_call_chunks(call_id, "todo_write", {"todos": []})
|
||||
chunks.extend({**chunk, "index": index} for chunk in call[1:-2])
|
||||
chunks.extend(call[-2:])
|
||||
return chunks
|
||||
if recovery_prompt == RECOVERY_CONTINUE_PROMPT:
|
||||
results = [
|
||||
block for message in messages
|
||||
for block in message.get("content", [])
|
||||
if isinstance(block, dict) and block.get("type") == "tool_result"
|
||||
]
|
||||
if [result.get("tool_use_id") for result in results] != list(RECOVERY_CALL_IDS):
|
||||
raise AssertionError(f"recovered history lost tool-result pairing: {results}")
|
||||
if [result.get("is_error", False) for result in results] != [False, True, True]:
|
||||
raise AssertionError(f"recovered history changed completed or pending outcomes: {results}")
|
||||
return text_chunks(RECOVERY_TEXT)
|
||||
|
||||
tool_results = [
|
||||
block for block in latest.get("content", [])
|
||||
if isinstance(block, dict) and block.get("type") == "tool_result"
|
||||
@@ -743,7 +778,7 @@ def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument(
|
||||
"--scenario",
|
||||
choices=("all", "sdk-default", "sdk-custom", "sdk-minimal", "sdk-minimal-in-history", "sdk-dynamic-tools", "sdk-fs-search", "sdk-spawn-node", "sdk-mcp", "sdk-snapshot", "sdk-restart", "sdk-profile-plugin", "sdk-office", "sdk-authoring", "sdk-live", "runner", "direct"),
|
||||
choices=("all", "sdk-default", "sdk-custom", "sdk-minimal", "sdk-minimal-in-history", "sdk-dynamic-tools", "sdk-fs-search", "sdk-spawn-node", "sdk-mcp", "sdk-snapshot", "sdk-recovery", "sdk-restart", "sdk-profile-plugin", "sdk-office", "sdk-authoring", "sdk-live", "runner", "direct"),
|
||||
default="all",
|
||||
)
|
||||
parser.add_argument("--exe", type=Path)
|
||||
@@ -762,10 +797,10 @@ def main() -> None:
|
||||
parser.error("--scenario sdk-profile-plugin requires --installed-wheel")
|
||||
if args.installed_wheel:
|
||||
args.exe = assert_installed_wheel_environment()
|
||||
if args.scenario in {"all", "sdk-custom", "sdk-minimal", "sdk-minimal-in-history", "sdk-dynamic-tools", "sdk-fs-search", "sdk-spawn-node", "sdk-snapshot", "sdk-restart", "sdk-office", "sdk-authoring", "runner", "direct"} and args.exe is None:
|
||||
parser.error("--exe is required for custom, minimal, dynamic-tools, fs-search, spawn-node, snapshot, restart, office, runner, and direct scenarios")
|
||||
if args.update_snapshots and args.scenario not in {"all", "sdk-minimal", "sdk-minimal-in-history", "sdk-dynamic-tools", "sdk-snapshot", "sdk-restart", "sdk-authoring"}:
|
||||
parser.error("--update-snapshots requires --scenario sdk-minimal, sdk-minimal-in-history, sdk-dynamic-tools, sdk-snapshot, sdk-restart, sdk-authoring, or all")
|
||||
if args.scenario in {"all", "sdk-custom", "sdk-minimal", "sdk-minimal-in-history", "sdk-dynamic-tools", "sdk-fs-search", "sdk-spawn-node", "sdk-snapshot", "sdk-recovery", "sdk-restart", "sdk-office", "sdk-authoring", "runner", "direct"} and args.exe is None:
|
||||
parser.error("--exe is required for custom, minimal, dynamic-tools, fs-search, spawn-node, snapshot, recovery, restart, office, runner, and direct scenarios")
|
||||
if args.update_snapshots and args.scenario not in {"all", "sdk-minimal", "sdk-minimal-in-history", "sdk-dynamic-tools", "sdk-snapshot", "sdk-recovery", "sdk-restart", "sdk-authoring"}:
|
||||
parser.error("--update-snapshots requires --scenario sdk-minimal, sdk-minimal-in-history, sdk-dynamic-tools, sdk-snapshot, sdk-recovery, sdk-restart, sdk-authoring, or all")
|
||||
if args.exe is not None and not args.exe.is_file():
|
||||
parser.error(f"runtime executable does not exist: {args.exe}")
|
||||
|
||||
@@ -817,6 +852,9 @@ def main() -> None:
|
||||
if args.scenario in {"all", "sdk-snapshot"}:
|
||||
assert args.exe is not None
|
||||
smoke_sdk_snapshot(model.url, args.exe.resolve(), args.update_snapshots)
|
||||
if args.scenario in {"all", "sdk-snapshot", "sdk-recovery"}:
|
||||
assert args.exe is not None
|
||||
smoke_sdk_scheduler_recovery(model.url, args.exe.resolve(), args.update_snapshots)
|
||||
if args.scenario in {"all", "sdk-restart"}:
|
||||
assert args.exe is not None
|
||||
smoke_sdk_restart_snapshot(model.url, args.exe.resolve(), args.update_snapshots)
|
||||
@@ -1641,6 +1679,94 @@ def smoke_sdk_restart_snapshot(base_url: str, executable: Path, update_snapshots
|
||||
)
|
||||
|
||||
|
||||
def smoke_sdk_scheduler_recovery(base_url: str, executable: Path, update_snapshots: bool) -> None:
|
||||
"""Keep a failed tool turn usable through the real Messages serializer and SDK."""
|
||||
from deepseek_harness import DeepSeekHarness
|
||||
|
||||
first_request = len(MockModelHandler.requests)
|
||||
with tempfile.TemporaryDirectory(prefix="dsh-sdk-scheduler-recovery-") as temporary:
|
||||
root = Path(temporary).resolve()
|
||||
dsh_home = root / "home"
|
||||
sessions = dsh_home / "sessions"
|
||||
base_patch = write_advanced_profile_patch(root, "base.patch.yml", sessions)
|
||||
patch = write_profile_patch(root, "recovery.patch.yml", sessions, [
|
||||
{"id": "tool-todo", "disabled": False},
|
||||
{"id": "session-title-llm", "disabled": True},
|
||||
{"id": "session-log-deepseek", "config": {"enabled": False}},
|
||||
{"insert": [{
|
||||
"id": "scheduler-failure-fixture",
|
||||
"name": (
|
||||
Path(__file__).resolve().parent.parent
|
||||
/ "snapshots/sdk/tool-scheduler-recovery/scheduler-failure.mjs"
|
||||
).as_uri(),
|
||||
}]},
|
||||
])
|
||||
|
||||
def connect() -> DeepSeekHarness:
|
||||
return DeepSeekHarness(
|
||||
provider="deepseek-official", model="smoke-model", cwd=str(root),
|
||||
dsh_bin=str(executable), dsh_home=str(dsh_home),
|
||||
patches=(str(base_patch), str(patch)),
|
||||
env={"DSH_PERMISSION_MODE": "danger-full-access", "DSH_TELEMETRY_DISABLED": "1"},
|
||||
api_key="sk-keyless-smoke", base_url=base_url, request_timeout_seconds=60,
|
||||
)
|
||||
|
||||
with connect() as harness:
|
||||
failed = harness.run(RECOVERY_PROMPT, session_id=RECOVERY_SESSION_ID)
|
||||
continued = harness.run(RECOVERY_CONTINUE_PROMPT, session_id=RECOVERY_SESSION_ID)
|
||||
results = [failed, continued]
|
||||
if [result.finish_reason for result in results] != ["error", "completed"]:
|
||||
outcomes = [
|
||||
event["data"]["reason"] for result in results
|
||||
for event in result.events if event.get("type") == "turn/end"
|
||||
]
|
||||
raise AssertionError(f"scheduler recovery did not preserve turn outcomes: {outcomes}")
|
||||
if continued.final_response != RECOVERY_TEXT:
|
||||
raise AssertionError("scheduler recovery lost the continued response")
|
||||
requests = MockModelHandler.requests[first_request:]
|
||||
if len(requests) != 2:
|
||||
raise AssertionError(f"scheduler recovery expected two serialized model requests: {requests}")
|
||||
logs = read_session_logs(sessions)
|
||||
records = logs[RECOVERY_SESSION_ID]
|
||||
calls = [record["data"]["callId"] for record in records if record.get("type") == "tool/call"]
|
||||
if calls != list(RECOVERY_CALL_IDS[:2]):
|
||||
raise AssertionError(f"scheduler recovery dispatched the unstarted call: {calls}")
|
||||
tool_results = [
|
||||
record["data"]["message"]
|
||||
for record in records if record.get("type") == "tool/result"
|
||||
]
|
||||
if [(message.get("role"), message.get("toolCallId"), message.get("isError", False)) for message in tool_results] != [
|
||||
("tool", RECOVERY_CALL_IDS[0], False), ("tool", RECOVERY_CALL_IDS[1], True), ("tool", RECOVERY_CALL_IDS[2], True),
|
||||
]:
|
||||
raise AssertionError(f"scheduler recovery duplicated or lost tool outcomes: {tool_results}")
|
||||
if sum(record.get("type") == "todo/write" for record in records) != 1:
|
||||
raise AssertionError("scheduler recovery executed an unstarted todo update")
|
||||
replacements = [(str(root), "{{cwd}}"), (RECOVERY_SESSION_ID, "{{parent}}")]
|
||||
result_value = [{
|
||||
"session_id": result.session_id,
|
||||
"final_response": result.final_response,
|
||||
"finish_reason": result.finish_reason,
|
||||
"eventTypes": [event.get("type") for event in result.events],
|
||||
"notificationMethods": [notification.method for notification in result.notifications],
|
||||
} for result in results]
|
||||
request_value = [{
|
||||
"model": request.get("model"),
|
||||
"messages": restart_request_messages(request),
|
||||
} for request in requests]
|
||||
normalized_records = project_session_snapshot([
|
||||
normalize_snapshot_value(record, replacements) for record in records
|
||||
])
|
||||
content = render_jsonl(normalized_records)
|
||||
files = {
|
||||
"result.json": json.dumps(normalize_snapshot_value(result_value, replacements), indent=2) + "\n",
|
||||
"requests.json": json.dumps(normalize_snapshot_value(request_value, replacements), indent=2) + "\n",
|
||||
snapshot_session_filename(0, session_header_version(content, "scheduler recovery")): content,
|
||||
}
|
||||
compare_snapshot_files(
|
||||
files, update_snapshots, RECOVERY_SNAPSHOT_DIRECTORY, RECOVERY_SNAPSHOT_FILENAMES,
|
||||
)
|
||||
|
||||
|
||||
def smoke_direct(base_url: str, executable: Path) -> None:
|
||||
with tempfile.TemporaryDirectory(prefix="dsh-direct-") as temporary:
|
||||
root = Path(temporary).resolve()
|
||||
@@ -2433,7 +2559,19 @@ def normalize_snapshot_value(
|
||||
if isinstance(dt, list):
|
||||
member["dt"] = [0] * len(dt)
|
||||
if isinstance(normalized.get("id"), str) and normalized.get("role") in ("assistant", "system", "user", "tool", "developer"):
|
||||
if not normalized["id"].startswith("{{message:"):
|
||||
# Replay fixtures retain deterministic repair ids with the call id and original event sequence.
|
||||
source = normalized.get("source")
|
||||
call_id = normalized.get("toolCallId") if normalized.get("role") == "tool" else (
|
||||
source.get("callId") if isinstance(source, dict) and source.get("kind") == "tool" else None
|
||||
)
|
||||
repair_prefix = (
|
||||
f"interrupted-tool-result-{call_id}-" if isinstance(call_id, str) else None
|
||||
)
|
||||
repair_id = (
|
||||
repair_prefix is not None and normalized["id"].startswith(repair_prefix)
|
||||
and normalized["id"][len(repair_prefix):].isdigit()
|
||||
)
|
||||
if not normalized["id"].startswith("{{message:") and not repair_id:
|
||||
normalized["id"] = "{{messageId}}"
|
||||
if normalized.get("type") in ("feedback/message-put", "feedback/message-delete"):
|
||||
data = normalized.get("data")
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
[
|
||||
{
|
||||
"model": "smoke-model",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Run three todo updates; the scheduler will reject the second call."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically \u2014 do not request sandbox escalation (do not set `sandbox_permissions`)."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"model": "smoke-model",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Run three todo updates; the scheduler will reject the second call."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically \u2014 do not request sandbox escalation (do not set `sandbox_permissions`)."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": [
|
||||
{
|
||||
"type": "tool_use",
|
||||
"id": "scheduler-complete",
|
||||
"name": "todo_write",
|
||||
"input": {
|
||||
"todos": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "tool_use",
|
||||
"id": "scheduler-fail",
|
||||
"name": "todo_write",
|
||||
"input": {
|
||||
"todos": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "tool_use",
|
||||
"id": "scheduler-unstarted",
|
||||
"name": "todo_write",
|
||||
"input": {
|
||||
"todos": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "tool_result",
|
||||
"tool_use_id": "scheduler-complete",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Updated todo list: 0 pending, 0 in progress, 0 completed."
|
||||
}
|
||||
],
|
||||
"is_error": false
|
||||
},
|
||||
{
|
||||
"type": "tool_result",
|
||||
"tool_use_id": "scheduler-fail",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "The tool call was interrupted after it was recorded, but no result was durably recorded. Its outcome is unknown. Decide whether to retry from the tool semantics: retry only if the operation is read-only or idempotent; if it may have side effects, first verify external state or ask the user. Do not retry blindly."
|
||||
}
|
||||
],
|
||||
"is_error": true
|
||||
},
|
||||
{
|
||||
"type": "tool_result",
|
||||
"tool_use_id": "scheduler-unstarted",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed."
|
||||
}
|
||||
],
|
||||
"is_error": true
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Continue after the scheduler failure without repeating any tools."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,78 @@
|
||||
[
|
||||
{
|
||||
"session_id": "{{parent}}",
|
||||
"final_response": "",
|
||||
"finish_reason": "error",
|
||||
"eventTypes": [
|
||||
"agent/inbox/spliced",
|
||||
"turn/start",
|
||||
"agent/inbox/spliced",
|
||||
"step/start",
|
||||
"system/message",
|
||||
"user/message",
|
||||
"user/message",
|
||||
"request/header",
|
||||
"request/context",
|
||||
"session/title",
|
||||
"assistant/message",
|
||||
"tool/call",
|
||||
"todo/write",
|
||||
"tool/result",
|
||||
"tool/call",
|
||||
"tool/result",
|
||||
"tool/result",
|
||||
"step/end",
|
||||
"turn/end"
|
||||
],
|
||||
"notificationMethods": [
|
||||
"session.event",
|
||||
"session.status",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.status"
|
||||
]
|
||||
},
|
||||
{
|
||||
"session_id": "{{parent}}",
|
||||
"final_response": "SCHEDULER_RECOVERY_OK",
|
||||
"finish_reason": "completed",
|
||||
"eventTypes": [
|
||||
"agent/inbox/spliced",
|
||||
"turn/start",
|
||||
"agent/inbox/spliced",
|
||||
"step/start",
|
||||
"user/message",
|
||||
"assistant/message",
|
||||
"step/end",
|
||||
"turn/end"
|
||||
],
|
||||
"notificationMethods": [
|
||||
"session.event",
|
||||
"session.status",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.event",
|
||||
"session.status"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,31 @@
|
||||
{"type":"session","version":3,"id":"{{parent}}","createdAt":0,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0}
|
||||
{"type":"permission/preset","data":{"preset":"danger-full-access"}}
|
||||
{"type":"sandbox/mode","data":{"mode":"danger-full-access"}}
|
||||
{"type":"approval/policy","data":{"policy":"never"}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Run three todo updates; the scheduler will reject the second call."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}}
|
||||
{"type":"turn/start","data":{"turn":1}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}}
|
||||
{"type":"step/start","data":{"turn":1,"step":1}}
|
||||
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Run three todo updates; the scheduler will reject the second call."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","run_code","subagent","todo_write","workflow"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Run three todo updates; the","messageSeqs":[8],"source":{"kind":"fallback"}}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"},{"type":"tool-call","id":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"},{"type":"tool-call","id":"scheduler-unstarted","name":"todo_write","arguments":"{\"todos\": []}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"},{"type":"tool-call"},{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"scheduler-complete","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"scheduler-complete","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[],"id":"scheduler-fail","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[],"id":"scheduler-fail","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":2,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":2,"dt":[],"id":"scheduler-unstarted","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":2,"dt":[],"id":"scheduler-unstarted","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":2,"block":{"type":"tool-call","id":"scheduler-unstarted","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"},{"type":"tool-call"},{"type":"tool-call"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"}}
|
||||
{"type":"todo/write","data":{"todos":[]}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"scheduler-complete"},"content":[{"type":"tool-result","toolCallId":"scheduler-complete","content":[{"type":"text","text":"Updated todo list: 0 pending, 0 in progress, 0 completed."}],"isError":false}],"role":"user","id":"{{messageId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"id":"interrupted-tool-result-scheduler-fail-18","role":"user","source":{"kind":"tool","callId":"scheduler-fail"},"content":[{"type":"tool-result","toolCallId":"scheduler-fail","isError":true,"content":[{"type":"text","text":"The tool call was interrupted after it was recorded, but no result was durably recorded. Its outcome is unknown. Decide whether to retry from the tool semantics: retry only if the operation is read-only or idempotent; if it may have side effects, first verify external state or ask the user. Do not retry blindly."}]}]},"error":{"name":"ToolOutcomeUnknownError","code":"TOOL_OUTCOME_UNKNOWN"}},"sourceEventSeqs":[17],"surfaceOp":"append"}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"id":"interrupted-tool-result-scheduler-unstarted-19","role":"user","source":{"kind":"tool","callId":"scheduler-unstarted"},"content":[{"type":"tool-result","toolCallId":"scheduler-unstarted","isError":true,"content":[{"type":"text","text":"The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed."}]}]},"error":{"name":"ToolNotStartedError","code":"TOOL_NOT_STARTED"}},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":1}}
|
||||
{"type":"turn/end","data":{"turn":1,"reason":{"kind":"error","error":{"message":"Snapshot scheduler preparation failed","code":"UNKNOWN"}}}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Continue after the scheduler failure without repeating any tools."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}}
|
||||
{"type":"turn/start","data":{"turn":2}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}}
|
||||
{"type":"step/start","data":{"turn":2,"step":1}}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Continue after the scheduler failure without repeating any tools."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"assistant/message","data":{"turn":2,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"SCHEDULER_RECOVERY_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["SCHEDULER_RECOVERY_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"SCHEDULER_RECOVERY_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":2,"step":1}}
|
||||
{"type":"turn/end","data":{"turn":2,"reason":{"kind":"completed"}}}
|
||||
@@ -0,0 +1,31 @@
|
||||
{"type":"session","version":4,"id":"{{parent}}","createdAt":0,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0}
|
||||
{"type":"permission/preset","data":{"preset":"danger-full-access"}}
|
||||
{"type":"sandbox/mode","data":{"mode":"danger-full-access"}}
|
||||
{"type":"approval/policy","data":{"policy":"never"}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Run three todo updates; the scheduler will reject the second call."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}}
|
||||
{"type":"turn/start","data":{"turn":1}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}}
|
||||
{"type":"step/start","data":{"turn":1,"step":1}}
|
||||
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Run three todo updates; the scheduler will reject the second call."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","run_code","subagent","todo_write","workflow"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Run three todo updates; the","messageSeqs":[8],"source":{"kind":"fallback"}}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"},{"type":"tool-call","id":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"},{"type":"tool-call","id":"scheduler-unstarted","name":"todo_write","arguments":"{\"todos\": []}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"},{"type":"tool-call"},{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"scheduler-complete","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"scheduler-complete","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[],"id":"scheduler-fail","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[],"id":"scheduler-fail","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":2,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":2,"dt":[],"id":"scheduler-unstarted","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":2,"dt":[],"id":"scheduler-unstarted","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":2,"block":{"type":"tool-call","id":"scheduler-unstarted","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"},{"type":"tool-call"},{"type":"tool-call"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"}}
|
||||
{"type":"todo/write","data":{"todos":[]}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"scheduler-complete"},"toolCallId":"scheduler-complete","content":[{"type":"text","text":"Updated todo list: 0 pending, 0 in progress, 0 completed."}],"isError":false,"id":"{{messageId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"id":"interrupted-tool-result-scheduler-fail-18","role":"tool","toolCallId":"scheduler-fail","isError":true,"source":{"kind":"tool","callId":"scheduler-fail"},"content":[{"type":"text","text":"The tool call was interrupted after it was recorded, but no result was durably recorded. Its outcome is unknown. Decide whether to retry from the tool semantics: retry only if the operation is read-only or idempotent; if it may have side effects, first verify external state or ask the user. Do not retry blindly."}]},"error":{"name":"ToolOutcomeUnknownError","code":"TOOL_OUTCOME_UNKNOWN"}},"sourceEventSeqs":[17],"surfaceOp":"append"}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"id":"interrupted-tool-result-scheduler-unstarted-19","role":"tool","toolCallId":"scheduler-unstarted","isError":true,"source":{"kind":"tool","callId":"scheduler-unstarted"},"content":[{"type":"text","text":"The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed."}]},"error":{"name":"ToolNotStartedError","code":"TOOL_NOT_STARTED"}},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":1}}
|
||||
{"type":"turn/end","data":{"turn":1,"reason":{"kind":"error","error":{"message":"Snapshot scheduler preparation failed","code":"UNKNOWN"}}}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Continue after the scheduler failure without repeating any tools."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}}
|
||||
{"type":"turn/start","data":{"turn":2}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}}
|
||||
{"type":"step/start","data":{"turn":2,"step":1}}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Continue after the scheduler failure without repeating any tools."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"assistant/message","data":{"turn":2,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"SCHEDULER_RECOVERY_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["SCHEDULER_RECOVERY_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"SCHEDULER_RECOVERY_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":2,"step":1}}
|
||||
{"type":"turn/end","data":{"turn":2,"reason":{"kind":"completed"}}}
|
||||
@@ -45,11 +45,13 @@ const NO_MODEL_EXPERIENCE_SECTION: Readonly<Record<string, string>> = {
|
||||
* blocks. A package moves on or off this list with its context behavior.
|
||||
*/
|
||||
const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/product-analytics': { kind: 'none', reason: 'Desktop analytics observes selected interactions without contributing model context or Session events.' },
|
||||
'packages/experimental/speech-to-text': { kind: 'none', reason: 'Routes transient recognition without adding model requests or Session events.' },
|
||||
'packages/experimental/api-speech-to-text': { kind: 'none', reason: 'Transports audio and preparation state; ordinary user submission owns model-visible text.' },
|
||||
'packages/experimental/speech-to-text-sensevoice': { kind: 'none', reason: 'Local recognition returns transient text without modifying model context.' },
|
||||
'packages/experimental/client-ui-voice-input': { kind: 'none', reason: 'Inserts reviewable text into the unsent draft without submitting to the Agent.' },
|
||||
'packages/experimental/voice-input-bundle': { kind: 'none', reason: 'Composes dictation and preparation plugins without adding any model-facing contribution.' },
|
||||
'packages/telemetry/otel': { kind: 'none', reason: 'The service delivers caller-selected records without changing model context.' },
|
||||
'packages/host/product-telemetry-otel': { kind: 'none', reason: 'The plugin exports explicit analytics records without contributing model context.' },
|
||||
'packages/api/terminal-controller': { kind: 'none', reason: 'User-owned terminal processes and screen streams never enter model requests or Session events.' },
|
||||
'packages/client/ui-sidebar-terminal': { kind: 'none', reason: 'The browser renders user terminal screens without exposing them to the model.' },
|
||||
|
||||
Reference in new issue
Block a user