[codex] Record external agent import results (#28396)

## Summary
- restore `externalAgentConfig/import/progress` notifications while
keeping `externalAgentConfig/import/completed` as the must-deliver event
- persist completed external-agent config imports in state DB by
`importId`, including concrete success/failure details for config,
AGENTS.md, skills, plugins, MCP servers, subagents, hooks, commands, and
sessions
- add `externalAgentConfig/import/readHistories` so clients can recover
persisted import results after missing the live completion notification
- include `errorType` on import failures in protocol
responses/notifications and persisted DB JSON so future code can
classify failures without another wire/storage shape change

## Validation
- `git diff --check`
- `just test -p codex-state external_agent_config_imports`
- `just test -p codex-app-server-protocol`
- `CODEX_SQLITE_HOME=/private/tmp/codex-app-server-sqlite-read-details
just test -p codex-app-server
external_agent_config_import_sends_completion_notification_for_sync_only_import`

Also ran earlier broader checks before publishing:
- `just test -p codex-state`
-
`CODEX_SQLITE_HOME=/private/tmp/codex-app-server-external-agent-test-sqlite
just test -p codex-app-server external_agent_config`
- `just test -p codex-external-agent-migration`
This commit is contained in:
charlesgong-openai
2026-06-15 23:17:24 -07:00
committed by GitHub
Unverified
parent 1e015884c5
commit 314fa3d25b
30 changed files with 1370 additions and 101 deletions
@@ -2124,6 +2124,29 @@
"title": "ExternalAgentConfig/importRequest",
"type": "object"
},
{
"properties": {
"id": {
"$ref": "#/definitions/v2/RequestId"
},
"method": {
"enum": [
"externalAgentConfig/import/readHistories"
],
"title": "ExternalAgentConfig/import/readHistoriesRequestMethod",
"type": "string"
},
"params": {
"type": "null"
}
},
"required": [
"id",
"method"
],
"title": "ExternalAgentConfig/import/readHistoriesRequest",
"type": "object"
},
{
"properties": {
"id": {
@@ -4834,6 +4857,26 @@
"title": "RemoteControl/status/changedNotification",
"type": "object"
},
{
"properties": {
"method": {
"enum": [
"externalAgentConfig/import/progress"
],
"title": "ExternalAgentConfig/import/progressNotificationMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/v2/ExternalAgentConfigImportProgressNotification"
}
},
"required": [
"method",
"params"
],
"title": "ExternalAgentConfig/import/progressNotification",
"type": "object"
},
{
"properties": {
"method": {
@@ -9089,6 +9132,52 @@
"title": "ExternalAgentConfigImportCompletedNotification",
"type": "object"
},
"ExternalAgentConfigImportHistoriesReadResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"data": {
"items": {
"$ref": "#/definitions/v2/ExternalAgentConfigImportHistory"
},
"type": "array"
}
},
"required": [
"data"
],
"title": "ExternalAgentConfigImportHistoriesReadResponse",
"type": "object"
},
"ExternalAgentConfigImportHistory": {
"properties": {
"completedAtMs": {
"format": "int64",
"type": "integer"
},
"failures": {
"items": {
"$ref": "#/definitions/v2/ExternalAgentConfigImportItemTypeFailure"
},
"type": "array"
},
"importId": {
"type": "string"
},
"successes": {
"items": {
"$ref": "#/definitions/v2/ExternalAgentConfigImportItemTypeSuccess"
},
"type": "array"
}
},
"required": [
"completedAtMs",
"failures",
"importId",
"successes"
],
"type": "object"
},
"ExternalAgentConfigImportItemTypeFailure": {
"properties": {
"cwd": {
@@ -9097,6 +9186,12 @@
"null"
]
},
"errorType": {
"type": [
"string",
"null"
]
},
"failureStage": {
"type": "string"
},
@@ -9165,6 +9260,26 @@
"title": "ExternalAgentConfigImportParams",
"type": "object"
},
"ExternalAgentConfigImportProgressNotification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"importId": {
"type": "string"
},
"itemTypeResults": {
"items": {
"$ref": "#/definitions/v2/ExternalAgentConfigImportTypeResult"
},
"type": "array"
}
},
"required": [
"importId",
"itemTypeResults"
],
"title": "ExternalAgentConfigImportProgressNotification",
"type": "object"
},
"ExternalAgentConfigImportResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {