Merge branch 'codex/package-readme-limitations-audit-20260712' into codex/model-experience-readmes-20260712

This commit is contained in:
Tianyi Cui
2026-07-13 12:07:00 +08:00
33 changed files with 148 additions and 126 deletions

View File

@@ -149,7 +149,7 @@ export function attachStructuredRuntime(childCtx: Context, schema: StructuredOut
// The capture COMMIT observes the immutable, authoritative result after the
// complete pipeline and outer error normalization. This notification cannot
// transform the outcome, so there is no wrapper outside the commit verdict.
childCtx.on('tools/result', function (this: unknown, exec, result): void {
childCtx.on('tools/result', function (this: unknown, exec, result) {
if (exec.name === STRUCTURED_OUTPUT_TOOL) {
const entry = staged.get(exec)
if (entry === undefined) return

View File

@@ -742,7 +742,7 @@ describe('in-process structured output', () => {
const run = await ctx.subagents.start('spawn', structuredRequest(parent))
// A backend hot-reload mid-run must not unregister the capture tool out
// from under the live child: the registration rides the CHILD's fiber.
await disposeProvider()
disposeProvider()
const result = await run.result
expect(result.structured).toEqual({ answer: 4 })
const child = ctx.agents.get(run.id)!

View File

@@ -134,8 +134,9 @@ export class SubagentService extends Service {
* @param provider - the trusted provider implementation.
* @returns the exact Cordis effect disposer.
*/
registerProvider(provider: SubagentProvider): () => Promise<void> | void {
registerProvider(provider: SubagentProvider): () => void {
const name = provider.name
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- synchronous cleanup; direct return preserves disposer identity
return this.ctx.effect(function* (this: SubagentService) {
if (this.providers.has(name)) {
throw new SubagentError(`a subagent provider named "${name}" is already registered`, 'DUPLICATE_PROVIDER')

View File

@@ -74,7 +74,7 @@ describe('SubagentService', () => {
await expect(run.result).resolves.toMatchObject({ stopReason: 'completed' })
expect(provider.startCount).toBe(1)
await dispose()
dispose()
expect(added).toEqual(['alpha'])
expect(removed).toEqual(['alpha'])
expect(subagents.getProvider('alpha')).toBeUndefined()
@@ -213,7 +213,7 @@ describe('SubagentService', () => {
ctx.on('subagent/provider-removed', name => void heard.push(name))
const dispose = subagents.registerProvider(new StubProvider('contained'))
await dispose()
dispose()
await Promise.resolve()
expect(heard).toEqual(['contained'])
expect(warnings.some(message => message.includes('sync boom'))).toBe(true)

View File

@@ -212,7 +212,7 @@ export function apply(ctx: Context, config: Config): void {
// available — deriving the wording from THAT provider — and unregister it
// when the provider goes away, so the description can never outlive or
// predate the provider it describes.
let disposeTool: (() => Promise<void> | void) | undefined
let disposeTool: (() => void) | undefined
const mount = (provider: SubagentProvider): void => {
const wording = providerWording(provider.inheritsParentContext)
disposeTool = ctx.tools.register(defineTool({
@@ -283,7 +283,7 @@ export function apply(ctx: Context, config: Config): void {
})
ctx.on('subagent/provider-removed', (name) => {
if (name !== config.provider || disposeTool === undefined) return
void disposeTool()
disposeTool()
disposeTool = undefined
})
const present = ctx.subagents.getProvider(config.provider)