Merge remote-tracking branch 'upstream/master' into ux/automation-tasks-plugin-row

This commit is contained in:
ZiyaZhang committed 2026-09-25 22:31:25 -07:00
commit b90695ee7a
155 files changed
+2336 -639

No files matched your search

+31
View File
@@ -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({
+23 -2
View File
@@ -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
}
+7
View File
@@ -52,6 +52,7 @@ 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',
connection: 'web-server.md',
pluginManager: 'boot.md',
@@ -273,6 +274,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',
+8
View File
@@ -405,6 +405,14 @@ 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: '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',
+16 -4
View File
@@ -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')
+52 -1
View File
@@ -183,9 +183,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 +321,56 @@ describe('worktree-local Lefthook installer', { timeout: 90_000 }, () => {
expect(existsSync(join(hooksPath(fixture, fixture.main), '.fake-lefthook-running'))).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 }) => {
const fixture = createFixture()
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(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('waits for a concurrent installer to finish publishing its lock record', async () => {
const fixture = createFixture()
const lockPath = installLockPath(fixture)
@@ -50,6 +50,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
'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.' },