mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Merge branch 'main' into sluongng/bazelrc-imp
This commit is contained in:
Generated
+1
-1
@@ -1328,7 +1328,7 @@
|
|||||||
"system-configuration-sys_0.6.0": "{\"dependencies\":[{\"name\":\"core-foundation-sys\",\"req\":\"^0.8\"},{\"name\":\"libc\",\"req\":\"^0.2.149\"}],\"features\":{}}",
|
"system-configuration-sys_0.6.0": "{\"dependencies\":[{\"name\":\"core-foundation-sys\",\"req\":\"^0.8\"},{\"name\":\"libc\",\"req\":\"^0.2.149\"}],\"features\":{}}",
|
||||||
"system-configuration_0.6.1": "{\"dependencies\":[{\"name\":\"bitflags\",\"req\":\"^2\"},{\"name\":\"core-foundation\",\"req\":\"^0.9\"},{\"name\":\"system-configuration-sys\",\"req\":\"^0.6\"}],\"features\":{}}",
|
"system-configuration_0.6.1": "{\"dependencies\":[{\"name\":\"bitflags\",\"req\":\"^2\"},{\"name\":\"core-foundation\",\"req\":\"^0.9\"},{\"name\":\"system-configuration-sys\",\"req\":\"^0.6\"}],\"features\":{}}",
|
||||||
"tagptr_0.2.0": "{\"dependencies\":[],\"features\":{}}",
|
"tagptr_0.2.0": "{\"dependencies\":[],\"features\":{}}",
|
||||||
"tar_0.4.44": "{\"dependencies\":[{\"name\":\"filetime\",\"req\":\"^0.2.8\"},{\"name\":\"libc\",\"req\":\"^0.2\",\"target\":\"cfg(unix)\"},{\"kind\":\"dev\",\"name\":\"tempfile\",\"req\":\"^3\"},{\"name\":\"xattr\",\"optional\":true,\"req\":\"^1.1.3\",\"target\":\"cfg(unix)\"}],\"features\":{\"default\":[\"xattr\"]}}",
|
"tar_0.4.45": "{\"dependencies\":[{\"kind\":\"dev\",\"name\":\"astral-tokio-tar\",\"req\":\"^0.5\"},{\"name\":\"filetime\",\"req\":\"^0.2.8\"},{\"name\":\"libc\",\"req\":\"^0.2\",\"target\":\"cfg(unix)\"},{\"features\":[\"small_rng\"],\"kind\":\"dev\",\"name\":\"rand\",\"req\":\"^0.8\"},{\"kind\":\"dev\",\"name\":\"tempfile\",\"req\":\"^3\"},{\"features\":[\"macros\",\"rt\"],\"kind\":\"dev\",\"name\":\"tokio\",\"req\":\"^1\"},{\"kind\":\"dev\",\"name\":\"tokio-stream\",\"req\":\"^0.1\"},{\"name\":\"xattr\",\"optional\":true,\"req\":\"^1.1.3\",\"target\":\"cfg(unix)\"}],\"features\":{\"default\":[\"xattr\"]}}",
|
||||||
"tempfile_3.24.0": "{\"dependencies\":[{\"kind\":\"dev\",\"name\":\"doc-comment\",\"req\":\"^0.3\"},{\"name\":\"fastrand\",\"req\":\"^2.1.1\"},{\"default_features\":false,\"name\":\"getrandom\",\"optional\":true,\"req\":\"^0.3.0\",\"target\":\"cfg(any(unix, windows, target_os = \\\"wasi\\\"))\"},{\"default_features\":false,\"features\":[\"std\"],\"name\":\"once_cell\",\"req\":\"^1.19.0\"},{\"features\":[\"fs\"],\"name\":\"rustix\",\"req\":\"^1.1.3\",\"target\":\"cfg(any(unix, target_os = \\\"wasi\\\"))\"},{\"features\":[\"Win32_Storage_FileSystem\",\"Win32_Foundation\"],\"name\":\"windows-sys\",\"req\":\">=0.52, <0.62\",\"target\":\"cfg(windows)\"}],\"features\":{\"default\":[\"getrandom\"],\"nightly\":[]}}",
|
"tempfile_3.24.0": "{\"dependencies\":[{\"kind\":\"dev\",\"name\":\"doc-comment\",\"req\":\"^0.3\"},{\"name\":\"fastrand\",\"req\":\"^2.1.1\"},{\"default_features\":false,\"name\":\"getrandom\",\"optional\":true,\"req\":\"^0.3.0\",\"target\":\"cfg(any(unix, windows, target_os = \\\"wasi\\\"))\"},{\"default_features\":false,\"features\":[\"std\"],\"name\":\"once_cell\",\"req\":\"^1.19.0\"},{\"features\":[\"fs\"],\"name\":\"rustix\",\"req\":\"^1.1.3\",\"target\":\"cfg(any(unix, target_os = \\\"wasi\\\"))\"},{\"features\":[\"Win32_Storage_FileSystem\",\"Win32_Foundation\"],\"name\":\"windows-sys\",\"req\":\">=0.52, <0.62\",\"target\":\"cfg(windows)\"}],\"features\":{\"default\":[\"getrandom\"],\"nightly\":[]}}",
|
||||||
"temporal_capi_0.1.2": "{\"dependencies\":[{\"default_features\":false,\"name\":\"diplomat\",\"req\":\"^0.14.0\"},{\"default_features\":false,\"name\":\"diplomat-runtime\",\"req\":\"^0.14.0\"},{\"default_features\":false,\"features\":[\"unstable\"],\"name\":\"icu_calendar\",\"req\":\"^2.1.0\"},{\"name\":\"icu_locale\",\"req\":\"^2.1.0\"},{\"default_features\":false,\"name\":\"num-traits\",\"req\":\"^0.2.19\"},{\"default_features\":false,\"name\":\"temporal_rs\",\"req\":\"^0.1.2\"},{\"name\":\"timezone_provider\",\"req\":\"^0.1.2\"},{\"name\":\"writeable\",\"req\":\"^0.6.0\"},{\"name\":\"zoneinfo64\",\"optional\":true,\"req\":\"^0.2.0\"}],\"features\":{\"compiled_data\":[\"temporal_rs/compiled_data\"],\"zoneinfo64\":[\"dep:zoneinfo64\",\"timezone_provider/zoneinfo64\"]}}",
|
"temporal_capi_0.1.2": "{\"dependencies\":[{\"default_features\":false,\"name\":\"diplomat\",\"req\":\"^0.14.0\"},{\"default_features\":false,\"name\":\"diplomat-runtime\",\"req\":\"^0.14.0\"},{\"default_features\":false,\"features\":[\"unstable\"],\"name\":\"icu_calendar\",\"req\":\"^2.1.0\"},{\"name\":\"icu_locale\",\"req\":\"^2.1.0\"},{\"default_features\":false,\"name\":\"num-traits\",\"req\":\"^0.2.19\"},{\"default_features\":false,\"name\":\"temporal_rs\",\"req\":\"^0.1.2\"},{\"name\":\"timezone_provider\",\"req\":\"^0.1.2\"},{\"name\":\"writeable\",\"req\":\"^0.6.0\"},{\"name\":\"zoneinfo64\",\"optional\":true,\"req\":\"^0.2.0\"}],\"features\":{\"compiled_data\":[\"temporal_rs/compiled_data\"],\"zoneinfo64\":[\"dep:zoneinfo64\",\"timezone_provider/zoneinfo64\"]}}",
|
||||||
"temporal_rs_0.1.2": "{\"dependencies\":[{\"name\":\"core_maths\",\"req\":\"^0.1.1\"},{\"name\":\"iana-time-zone\",\"optional\":true,\"req\":\"^0.1.64\"},{\"default_features\":false,\"features\":[\"unstable\",\"compiled_data\"],\"name\":\"icu_calendar\",\"req\":\"^2.1.0\"},{\"name\":\"icu_locale\",\"req\":\"^2.1.0\"},{\"features\":[\"duration\"],\"name\":\"ixdtf\",\"req\":\"^0.6.4\"},{\"name\":\"log\",\"optional\":true,\"req\":\"^0.4.28\"},{\"default_features\":false,\"name\":\"num-traits\",\"req\":\"^0.2.19\"},{\"name\":\"timezone_provider\",\"req\":\"^0.1.2\"},{\"name\":\"tinystr\",\"req\":\"^0.8.0\"},{\"name\":\"web-time\",\"optional\":true,\"req\":\"^1.1.0\"},{\"name\":\"writeable\",\"req\":\"^0.6.0\"}],\"features\":{\"compiled_data\":[\"tzdb\"],\"default\":[\"sys\"],\"float64_representable_durations\":[],\"log\":[\"dep:log\"],\"std\":[],\"sys\":[\"std\",\"compiled_data\",\"dep:web-time\",\"dep:iana-time-zone\"],\"tzdb\":[\"std\",\"timezone_provider/tzif\"]}}",
|
"temporal_rs_0.1.2": "{\"dependencies\":[{\"name\":\"core_maths\",\"req\":\"^0.1.1\"},{\"name\":\"iana-time-zone\",\"optional\":true,\"req\":\"^0.1.64\"},{\"default_features\":false,\"features\":[\"unstable\",\"compiled_data\"],\"name\":\"icu_calendar\",\"req\":\"^2.1.0\"},{\"name\":\"icu_locale\",\"req\":\"^2.1.0\"},{\"features\":[\"duration\"],\"name\":\"ixdtf\",\"req\":\"^0.6.4\"},{\"name\":\"log\",\"optional\":true,\"req\":\"^0.4.28\"},{\"default_features\":false,\"name\":\"num-traits\",\"req\":\"^0.2.19\"},{\"name\":\"timezone_provider\",\"req\":\"^0.1.2\"},{\"name\":\"tinystr\",\"req\":\"^0.8.0\"},{\"name\":\"web-time\",\"optional\":true,\"req\":\"^1.1.0\"},{\"name\":\"writeable\",\"req\":\"^0.6.0\"}],\"features\":{\"compiled_data\":[\"tzdb\"],\"default\":[\"sys\"],\"float64_representable_durations\":[],\"log\":[\"dep:log\"],\"std\":[],\"sys\":[\"std\",\"compiled_data\",\"dep:web-time\",\"dep:iana-time-zone\"],\"tzdb\":[\"std\",\"timezone_provider/tzif\"]}}",
|
||||||
|
|||||||
Generated
+12
-12
@@ -380,7 +380,7 @@ version = "1.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -391,7 +391,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"once_cell_polyfill",
|
"once_cell_polyfill",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3821,7 +3821,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"option-ext",
|
"option-ext",
|
||||||
"redox_users 0.5.2",
|
"redox_users 0.5.2",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4066,7 +4066,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5511,7 +5511,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6274,7 +6274,7 @@ version = "0.50.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6918,7 +6918,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8340,7 +8340,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.11.0",
|
"linux-raw-sys 0.11.0",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -9754,9 +9754,9 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tar"
|
name = "tar"
|
||||||
version = "0.4.44"
|
version = "0.4.45"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a"
|
checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"filetime",
|
"filetime",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -9773,7 +9773,7 @@ dependencies = [
|
|||||||
"getrandom 0.3.4",
|
"getrandom 0.3.4",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix 1.1.3",
|
"rustix 1.1.3",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -11219,7 +11219,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -514,6 +514,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1623,6 +1645,13 @@
|
|||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -5658,6 +5658,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/v2/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -9115,6 +9137,13 @@
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"OverriddenMetadata": {
|
"OverriddenMetadata": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"effectiveValue": true,
|
"effectiveValue": true,
|
||||||
|
|||||||
@@ -2251,6 +2251,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -5863,6 +5885,13 @@
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"OverriddenMetadata": {
|
"OverriddenMetadata": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"effectiveValue": true,
|
"effectiveValue": true,
|
||||||
|
|||||||
@@ -112,9 +112,38 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"TurnError": {
|
"TurnError": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"additionalDetails": {
|
"additionalDetails": {
|
||||||
|
|||||||
@@ -131,6 +131,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -494,6 +516,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -196,6 +196,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -589,6 +611,13 @@
|
|||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -134,6 +134,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -520,6 +542,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -134,6 +134,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -520,6 +542,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -134,6 +134,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -520,6 +542,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -196,6 +196,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -589,6 +611,13 @@
|
|||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -134,6 +134,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -520,6 +542,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -196,6 +196,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -589,6 +611,13 @@
|
|||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -134,6 +134,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -520,6 +542,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -134,6 +134,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -520,6 +542,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -131,6 +131,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -494,6 +516,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -131,6 +131,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -494,6 +516,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -131,6 +131,28 @@
|
|||||||
],
|
],
|
||||||
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
"title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
|
||||||
|
"properties": {
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"properties": {
|
||||||
|
"turnKind": {
|
||||||
|
"$ref": "#/definitions/NonSteerableTurnKind"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"turnKind"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"activeTurnNotSteerable"
|
||||||
|
],
|
||||||
|
"title": "ActiveTurnNotSteerableCodexErrorInfo",
|
||||||
|
"type": "object"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -494,6 +516,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"NonSteerableTurnKind": {
|
||||||
|
"enum": [
|
||||||
|
"review",
|
||||||
|
"compact"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"PatchApplyStatus": {
|
"PatchApplyStatus": {
|
||||||
"enum": [
|
"enum": [
|
||||||
"inProgress",
|
"inProgress",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||||
|
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
import type { NonSteerableTurnKind } from "./NonSteerableTurnKind";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This translation layer make sure that we expose codex error code in camel case.
|
* This translation layer make sure that we expose codex error code in camel case.
|
||||||
@@ -8,4 +9,4 @@
|
|||||||
* When an upstream HTTP status is available (for example, from the Responses API or a provider),
|
* When an upstream HTTP status is available (for example, from the Responses API or a provider),
|
||||||
* it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.
|
* it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.
|
||||||
*/
|
*/
|
||||||
export type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOverloaded" | { "httpConnectionFailed": { httpStatusCode: number | null, } } | { "responseStreamConnectionFailed": { httpStatusCode: number | null, } } | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" | { "responseStreamDisconnected": { httpStatusCode: number | null, } } | { "responseTooManyFailedAttempts": { httpStatusCode: number | null, } } | "other";
|
export type CodexErrorInfo = "contextWindowExceeded" | "usageLimitExceeded" | "serverOverloaded" | { "httpConnectionFailed": { httpStatusCode: number | null, } } | { "responseStreamConnectionFailed": { httpStatusCode: number | null, } } | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" | { "responseStreamDisconnected": { httpStatusCode: number | null, } } | { "responseTooManyFailedAttempts": { httpStatusCode: number | null, } } | { "activeTurnNotSteerable": { turnKind: NonSteerableTurnKind, } } | "other";
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||||
|
|
||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
|
||||||
|
export type NonSteerableTurnKind = "review" | "compact";
|
||||||
@@ -194,6 +194,7 @@ export type { NetworkApprovalProtocol } from "./NetworkApprovalProtocol";
|
|||||||
export type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment";
|
export type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment";
|
||||||
export type { NetworkPolicyRuleAction } from "./NetworkPolicyRuleAction";
|
export type { NetworkPolicyRuleAction } from "./NetworkPolicyRuleAction";
|
||||||
export type { NetworkRequirements } from "./NetworkRequirements";
|
export type { NetworkRequirements } from "./NetworkRequirements";
|
||||||
|
export type { NonSteerableTurnKind } from "./NonSteerableTurnKind";
|
||||||
export type { OverriddenMetadata } from "./OverriddenMetadata";
|
export type { OverriddenMetadata } from "./OverriddenMetadata";
|
||||||
export type { PatchApplyStatus } from "./PatchApplyStatus";
|
export type { PatchApplyStatus } from "./PatchApplyStatus";
|
||||||
export type { PatchChangeKind } from "./PatchChangeKind";
|
export type { PatchChangeKind } from "./PatchChangeKind";
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ use codex_protocol::protocol::HookRunSummary as CoreHookRunSummary;
|
|||||||
use codex_protocol::protocol::HookScope as CoreHookScope;
|
use codex_protocol::protocol::HookScope as CoreHookScope;
|
||||||
use codex_protocol::protocol::ModelRerouteReason as CoreModelRerouteReason;
|
use codex_protocol::protocol::ModelRerouteReason as CoreModelRerouteReason;
|
||||||
use codex_protocol::protocol::NetworkAccess as CoreNetworkAccess;
|
use codex_protocol::protocol::NetworkAccess as CoreNetworkAccess;
|
||||||
|
use codex_protocol::protocol::NonSteerableTurnKind as CoreNonSteerableTurnKind;
|
||||||
use codex_protocol::protocol::PatchApplyStatus as CorePatchApplyStatus;
|
use codex_protocol::protocol::PatchApplyStatus as CorePatchApplyStatus;
|
||||||
use codex_protocol::protocol::RateLimitSnapshot as CoreRateLimitSnapshot;
|
use codex_protocol::protocol::RateLimitSnapshot as CoreRateLimitSnapshot;
|
||||||
use codex_protocol::protocol::RateLimitWindow as CoreRateLimitWindow;
|
use codex_protocol::protocol::RateLimitWindow as CoreRateLimitWindow;
|
||||||
@@ -128,6 +129,14 @@ macro_rules! v2_enum_from_core {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
#[ts(export_to = "v2/")]
|
||||||
|
pub enum NonSteerableTurnKind {
|
||||||
|
Review,
|
||||||
|
Compact,
|
||||||
|
}
|
||||||
|
|
||||||
/// This translation layer make sure that we expose codex error code in camel case.
|
/// This translation layer make sure that we expose codex error code in camel case.
|
||||||
///
|
///
|
||||||
/// When an upstream HTTP status is available (for example, from the Responses API or a provider),
|
/// When an upstream HTTP status is available (for example, from the Responses API or a provider),
|
||||||
@@ -167,6 +176,13 @@ pub enum CodexErrorInfo {
|
|||||||
#[ts(rename = "httpStatusCode")]
|
#[ts(rename = "httpStatusCode")]
|
||||||
http_status_code: Option<u16>,
|
http_status_code: Option<u16>,
|
||||||
},
|
},
|
||||||
|
/// Returned when `turn/start` or `turn/steer` is submitted while the current active turn
|
||||||
|
/// cannot accept same-turn steering, for example `/review` or manual `/compact`.
|
||||||
|
ActiveTurnNotSteerable {
|
||||||
|
#[serde(rename = "turnKind")]
|
||||||
|
#[ts(rename = "turnKind")]
|
||||||
|
turn_kind: NonSteerableTurnKind,
|
||||||
|
},
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,11 +209,25 @@ impl From<CoreCodexErrorInfo> for CodexErrorInfo {
|
|||||||
CoreCodexErrorInfo::ResponseTooManyFailedAttempts { http_status_code } => {
|
CoreCodexErrorInfo::ResponseTooManyFailedAttempts { http_status_code } => {
|
||||||
CodexErrorInfo::ResponseTooManyFailedAttempts { http_status_code }
|
CodexErrorInfo::ResponseTooManyFailedAttempts { http_status_code }
|
||||||
}
|
}
|
||||||
|
CoreCodexErrorInfo::ActiveTurnNotSteerable { turn_kind } => {
|
||||||
|
CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: turn_kind.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
CoreCodexErrorInfo::Other => CodexErrorInfo::Other,
|
CoreCodexErrorInfo::Other => CodexErrorInfo::Other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<CoreNonSteerableTurnKind> for NonSteerableTurnKind {
|
||||||
|
fn from(value: CoreNonSteerableTurnKind) -> Self {
|
||||||
|
match value {
|
||||||
|
CoreNonSteerableTurnKind::Review => Self::Review,
|
||||||
|
CoreNonSteerableTurnKind::Compact => Self::Compact,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS, ExperimentalApi,
|
Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS, ExperimentalApi,
|
||||||
)]
|
)]
|
||||||
@@ -7832,6 +7862,22 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn codex_error_info_serializes_active_turn_not_steerable_turn_kind_in_camel_case() {
|
||||||
|
let value = CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
serde_json::to_value(value).unwrap(),
|
||||||
|
json!({
|
||||||
|
"activeTurnNotSteerable": {
|
||||||
|
"turnKind": "review"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn dynamic_tool_response_serializes_content_items() {
|
fn dynamic_tool_response_serializes_content_items() {
|
||||||
let value = serde_json::to_value(DynamicToolCallResponse {
|
let value = serde_json::to_value(DynamicToolCallResponse {
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ Example with notification opt-out:
|
|||||||
- `thread/backgroundTerminals/clean` — terminate all running background terminals for a thread (experimental; requires `capabilities.experimentalApi`); returns `{}` when the cleanup request is accepted.
|
- `thread/backgroundTerminals/clean` — terminate all running background terminals for a thread (experimental; requires `capabilities.experimentalApi`); returns `{}` when the cleanup request is accepted.
|
||||||
- `thread/rollback` — drop the last N turns from the agent’s in-memory context and persist a rollback marker in the rollout so future resumes see the pruned history; returns the updated `thread` (with `turns` populated) on success.
|
- `thread/rollback` — drop the last N turns from the agent’s in-memory context and persist a rollback marker in the rollout so future resumes see the pruned history; returns the updated `thread` (with `turns` populated) on success.
|
||||||
- `turn/start` — add user input to a thread and begin Codex generation; responds with the initial `turn` object and streams `turn/started`, `item/*`, and `turn/completed` notifications. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode".
|
- `turn/start` — add user input to a thread and begin Codex generation; responds with the initial `turn` object and streams `turn/started`, `item/*`, and `turn/completed` notifications. For `collaborationMode`, `settings.developer_instructions: null` means "use built-in instructions for the selected mode".
|
||||||
- `turn/steer` — add user input to an already in-flight turn without starting a new turn; returns the active `turnId` that accepted the input.
|
- `turn/steer` — add user input to an already in-flight regular turn without starting a new turn; returns the active `turnId` that accepted the input. Review and manual compaction turns reject `turn/steer`.
|
||||||
- `turn/interrupt` — request cancellation of an in-flight turn by `(thread_id, turn_id)`; success is an empty `{}` response and the turn finishes with `status: "interrupted"`.
|
- `turn/interrupt` — request cancellation of an in-flight turn by `(thread_id, turn_id)`; success is an empty `{}` response and the turn finishes with `status: "interrupted"`.
|
||||||
- `thread/realtime/start` — start a thread-scoped realtime session (experimental); returns `{}` and streams `thread/realtime/*` notifications.
|
- `thread/realtime/start` — start a thread-scoped realtime session (experimental); returns `{}` and streams `thread/realtime/*` notifications.
|
||||||
- `thread/realtime/appendAudio` — append an input audio chunk to the active realtime session (experimental); returns `{}`.
|
- `thread/realtime/appendAudio` — append an input audio chunk to the active realtime session (experimental); returns `{}`.
|
||||||
@@ -575,8 +575,8 @@ Use `thread/backgroundTerminals/clean` to terminate all running background termi
|
|||||||
|
|
||||||
### Example: Steer an active turn
|
### Example: Steer an active turn
|
||||||
|
|
||||||
Use `turn/steer` to append additional user input to the currently active turn. This does not emit
|
Use `turn/steer` to append additional user input to the currently active regular turn. This does
|
||||||
`turn/started` and does not accept turn context overrides.
|
not emit `turn/started` and does not accept turn context overrides.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{ "method": "turn/steer", "id": 32, "params": {
|
{ "method": "turn/steer", "id": 32, "params": {
|
||||||
@@ -587,7 +587,9 @@ Use `turn/steer` to append additional user input to the currently active turn. T
|
|||||||
{ "id": 32, "result": { "turnId": "turn_456" } }
|
{ "id": 32, "result": { "turnId": "turn_456" } }
|
||||||
```
|
```
|
||||||
|
|
||||||
`expectedTurnId` is required. If there is no active turn (or `expectedTurnId` does not match the active turn), the request fails with an `invalid request` error.
|
`expectedTurnId` is required. If there is no active turn, `expectedTurnId` does not match the
|
||||||
|
active turn, or the active turn kind does not accept same-turn steering (for example review or
|
||||||
|
manual compaction), the request fails with an `invalid request` error.
|
||||||
|
|
||||||
### Example: Request a code review
|
### Example: Request a code review
|
||||||
|
|
||||||
@@ -918,6 +920,8 @@ There are additional item-specific events:
|
|||||||
- `ResponseStreamConnectionFailed { httpStatusCode? }`: failure to connect to the response SSE stream
|
- `ResponseStreamConnectionFailed { httpStatusCode? }`: failure to connect to the response SSE stream
|
||||||
- `ResponseStreamDisconnected { httpStatusCode? }`: disconnect of the response SSE stream in the middle of a turn before completion
|
- `ResponseStreamDisconnected { httpStatusCode? }`: disconnect of the response SSE stream in the middle of a turn before completion
|
||||||
- `ResponseTooManyFailedAttempts { httpStatusCode? }`
|
- `ResponseTooManyFailedAttempts { httpStatusCode? }`
|
||||||
|
- `ActiveTurnNotSteerable { turnKind }`: `turn/start` or `turn/steer` was submitted while the
|
||||||
|
current active turn was not steerable, for example `/review` or manual `/compact`
|
||||||
- `BadRequest`
|
- `BadRequest`
|
||||||
- `Unauthorized`
|
- `Unauthorized`
|
||||||
- `SandboxError`
|
- `SandboxError`
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ use codex_app_server_protocol::CancelLoginAccountParams;
|
|||||||
use codex_app_server_protocol::CancelLoginAccountResponse;
|
use codex_app_server_protocol::CancelLoginAccountResponse;
|
||||||
use codex_app_server_protocol::CancelLoginAccountStatus;
|
use codex_app_server_protocol::CancelLoginAccountStatus;
|
||||||
use codex_app_server_protocol::ClientRequest;
|
use codex_app_server_protocol::ClientRequest;
|
||||||
|
use codex_app_server_protocol::CodexErrorInfo as AppServerCodexErrorInfo;
|
||||||
use codex_app_server_protocol::CollaborationModeListParams;
|
use codex_app_server_protocol::CollaborationModeListParams;
|
||||||
use codex_app_server_protocol::CollaborationModeListResponse;
|
use codex_app_server_protocol::CollaborationModeListResponse;
|
||||||
use codex_app_server_protocol::CommandExecParams;
|
use codex_app_server_protocol::CommandExecParams;
|
||||||
@@ -161,6 +162,7 @@ use codex_app_server_protocol::ThreadUnsubscribeParams;
|
|||||||
use codex_app_server_protocol::ThreadUnsubscribeResponse;
|
use codex_app_server_protocol::ThreadUnsubscribeResponse;
|
||||||
use codex_app_server_protocol::ThreadUnsubscribeStatus;
|
use codex_app_server_protocol::ThreadUnsubscribeStatus;
|
||||||
use codex_app_server_protocol::Turn;
|
use codex_app_server_protocol::Turn;
|
||||||
|
use codex_app_server_protocol::TurnError;
|
||||||
use codex_app_server_protocol::TurnInterruptParams;
|
use codex_app_server_protocol::TurnInterruptParams;
|
||||||
use codex_app_server_protocol::TurnStartParams;
|
use codex_app_server_protocol::TurnStartParams;
|
||||||
use codex_app_server_protocol::TurnStartResponse;
|
use codex_app_server_protocol::TurnStartResponse;
|
||||||
@@ -6131,24 +6133,57 @@ impl CodexMessageProcessor {
|
|||||||
self.outgoing.send_response(request_id, response).await;
|
self.outgoing.send_response(request_id, response).await;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let (code, message) = match err {
|
let (code, message, data) = match err {
|
||||||
SteerInputError::NoActiveTurn(_) => (
|
SteerInputError::NoActiveTurn(_) => (
|
||||||
INVALID_REQUEST_ERROR_CODE,
|
INVALID_REQUEST_ERROR_CODE,
|
||||||
"no active turn to steer".to_string(),
|
"no active turn to steer".to_string(),
|
||||||
|
None,
|
||||||
),
|
),
|
||||||
SteerInputError::ExpectedTurnMismatch { expected, actual } => (
|
SteerInputError::ExpectedTurnMismatch { expected, actual } => (
|
||||||
INVALID_REQUEST_ERROR_CODE,
|
INVALID_REQUEST_ERROR_CODE,
|
||||||
format!("expected active turn id `{expected}` but found `{actual}`"),
|
format!("expected active turn id `{expected}` but found `{actual}`"),
|
||||||
|
None,
|
||||||
),
|
),
|
||||||
|
SteerInputError::ActiveTurnNotSteerable { turn_kind } => {
|
||||||
|
let message = match turn_kind {
|
||||||
|
codex_protocol::protocol::NonSteerableTurnKind::Review => {
|
||||||
|
"cannot steer a review turn".to_string()
|
||||||
|
}
|
||||||
|
codex_protocol::protocol::NonSteerableTurnKind::Compact => {
|
||||||
|
"cannot steer a compact turn".to_string()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let error = TurnError {
|
||||||
|
message: message.clone(),
|
||||||
|
codex_error_info: Some(
|
||||||
|
AppServerCodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: turn_kind.into(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
additional_details: None,
|
||||||
|
};
|
||||||
|
let data = match serde_json::to_value(error) {
|
||||||
|
Ok(data) => Some(data),
|
||||||
|
Err(error) => {
|
||||||
|
tracing::error!(
|
||||||
|
?error,
|
||||||
|
"failed to serialize active-turn-not-steerable turn error"
|
||||||
|
);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
};
|
||||||
|
(INVALID_REQUEST_ERROR_CODE, message, data)
|
||||||
|
}
|
||||||
SteerInputError::EmptyInput => (
|
SteerInputError::EmptyInput => (
|
||||||
INVALID_REQUEST_ERROR_CODE,
|
INVALID_REQUEST_ERROR_CODE,
|
||||||
"input must not be empty".to_string(),
|
"input must not be empty".to_string(),
|
||||||
|
None,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
let error = JSONRPCErrorError {
|
let error = JSONRPCErrorError {
|
||||||
code,
|
code,
|
||||||
message,
|
message,
|
||||||
data: None,
|
data,
|
||||||
};
|
};
|
||||||
self.outgoing.send_error(request_id, error).await;
|
self.outgoing.send_error(request_id, error).await;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ pub async fn run_main_with_transport(
|
|||||||
range: None,
|
range: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if let Some(warning) = codex_core::config::missing_system_bwrap_warning() {
|
if let Some(warning) = codex_core::config::system_bwrap_warning() {
|
||||||
config_warnings.push(ConfigWarningNotification {
|
config_warnings.push(ConfigWarningNotification {
|
||||||
summary: warning,
|
summary: warning,
|
||||||
details: None,
|
details: None,
|
||||||
|
|||||||
@@ -61,9 +61,11 @@ cases like `/repo = write`, `/repo/a = none`, `/repo/a/b = write`, where the
|
|||||||
more specific writable child must reopen under a denied parent.
|
more specific writable child must reopen under a denied parent.
|
||||||
|
|
||||||
The Linux sandbox helper prefers `/usr/bin/bwrap` whenever it is available and
|
The Linux sandbox helper prefers `/usr/bin/bwrap` whenever it is available and
|
||||||
falls back to the vendored bubblewrap path otherwise. When `/usr/bin/bwrap` is
|
supports the required argv-rewrite flags, and falls back to the vendored
|
||||||
missing, Codex also surfaces a startup warning through its normal notification
|
bubblewrap path compiled into the binary otherwise. When `/usr/bin/bwrap` is
|
||||||
path instead of printing directly from the sandbox helper.
|
missing or too old to support the required flags, Codex also surfaces a startup
|
||||||
|
warning through its normal notification path instead of printing directly from
|
||||||
|
the sandbox helper.
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::agent::AgentStatus;
|
use crate::agent::AgentStatus;
|
||||||
use crate::agent::guards::AgentMetadata;
|
use crate::agent::registry::AgentMetadata;
|
||||||
use crate::agent::guards::Guards;
|
use crate::agent::registry::AgentRegistry;
|
||||||
use crate::agent::role::DEFAULT_ROLE_NAME;
|
use crate::agent::role::DEFAULT_ROLE_NAME;
|
||||||
use crate::agent::role::resolve_role_config;
|
use crate::agent::role::resolve_role_config;
|
||||||
use crate::agent::status::is_final;
|
use crate::agent::status::is_final;
|
||||||
@@ -80,14 +80,14 @@ fn agent_nickname_candidates(
|
|||||||
/// spawn new agents and the inter-agent communication layer.
|
/// spawn new agents and the inter-agent communication layer.
|
||||||
/// An `AgentControl` instance is intended to be created at most once per root thread/session
|
/// An `AgentControl` instance is intended to be created at most once per root thread/session
|
||||||
/// tree. That same `AgentControl` is then shared with every sub-agent spawned from that root,
|
/// tree. That same `AgentControl` is then shared with every sub-agent spawned from that root,
|
||||||
/// which keeps the guards scoped to that root thread rather than the entire `ThreadManager`.
|
/// which keeps the registry scoped to that root thread rather than the entire `ThreadManager`.
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub(crate) struct AgentControl {
|
pub(crate) struct AgentControl {
|
||||||
/// Weak handle back to the global thread registry/state.
|
/// Weak handle back to the global thread registry/state.
|
||||||
/// This is `Weak` to avoid reference cycles and shadow persistence of the form
|
/// This is `Weak` to avoid reference cycles and shadow persistence of the form
|
||||||
/// `ThreadManagerState -> CodexThread -> Session -> SessionServices -> ThreadManagerState`.
|
/// `ThreadManagerState -> CodexThread -> Session -> SessionServices -> ThreadManagerState`.
|
||||||
manager: Weak<ThreadManagerState>,
|
manager: Weak<ThreadManagerState>,
|
||||||
state: Arc<Guards>,
|
state: Arc<AgentRegistry>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AgentControl {
|
impl AgentControl {
|
||||||
@@ -686,7 +686,7 @@ impl AgentControl {
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn prepare_thread_spawn(
|
fn prepare_thread_spawn(
|
||||||
&self,
|
&self,
|
||||||
reservation: &mut crate::agent::guards::SpawnReservation,
|
reservation: &mut crate::agent::registry::SpawnReservation,
|
||||||
config: &crate::config::Config,
|
config: &crate::config::Config,
|
||||||
parent_thread_id: ThreadId,
|
parent_thread_id: ThreadId,
|
||||||
depth: i32,
|
depth: i32,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
pub(crate) mod agent_resolver;
|
pub(crate) mod agent_resolver;
|
||||||
pub(crate) mod control;
|
pub(crate) mod control;
|
||||||
mod guards;
|
mod registry;
|
||||||
pub(crate) mod role;
|
pub(crate) mod role;
|
||||||
pub(crate) mod status;
|
pub(crate) mod status;
|
||||||
|
|
||||||
pub(crate) use codex_protocol::protocol::AgentStatus;
|
pub(crate) use codex_protocol::protocol::AgentStatus;
|
||||||
pub(crate) use control::AgentControl;
|
pub(crate) use control::AgentControl;
|
||||||
pub(crate) use guards::exceeds_thread_spawn_depth_limit;
|
pub(crate) use registry::exceeds_thread_spawn_depth_limit;
|
||||||
pub(crate) use guards::next_thread_spawn_depth;
|
pub(crate) use registry::next_thread_spawn_depth;
|
||||||
pub(crate) use status::agent_status_from_event;
|
pub(crate) use status::agent_status_from_event;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use std::sync::atomic::Ordering;
|
|||||||
/// This structure is shared by all agents in the same user session (because the `AgentControl`
|
/// This structure is shared by all agents in the same user session (because the `AgentControl`
|
||||||
/// is).
|
/// is).
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct Guards {
|
pub(crate) struct AgentRegistry {
|
||||||
active_agents: Mutex<ActiveAgents>,
|
active_agents: Mutex<ActiveAgents>,
|
||||||
total_count: AtomicUsize,
|
total_count: AtomicUsize,
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ pub(crate) fn exceeds_thread_spawn_depth_limit(depth: i32, max_depth: i32) -> bo
|
|||||||
depth > max_depth
|
depth > max_depth
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Guards {
|
impl AgentRegistry {
|
||||||
pub(crate) fn reserve_spawn_slot(
|
pub(crate) fn reserve_spawn_slot(
|
||||||
self: &Arc<Self>,
|
self: &Arc<Self>,
|
||||||
max_threads: Option<usize>,
|
max_threads: Option<usize>,
|
||||||
@@ -263,7 +263,7 @@ impl Guards {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct SpawnReservation {
|
pub(crate) struct SpawnReservation {
|
||||||
state: Arc<Guards>,
|
state: Arc<AgentRegistry>,
|
||||||
active: bool,
|
active: bool,
|
||||||
reserved_agent_nickname: Option<String>,
|
reserved_agent_nickname: Option<String>,
|
||||||
reserved_agent_path: Option<AgentPath>,
|
reserved_agent_path: Option<AgentPath>,
|
||||||
@@ -311,5 +311,5 @@ impl Drop for SpawnReservation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[path = "guards_tests.rs"]
|
#[path = "registry_tests.rs"]
|
||||||
mod tests;
|
mod tests;
|
||||||
+66
-54
@@ -52,22 +52,22 @@ fn non_thread_spawn_subagents_default_to_depth_zero() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reservation_drop_releases_slot() {
|
fn reservation_drop_releases_slot() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let reservation = guards.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
let reservation = registry.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
||||||
drop(reservation);
|
drop(reservation);
|
||||||
|
|
||||||
let reservation = guards.reserve_spawn_slot(Some(1)).expect("slot released");
|
let reservation = registry.reserve_spawn_slot(Some(1)).expect("slot released");
|
||||||
drop(reservation);
|
drop(reservation);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn commit_holds_slot_until_release() {
|
fn commit_holds_slot_until_release() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let reservation = guards.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
let reservation = registry.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
||||||
let thread_id = ThreadId::new();
|
let thread_id = ThreadId::new();
|
||||||
reservation.commit(agent_metadata(thread_id));
|
reservation.commit(agent_metadata(thread_id));
|
||||||
|
|
||||||
let err = match guards.reserve_spawn_slot(Some(1)) {
|
let err = match registry.reserve_spawn_slot(Some(1)) {
|
||||||
Ok(_) => panic!("limit should be enforced"),
|
Ok(_) => panic!("limit should be enforced"),
|
||||||
Err(err) => err,
|
Err(err) => err,
|
||||||
};
|
};
|
||||||
@@ -76,8 +76,8 @@ fn commit_holds_slot_until_release() {
|
|||||||
};
|
};
|
||||||
assert_eq!(max_threads, 1);
|
assert_eq!(max_threads, 1);
|
||||||
|
|
||||||
guards.release_spawned_thread(thread_id);
|
registry.release_spawned_thread(thread_id);
|
||||||
let reservation = guards
|
let reservation = registry
|
||||||
.reserve_spawn_slot(Some(1))
|
.reserve_spawn_slot(Some(1))
|
||||||
.expect("slot released after thread removal");
|
.expect("slot released after thread removal");
|
||||||
drop(reservation);
|
drop(reservation);
|
||||||
@@ -85,14 +85,14 @@ fn commit_holds_slot_until_release() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn release_ignores_unknown_thread_id() {
|
fn release_ignores_unknown_thread_id() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let reservation = guards.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
let reservation = registry.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
||||||
let thread_id = ThreadId::new();
|
let thread_id = ThreadId::new();
|
||||||
reservation.commit(agent_metadata(thread_id));
|
reservation.commit(agent_metadata(thread_id));
|
||||||
|
|
||||||
guards.release_spawned_thread(ThreadId::new());
|
registry.release_spawned_thread(ThreadId::new());
|
||||||
|
|
||||||
let err = match guards.reserve_spawn_slot(Some(1)) {
|
let err = match registry.reserve_spawn_slot(Some(1)) {
|
||||||
Ok(_) => panic!("limit should still be enforced"),
|
Ok(_) => panic!("limit should still be enforced"),
|
||||||
Err(err) => err,
|
Err(err) => err,
|
||||||
};
|
};
|
||||||
@@ -101,8 +101,8 @@ fn release_ignores_unknown_thread_id() {
|
|||||||
};
|
};
|
||||||
assert_eq!(max_threads, 1);
|
assert_eq!(max_threads, 1);
|
||||||
|
|
||||||
guards.release_spawned_thread(thread_id);
|
registry.release_spawned_thread(thread_id);
|
||||||
let reservation = guards
|
let reservation = registry
|
||||||
.reserve_spawn_slot(Some(1))
|
.reserve_spawn_slot(Some(1))
|
||||||
.expect("slot released after real thread removal");
|
.expect("slot released after real thread removal");
|
||||||
drop(reservation);
|
drop(reservation);
|
||||||
@@ -110,20 +110,20 @@ fn release_ignores_unknown_thread_id() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn release_is_idempotent_for_registered_threads() {
|
fn release_is_idempotent_for_registered_threads() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let reservation = guards.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
let reservation = registry.reserve_spawn_slot(Some(1)).expect("reserve slot");
|
||||||
let first_id = ThreadId::new();
|
let first_id = ThreadId::new();
|
||||||
reservation.commit(agent_metadata(first_id));
|
reservation.commit(agent_metadata(first_id));
|
||||||
|
|
||||||
guards.release_spawned_thread(first_id);
|
registry.release_spawned_thread(first_id);
|
||||||
|
|
||||||
let reservation = guards.reserve_spawn_slot(Some(1)).expect("slot reused");
|
let reservation = registry.reserve_spawn_slot(Some(1)).expect("slot reused");
|
||||||
let second_id = ThreadId::new();
|
let second_id = ThreadId::new();
|
||||||
reservation.commit(agent_metadata(second_id));
|
reservation.commit(agent_metadata(second_id));
|
||||||
|
|
||||||
guards.release_spawned_thread(first_id);
|
registry.release_spawned_thread(first_id);
|
||||||
|
|
||||||
let err = match guards.reserve_spawn_slot(Some(1)) {
|
let err = match registry.reserve_spawn_slot(Some(1)) {
|
||||||
Ok(_) => panic!("limit should still be enforced"),
|
Ok(_) => panic!("limit should still be enforced"),
|
||||||
Err(err) => err,
|
Err(err) => err,
|
||||||
};
|
};
|
||||||
@@ -132,8 +132,8 @@ fn release_is_idempotent_for_registered_threads() {
|
|||||||
};
|
};
|
||||||
assert_eq!(max_threads, 1);
|
assert_eq!(max_threads, 1);
|
||||||
|
|
||||||
guards.release_spawned_thread(second_id);
|
registry.release_spawned_thread(second_id);
|
||||||
let reservation = guards
|
let reservation = registry
|
||||||
.reserve_spawn_slot(Some(1))
|
.reserve_spawn_slot(Some(1))
|
||||||
.expect("slot released after second thread removal");
|
.expect("slot released after second thread removal");
|
||||||
drop(reservation);
|
drop(reservation);
|
||||||
@@ -141,15 +141,15 @@ fn release_is_idempotent_for_registered_threads() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn failed_spawn_keeps_nickname_marked_used() {
|
fn failed_spawn_keeps_nickname_marked_used() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let mut reservation = guards.reserve_spawn_slot(None).expect("reserve slot");
|
let mut reservation = registry.reserve_spawn_slot(None).expect("reserve slot");
|
||||||
let agent_nickname = reservation
|
let agent_nickname = reservation
|
||||||
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
||||||
.expect("reserve agent name");
|
.expect("reserve agent name");
|
||||||
assert_eq!(agent_nickname, "alpha");
|
assert_eq!(agent_nickname, "alpha");
|
||||||
drop(reservation);
|
drop(reservation);
|
||||||
|
|
||||||
let mut reservation = guards.reserve_spawn_slot(None).expect("reserve slot");
|
let mut reservation = registry.reserve_spawn_slot(None).expect("reserve slot");
|
||||||
let agent_nickname = reservation
|
let agent_nickname = reservation
|
||||||
.reserve_agent_nickname_with_preference(&["alpha", "beta"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["alpha", "beta"], /*preferred*/ None)
|
||||||
.expect("unused name should still be preferred");
|
.expect("unused name should still be preferred");
|
||||||
@@ -158,8 +158,10 @@ fn failed_spawn_keeps_nickname_marked_used() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn agent_nickname_resets_used_pool_when_exhausted() {
|
fn agent_nickname_resets_used_pool_when_exhausted() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let mut first = guards.reserve_spawn_slot(None).expect("reserve first slot");
|
let mut first = registry
|
||||||
|
.reserve_spawn_slot(None)
|
||||||
|
.expect("reserve first slot");
|
||||||
let first_name = first
|
let first_name = first
|
||||||
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
||||||
.expect("reserve first agent name");
|
.expect("reserve first agent name");
|
||||||
@@ -167,14 +169,14 @@ fn agent_nickname_resets_used_pool_when_exhausted() {
|
|||||||
first.commit(agent_metadata(first_id));
|
first.commit(agent_metadata(first_id));
|
||||||
assert_eq!(first_name, "alpha");
|
assert_eq!(first_name, "alpha");
|
||||||
|
|
||||||
let mut second = guards
|
let mut second = registry
|
||||||
.reserve_spawn_slot(None)
|
.reserve_spawn_slot(None)
|
||||||
.expect("reserve second slot");
|
.expect("reserve second slot");
|
||||||
let second_name = second
|
let second_name = second
|
||||||
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
||||||
.expect("name should be reused after pool reset");
|
.expect("name should be reused after pool reset");
|
||||||
assert_eq!(second_name, "alpha the 2nd");
|
assert_eq!(second_name, "alpha the 2nd");
|
||||||
let active_agents = guards
|
let active_agents = registry
|
||||||
.active_agents
|
.active_agents
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||||
@@ -183,9 +185,11 @@ fn agent_nickname_resets_used_pool_when_exhausted() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn released_nickname_stays_used_until_pool_reset() {
|
fn released_nickname_stays_used_until_pool_reset() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
|
|
||||||
let mut first = guards.reserve_spawn_slot(None).expect("reserve first slot");
|
let mut first = registry
|
||||||
|
.reserve_spawn_slot(None)
|
||||||
|
.expect("reserve first slot");
|
||||||
let first_name = first
|
let first_name = first
|
||||||
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["alpha"], /*preferred*/ None)
|
||||||
.expect("reserve first agent name");
|
.expect("reserve first agent name");
|
||||||
@@ -193,9 +197,9 @@ fn released_nickname_stays_used_until_pool_reset() {
|
|||||||
first.commit(agent_metadata(first_id));
|
first.commit(agent_metadata(first_id));
|
||||||
assert_eq!(first_name, "alpha");
|
assert_eq!(first_name, "alpha");
|
||||||
|
|
||||||
guards.release_spawned_thread(first_id);
|
registry.release_spawned_thread(first_id);
|
||||||
|
|
||||||
let mut second = guards
|
let mut second = registry
|
||||||
.reserve_spawn_slot(None)
|
.reserve_spawn_slot(None)
|
||||||
.expect("reserve second slot");
|
.expect("reserve second slot");
|
||||||
let second_name = second
|
let second_name = second
|
||||||
@@ -204,15 +208,17 @@ fn released_nickname_stays_used_until_pool_reset() {
|
|||||||
assert_eq!(second_name, "beta");
|
assert_eq!(second_name, "beta");
|
||||||
let second_id = ThreadId::new();
|
let second_id = ThreadId::new();
|
||||||
second.commit(agent_metadata(second_id));
|
second.commit(agent_metadata(second_id));
|
||||||
guards.release_spawned_thread(second_id);
|
registry.release_spawned_thread(second_id);
|
||||||
|
|
||||||
let mut third = guards.reserve_spawn_slot(None).expect("reserve third slot");
|
let mut third = registry
|
||||||
|
.reserve_spawn_slot(None)
|
||||||
|
.expect("reserve third slot");
|
||||||
let third_name = third
|
let third_name = third
|
||||||
.reserve_agent_nickname_with_preference(&["alpha", "beta"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["alpha", "beta"], /*preferred*/ None)
|
||||||
.expect("pool reset should permit a duplicate");
|
.expect("pool reset should permit a duplicate");
|
||||||
let expected_names = HashSet::from(["alpha the 2nd".to_string(), "beta the 2nd".to_string()]);
|
let expected_names = HashSet::from(["alpha the 2nd".to_string(), "beta the 2nd".to_string()]);
|
||||||
assert!(expected_names.contains(&third_name));
|
assert!(expected_names.contains(&third_name));
|
||||||
let active_agents = guards
|
let active_agents = registry
|
||||||
.active_agents
|
.active_agents
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||||
@@ -221,18 +227,20 @@ fn released_nickname_stays_used_until_pool_reset() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn repeated_resets_advance_the_ordinal_suffix() {
|
fn repeated_resets_advance_the_ordinal_suffix() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
|
|
||||||
let mut first = guards.reserve_spawn_slot(None).expect("reserve first slot");
|
let mut first = registry
|
||||||
|
.reserve_spawn_slot(None)
|
||||||
|
.expect("reserve first slot");
|
||||||
let first_name = first
|
let first_name = first
|
||||||
.reserve_agent_nickname_with_preference(&["Plato"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["Plato"], /*preferred*/ None)
|
||||||
.expect("reserve first agent name");
|
.expect("reserve first agent name");
|
||||||
let first_id = ThreadId::new();
|
let first_id = ThreadId::new();
|
||||||
first.commit(agent_metadata(first_id));
|
first.commit(agent_metadata(first_id));
|
||||||
assert_eq!(first_name, "Plato");
|
assert_eq!(first_name, "Plato");
|
||||||
guards.release_spawned_thread(first_id);
|
registry.release_spawned_thread(first_id);
|
||||||
|
|
||||||
let mut second = guards
|
let mut second = registry
|
||||||
.reserve_spawn_slot(None)
|
.reserve_spawn_slot(None)
|
||||||
.expect("reserve second slot");
|
.expect("reserve second slot");
|
||||||
let second_name = second
|
let second_name = second
|
||||||
@@ -241,14 +249,16 @@ fn repeated_resets_advance_the_ordinal_suffix() {
|
|||||||
let second_id = ThreadId::new();
|
let second_id = ThreadId::new();
|
||||||
second.commit(agent_metadata(second_id));
|
second.commit(agent_metadata(second_id));
|
||||||
assert_eq!(second_name, "Plato the 2nd");
|
assert_eq!(second_name, "Plato the 2nd");
|
||||||
guards.release_spawned_thread(second_id);
|
registry.release_spawned_thread(second_id);
|
||||||
|
|
||||||
let mut third = guards.reserve_spawn_slot(None).expect("reserve third slot");
|
let mut third = registry
|
||||||
|
.reserve_spawn_slot(None)
|
||||||
|
.expect("reserve third slot");
|
||||||
let third_name = third
|
let third_name = third
|
||||||
.reserve_agent_nickname_with_preference(&["Plato"], /*preferred*/ None)
|
.reserve_agent_nickname_with_preference(&["Plato"], /*preferred*/ None)
|
||||||
.expect("reserve third agent name");
|
.expect("reserve third agent name");
|
||||||
assert_eq!(third_name, "Plato the 3rd");
|
assert_eq!(third_name, "Plato the 3rd");
|
||||||
let active_agents = guards
|
let active_agents = registry
|
||||||
.active_agents
|
.active_agents
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||||
@@ -257,27 +267,29 @@ fn repeated_resets_advance_the_ordinal_suffix() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn register_root_thread_indexes_root_path() {
|
fn register_root_thread_indexes_root_path() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let root_thread_id = ThreadId::new();
|
let root_thread_id = ThreadId::new();
|
||||||
|
|
||||||
guards.register_root_thread(root_thread_id);
|
registry.register_root_thread(root_thread_id);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
guards.agent_id_for_path(&AgentPath::root()),
|
registry.agent_id_for_path(&AgentPath::root()),
|
||||||
Some(root_thread_id)
|
Some(root_thread_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reserved_agent_path_is_released_when_spawn_fails() {
|
fn reserved_agent_path_is_released_when_spawn_fails() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let mut first = guards.reserve_spawn_slot(None).expect("reserve first slot");
|
let mut first = registry
|
||||||
|
.reserve_spawn_slot(None)
|
||||||
|
.expect("reserve first slot");
|
||||||
first
|
first
|
||||||
.reserve_agent_path(&agent_path("/root/researcher"))
|
.reserve_agent_path(&agent_path("/root/researcher"))
|
||||||
.expect("reserve first path");
|
.expect("reserve first path");
|
||||||
drop(first);
|
drop(first);
|
||||||
|
|
||||||
let mut second = guards
|
let mut second = registry
|
||||||
.reserve_spawn_slot(None)
|
.reserve_spawn_slot(None)
|
||||||
.expect("reserve second slot");
|
.expect("reserve second slot");
|
||||||
second
|
second
|
||||||
@@ -287,9 +299,9 @@ fn reserved_agent_path_is_released_when_spawn_fails() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn committed_agent_path_is_indexed_until_release() {
|
fn committed_agent_path_is_indexed_until_release() {
|
||||||
let guards = Arc::new(Guards::default());
|
let registry = Arc::new(AgentRegistry::default());
|
||||||
let thread_id = ThreadId::new();
|
let thread_id = ThreadId::new();
|
||||||
let mut reservation = guards.reserve_spawn_slot(None).expect("reserve slot");
|
let mut reservation = registry.reserve_spawn_slot(None).expect("reserve slot");
|
||||||
reservation
|
reservation
|
||||||
.reserve_agent_path(&agent_path("/root/researcher"))
|
.reserve_agent_path(&agent_path("/root/researcher"))
|
||||||
.expect("reserve path");
|
.expect("reserve path");
|
||||||
@@ -300,13 +312,13 @@ fn committed_agent_path_is_indexed_until_release() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
guards.agent_id_for_path(&agent_path("/root/researcher")),
|
registry.agent_id_for_path(&agent_path("/root/researcher")),
|
||||||
Some(thread_id)
|
Some(thread_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
guards.release_spawned_thread(thread_id);
|
registry.release_spawned_thread(thread_id);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
guards.agent_id_for_path(&agent_path("/root/researcher")),
|
registry.agent_id_for_path(&agent_path("/root/researcher")),
|
||||||
None
|
None
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+70
-13
@@ -186,9 +186,41 @@ mod rollout_reconstruction_tests;
|
|||||||
pub enum SteerInputError {
|
pub enum SteerInputError {
|
||||||
NoActiveTurn(Vec<UserInput>),
|
NoActiveTurn(Vec<UserInput>),
|
||||||
ExpectedTurnMismatch { expected: String, actual: String },
|
ExpectedTurnMismatch { expected: String, actual: String },
|
||||||
|
ActiveTurnNotSteerable { turn_kind: NonSteerableTurnKind },
|
||||||
EmptyInput,
|
EmptyInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SteerInputError {
|
||||||
|
fn to_error_event(&self) -> ErrorEvent {
|
||||||
|
match self {
|
||||||
|
Self::NoActiveTurn(_) => ErrorEvent {
|
||||||
|
message: "no active turn to steer".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::BadRequest),
|
||||||
|
},
|
||||||
|
Self::ExpectedTurnMismatch { expected, actual } => ErrorEvent {
|
||||||
|
message: format!("expected active turn id `{expected}` but found `{actual}`"),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::BadRequest),
|
||||||
|
},
|
||||||
|
Self::ActiveTurnNotSteerable { turn_kind } => {
|
||||||
|
let turn_kind_label = match turn_kind {
|
||||||
|
NonSteerableTurnKind::Review => "review",
|
||||||
|
NonSteerableTurnKind::Compact => "compact",
|
||||||
|
};
|
||||||
|
ErrorEvent {
|
||||||
|
message: format!("cannot steer a {turn_kind_label} turn"),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: *turn_kind,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Self::EmptyInput => ErrorEvent {
|
||||||
|
message: "input must not be empty".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::BadRequest),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Notes from the previous real user turn.
|
/// Notes from the previous real user turn.
|
||||||
///
|
///
|
||||||
/// Conceptually this is the same role that `previous_model` used to fill, but
|
/// Conceptually this is the same role that `previous_model` used to fill, but
|
||||||
@@ -333,6 +365,7 @@ use codex_protocol::models::ResponseItem;
|
|||||||
use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
||||||
use codex_protocol::protocol::CodexErrorInfo;
|
use codex_protocol::protocol::CodexErrorInfo;
|
||||||
use codex_protocol::protocol::InitialHistory;
|
use codex_protocol::protocol::InitialHistory;
|
||||||
|
use codex_protocol::protocol::NonSteerableTurnKind;
|
||||||
use codex_protocol::user_input::UserInput;
|
use codex_protocol::user_input::UserInput;
|
||||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||||
use codex_utils_readiness::Readiness;
|
use codex_utils_readiness::Readiness;
|
||||||
@@ -3859,6 +3892,21 @@ impl Session {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match active_turn.tasks.first().map(|(_, task)| task.kind) {
|
||||||
|
Some(crate::state::TaskKind::Regular) => {}
|
||||||
|
Some(crate::state::TaskKind::Review) => {
|
||||||
|
return Err(SteerInputError::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Some(crate::state::TaskKind::Compact) => {
|
||||||
|
return Err(SteerInputError::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Compact,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
None => return Err(SteerInputError::NoActiveTurn(input)),
|
||||||
|
}
|
||||||
|
|
||||||
let mut turn_state = active_turn.turn_state.lock().await;
|
let mut turn_state = active_turn.turn_state.lock().await;
|
||||||
turn_state.push_pending_input(input.into());
|
turn_state.push_pending_input(input.into());
|
||||||
Ok(active_turn_id.clone())
|
Ok(active_turn_id.clone())
|
||||||
@@ -4526,26 +4574,35 @@ mod handlers {
|
|||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(current_context) = sess.new_turn_with_sub_id(sub_id, updates).await else {
|
let Ok(current_context) = sess.new_turn_with_sub_id(sub_id.clone(), updates).await else {
|
||||||
// new_turn_with_sub_id already emits the error event.
|
// new_turn_with_sub_id already emits the error event.
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
sess.maybe_emit_unknown_model_warning_for_turn(current_context.as_ref())
|
sess.maybe_emit_unknown_model_warning_for_turn(current_context.as_ref())
|
||||||
.await;
|
.await;
|
||||||
current_context.session_telemetry.user_prompt(&items);
|
match sess
|
||||||
|
.steer_input(items.clone(), /*expected_turn_id*/ None)
|
||||||
// Attempt to inject input into current task.
|
.await
|
||||||
if let Err(SteerInputError::NoActiveTurn(items)) =
|
|
||||||
sess.steer_input(items, /*expected_turn_id*/ None).await
|
|
||||||
{
|
{
|
||||||
sess.refresh_mcp_servers_if_requested(¤t_context)
|
Ok(_) => current_context.session_telemetry.user_prompt(&items),
|
||||||
|
Err(SteerInputError::NoActiveTurn(items)) => {
|
||||||
|
current_context.session_telemetry.user_prompt(&items);
|
||||||
|
sess.refresh_mcp_servers_if_requested(¤t_context)
|
||||||
|
.await;
|
||||||
|
sess.spawn_task(
|
||||||
|
Arc::clone(¤t_context),
|
||||||
|
items,
|
||||||
|
crate::tasks::RegularTask::new(),
|
||||||
|
)
|
||||||
.await;
|
.await;
|
||||||
sess.spawn_task(
|
}
|
||||||
Arc::clone(¤t_context),
|
Err(err) => {
|
||||||
items,
|
sess.send_event_raw(Event {
|
||||||
crate::tasks::RegularTask::new(),
|
id: sub_id,
|
||||||
)
|
msg: EventMsg::Error(err.to_error_event()),
|
||||||
.await;
|
})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ use codex_protocol::permissions::FileSystemPath;
|
|||||||
use codex_protocol::permissions::FileSystemSandboxEntry;
|
use codex_protocol::permissions::FileSystemSandboxEntry;
|
||||||
use codex_protocol::permissions::FileSystemSandboxPolicy;
|
use codex_protocol::permissions::FileSystemSandboxPolicy;
|
||||||
use codex_protocol::permissions::FileSystemSpecialPath;
|
use codex_protocol::permissions::FileSystemSpecialPath;
|
||||||
|
use codex_protocol::protocol::NonSteerableTurnKind;
|
||||||
use codex_protocol::protocol::ReadOnlyAccess;
|
use codex_protocol::protocol::ReadOnlyAccess;
|
||||||
use codex_protocol::protocol::SandboxPolicy;
|
use codex_protocol::protocol::SandboxPolicy;
|
||||||
use codex_protocol::request_permissions::PermissionGrantScope;
|
use codex_protocol::request_permissions::PermissionGrantScope;
|
||||||
@@ -4507,6 +4508,43 @@ async fn steer_input_enforces_expected_turn_id() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn steer_input_rejects_non_regular_turns() {
|
||||||
|
for (task_kind, turn_kind) in [
|
||||||
|
(TaskKind::Review, NonSteerableTurnKind::Review),
|
||||||
|
(TaskKind::Compact, NonSteerableTurnKind::Compact),
|
||||||
|
] {
|
||||||
|
let (sess, _tc, _rx) = make_session_and_context_with_rx().await;
|
||||||
|
let input = vec![UserInput::Text {
|
||||||
|
text: "hello".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}];
|
||||||
|
let turn_context = sess.new_default_turn_with_sub_id("turn".to_string()).await;
|
||||||
|
sess.spawn_task(
|
||||||
|
turn_context,
|
||||||
|
input,
|
||||||
|
NeverEndingTask {
|
||||||
|
kind: task_kind,
|
||||||
|
listen_to_cancellation_token: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let steer_input = vec![UserInput::Text {
|
||||||
|
text: "steer".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}];
|
||||||
|
let err = sess
|
||||||
|
.steer_input(steer_input, /*expected_turn_id*/ None)
|
||||||
|
.await
|
||||||
|
.expect_err("steering a non-regular turn should fail");
|
||||||
|
|
||||||
|
assert_eq!(err, SteerInputError::ActiveTurnNotSteerable { turn_kind });
|
||||||
|
|
||||||
|
sess.abort_all_tasks(TurnAbortReason::Interrupted).await;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn steer_input_returns_active_turn_id() {
|
async fn steer_input_returns_active_turn_id() {
|
||||||
let (sess, tc, _rx) = make_session_and_context_with_rx().await;
|
let (sess, tc, _rx) = make_session_and_context_with_rx().await;
|
||||||
|
|||||||
@@ -5582,16 +5582,69 @@ shell_tool = true
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
#[test]
|
#[test]
|
||||||
fn missing_system_bwrap_warning_matches_system_bwrap_presence() {
|
fn system_bwrap_warning_reports_missing_system_bwrap() {
|
||||||
#[cfg(target_os = "linux")]
|
let warning = system_bwrap_warning_for_path(Path::new("/definitely/not/a/bwrap"))
|
||||||
assert_eq!(
|
.expect("missing system bwrap should emit a warning");
|
||||||
missing_system_bwrap_warning().is_some(),
|
|
||||||
!Path::new("/usr/bin/bwrap").is_file()
|
|
||||||
);
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
assert!(warning.contains("could not find system bubblewrap"));
|
||||||
assert!(missing_system_bwrap_warning().is_none());
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
#[test]
|
||||||
|
fn system_bwrap_warning_reports_too_old_system_bwrap() {
|
||||||
|
let fake_bwrap = write_fake_bwrap(
|
||||||
|
r#"#!/bin/sh
|
||||||
|
if [ "$1" = "--help" ]; then
|
||||||
|
echo 'usage: bwrap [OPTION...] COMMAND'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
let fake_bwrap_path: &Path = fake_bwrap.as_ref();
|
||||||
|
let warning = system_bwrap_warning_for_path(fake_bwrap_path)
|
||||||
|
.expect("old system bwrap should emit a warning");
|
||||||
|
|
||||||
|
assert!(warning.contains("too old to support `--argv0`"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
#[test]
|
||||||
|
fn system_bwrap_warning_skips_supported_system_bwrap() {
|
||||||
|
let fake_bwrap = write_fake_bwrap(
|
||||||
|
r#"#!/bin/sh
|
||||||
|
if [ "$1" = "--help" ]; then
|
||||||
|
echo ' --argv0 PROGRAM'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
let fake_bwrap_path: &Path = fake_bwrap.as_ref();
|
||||||
|
|
||||||
|
assert_eq!(system_bwrap_warning_for_path(fake_bwrap_path), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
#[test]
|
||||||
|
fn system_bwrap_warning_is_disabled_off_linux() {
|
||||||
|
assert!(system_bwrap_warning().is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
fn write_fake_bwrap(contents: &str) -> tempfile::TempPath {
|
||||||
|
use std::fs;
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
|
// Linux rejects exec-ing a file that is still open for writing.
|
||||||
|
let path = NamedTempFile::new().expect("temp file").into_temp_path();
|
||||||
|
fs::write(&path, contents).expect("write fake bwrap");
|
||||||
|
let permissions = fs::Permissions::from_mode(0o755);
|
||||||
|
fs::set_permissions(&path, permissions).expect("chmod fake bwrap");
|
||||||
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ use std::collections::HashMap;
|
|||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
use crate::config::permissions::compile_permission_profile;
|
use crate::config::permissions::compile_permission_profile;
|
||||||
use crate::config::permissions::get_readable_roots_required_for_codex_runtime;
|
use crate::config::permissions::get_readable_roots_required_for_codex_runtime;
|
||||||
@@ -153,21 +155,46 @@ const RESERVED_MODEL_PROVIDER_IDS: [&str; 3] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn missing_system_bwrap_warning() -> Option<String> {
|
pub fn system_bwrap_warning() -> Option<String> {
|
||||||
if Path::new(SYSTEM_BWRAP_PATH).is_file() {
|
system_bwrap_warning_for_path(Path::new(SYSTEM_BWRAP_PATH))
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(format!(
|
|
||||||
"Codex could not find system bubblewrap at {SYSTEM_BWRAP_PATH}. Please install bubblewrap with your package manager. Codex will use the vendored bubblewrap in the meantime."
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
pub fn missing_system_bwrap_warning() -> Option<String> {
|
pub fn system_bwrap_warning() -> Option<String> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
fn system_bwrap_warning_for_path(system_bwrap_path: &Path) -> Option<String> {
|
||||||
|
if !system_bwrap_path.is_file() {
|
||||||
|
return Some(format!(
|
||||||
|
"Codex could not find system bubblewrap at {}. Please install bubblewrap with your package manager. Codex will use the vendored bubblewrap in the meantime.",
|
||||||
|
system_bwrap_path.display()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if system_bwrap_supports_argv0(system_bwrap_path) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(format!(
|
||||||
|
"Codex found system bubblewrap at {}, but it is too old to support `--argv0`. Please upgrade bubblewrap with your package manager. Codex will use the vendored bubblewrap in the meantime.",
|
||||||
|
system_bwrap_path.display()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
fn system_bwrap_supports_argv0(system_bwrap_path: &Path) -> bool {
|
||||||
|
// bubblewrap added `--argv0` in v0.9.0:
|
||||||
|
// https://github.com/containers/bubblewrap/releases/tag/v0.9.0
|
||||||
|
let output = match Command::new(system_bwrap_path).arg("--help").output() {
|
||||||
|
Ok(output) => output,
|
||||||
|
Err(_) => return false,
|
||||||
|
};
|
||||||
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
|
stdout.contains("--argv0") || stderr.contains("--argv0")
|
||||||
|
}
|
||||||
|
|
||||||
fn resolve_sqlite_home_env(resolved_cwd: &Path) -> Option<PathBuf> {
|
fn resolve_sqlite_home_env(resolved_cwd: &Path) -> Option<PathBuf> {
|
||||||
let raw = std::env::var(codex_state::SQLITE_HOME_ENV).ok()?;
|
let raw = std::env::var(codex_state::SQLITE_HOME_ENV).ok()?;
|
||||||
let trimmed = raw.trim();
|
let trimmed = raw.trim();
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
|||||||
// Print the effective configuration and initial request so users can see what Codex
|
// Print the effective configuration and initial request so users can see what Codex
|
||||||
// is using.
|
// is using.
|
||||||
event_processor.print_config_summary(&config, &prompt_summary, &session_configured);
|
event_processor.print_config_summary(&config, &prompt_summary, &session_configured);
|
||||||
if !json_mode && let Some(message) = codex_core::config::missing_system_bwrap_warning() {
|
if !json_mode && let Some(message) = codex_core::config::system_bwrap_warning() {
|
||||||
let _ = event_processor.process_event(Event {
|
let _ = event_processor.process_event(Event {
|
||||||
id: String::new(),
|
id: String::new(),
|
||||||
msg: EventMsg::Warning(codex_protocol::protocol::WarningEvent { message }),
|
msg: EventMsg::Warning(codex_protocol::protocol::WarningEvent { message }),
|
||||||
|
|||||||
@@ -8,19 +8,23 @@ This crate is responsible for producing:
|
|||||||
- this should also be true of the `codex` multitool CLI
|
- this should also be true of the `codex` multitool CLI
|
||||||
|
|
||||||
On Linux, the bubblewrap pipeline prefers the system `/usr/bin/bwrap` whenever
|
On Linux, the bubblewrap pipeline prefers the system `/usr/bin/bwrap` whenever
|
||||||
it is available. If `/usr/bin/bwrap` is missing, the helper still falls back to
|
it is available and supports the required argv-rewrite flags. If `/usr/bin/bwrap`
|
||||||
|
is missing or too old to support the required flags, the helper falls back to
|
||||||
the vendored bubblewrap path compiled into this binary.
|
the vendored bubblewrap path compiled into this binary.
|
||||||
Codex also surfaces a startup warning when `/usr/bin/bwrap` is missing so users
|
Codex also surfaces a startup warning when `/usr/bin/bwrap` is missing or too
|
||||||
know it is falling back to the vendored helper.
|
old to support the required flags so users know it is falling back to the
|
||||||
|
vendored helper.
|
||||||
|
|
||||||
**Current Behavior**
|
**Current Behavior**
|
||||||
- Legacy `SandboxPolicy` / `sandbox_mode` configs remain supported.
|
- Legacy `SandboxPolicy` / `sandbox_mode` configs remain supported.
|
||||||
- Bubblewrap is the default filesystem sandbox pipeline.
|
- Bubblewrap is the default filesystem sandbox pipeline.
|
||||||
- If `/usr/bin/bwrap` is present, the helper uses it.
|
- If `/usr/bin/bwrap` is present and supports the required argv-rewrite flags,
|
||||||
- If `/usr/bin/bwrap` is missing, the helper falls back to the vendored
|
the helper uses it.
|
||||||
bubblewrap path.
|
- If `/usr/bin/bwrap` is missing or too old to support the required flags, the
|
||||||
- If `/usr/bin/bwrap` is missing, Codex also surfaces a startup warning instead
|
helper falls back to the vendored bubblewrap path.
|
||||||
of printing directly from the sandbox helper.
|
- If `/usr/bin/bwrap` is missing or too old to support the required flags,
|
||||||
|
Codex also surfaces a startup warning instead of printing directly from the
|
||||||
|
sandbox helper.
|
||||||
- Legacy Landlock + mount protections remain available as an explicit legacy
|
- Legacy Landlock + mount protections remain available as an explicit legacy
|
||||||
fallback path.
|
fallback path.
|
||||||
- Set `features.use_legacy_landlock = true` (or CLI `-c use_legacy_landlock=true`)
|
- Set `features.use_legacy_landlock = true` (or CLI `-c use_legacy_landlock=true`)
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ use std::os::fd::AsRawFd;
|
|||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::process::Command;
|
||||||
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
use crate::vendored_bwrap::exec_vendored_bwrap;
|
use crate::vendored_bwrap::exec_vendored_bwrap;
|
||||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||||
@@ -24,17 +26,41 @@ pub(crate) fn exec_bwrap(argv: Vec<String>, preserved_files: Vec<File>) -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn preferred_bwrap_launcher() -> BubblewrapLauncher {
|
fn preferred_bwrap_launcher() -> BubblewrapLauncher {
|
||||||
if !Path::new(SYSTEM_BWRAP_PATH).is_file() {
|
static LAUNCHER: OnceLock<BubblewrapLauncher> = OnceLock::new();
|
||||||
|
LAUNCHER
|
||||||
|
.get_or_init(|| preferred_bwrap_launcher_for_path(Path::new(SYSTEM_BWRAP_PATH)))
|
||||||
|
.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn preferred_bwrap_launcher_for_path(system_bwrap_path: &Path) -> BubblewrapLauncher {
|
||||||
|
if !system_bwrap_supports_argv0(system_bwrap_path) {
|
||||||
return BubblewrapLauncher::Vendored;
|
return BubblewrapLauncher::Vendored;
|
||||||
}
|
}
|
||||||
|
|
||||||
let system_bwrap_path = match AbsolutePathBuf::from_absolute_path(SYSTEM_BWRAP_PATH) {
|
let system_bwrap_path = match AbsolutePathBuf::from_absolute_path(system_bwrap_path) {
|
||||||
Ok(path) => path,
|
Ok(path) => path,
|
||||||
Err(err) => panic!("failed to normalize system bubblewrap path {SYSTEM_BWRAP_PATH}: {err}"),
|
Err(err) => panic!(
|
||||||
|
"failed to normalize system bubblewrap path {}: {err}",
|
||||||
|
system_bwrap_path.display()
|
||||||
|
),
|
||||||
};
|
};
|
||||||
BubblewrapLauncher::System(system_bwrap_path)
|
BubblewrapLauncher::System(system_bwrap_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn system_bwrap_supports_argv0(system_bwrap_path: &Path) -> bool {
|
||||||
|
// bubblewrap added `--argv0` in v0.9.0:
|
||||||
|
// https://github.com/containers/bubblewrap/releases/tag/v0.9.0
|
||||||
|
// Older distro packages (for example Ubuntu 20.04/22.04) ship builds that
|
||||||
|
// reject `--argv0`, so prefer the vendored build in that case.
|
||||||
|
let output = match Command::new(system_bwrap_path).arg("--help").output() {
|
||||||
|
Ok(output) => output,
|
||||||
|
Err(_) => return false,
|
||||||
|
};
|
||||||
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
|
stdout.contains("--argv0") || stderr.contains("--argv0")
|
||||||
|
}
|
||||||
|
|
||||||
fn exec_system_bwrap(
|
fn exec_system_bwrap(
|
||||||
program: &AbsolutePathBuf,
|
program: &AbsolutePathBuf,
|
||||||
argv: Vec<String>,
|
argv: Vec<String>,
|
||||||
@@ -100,7 +126,57 @@ fn clear_cloexec(fd: libc::c_int) {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
use std::fs;
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
use tempfile::TempPath;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn prefers_system_bwrap_when_help_lists_argv0() {
|
||||||
|
let fake_bwrap = write_fake_bwrap(
|
||||||
|
r#"#!/bin/sh
|
||||||
|
if [ "$1" = "--help" ]; then
|
||||||
|
echo ' --argv0 PROGRAM'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
let fake_bwrap_path: &Path = fake_bwrap.as_ref();
|
||||||
|
let expected = AbsolutePathBuf::from_absolute_path(fake_bwrap_path).expect("absolute");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
preferred_bwrap_launcher_for_path(fake_bwrap_path),
|
||||||
|
BubblewrapLauncher::System(expected)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn falls_back_to_vendored_when_system_bwrap_lacks_argv0() {
|
||||||
|
let fake_bwrap = write_fake_bwrap(
|
||||||
|
r#"#!/bin/sh
|
||||||
|
if [ "$1" = "--help" ]; then
|
||||||
|
echo 'usage: bwrap [OPTION...] COMMAND'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
let fake_bwrap_path: &Path = fake_bwrap.as_ref();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
preferred_bwrap_launcher_for_path(fake_bwrap_path),
|
||||||
|
BubblewrapLauncher::Vendored
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn falls_back_to_vendored_when_system_bwrap_is_missing() {
|
||||||
|
assert_eq!(
|
||||||
|
preferred_bwrap_launcher_for_path(Path::new("/definitely/not/a/bwrap")),
|
||||||
|
BubblewrapLauncher::Vendored
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn preserved_files_are_made_inheritable_for_system_exec() {
|
fn preserved_files_are_made_inheritable_for_system_exec() {
|
||||||
@@ -131,4 +207,13 @@ mod tests {
|
|||||||
}
|
}
|
||||||
flags
|
flags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_fake_bwrap(contents: &str) -> TempPath {
|
||||||
|
// Linux rejects exec-ing a file that is still open for writing.
|
||||||
|
let path = NamedTempFile::new().expect("temp file").into_temp_path();
|
||||||
|
fs::write(&path, contents).expect("write fake bwrap");
|
||||||
|
let permissions = fs::Permissions::from_mode(0o755);
|
||||||
|
fs::set_permissions(&path, permissions).expect("chmod fake bwrap");
|
||||||
|
path
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1538,6 +1538,15 @@ pub enum AgentStatus {
|
|||||||
NotFound,
|
NotFound,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Turn kinds that reject same-turn steering.
|
||||||
|
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema, TS)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
#[ts(rename_all = "snake_case")]
|
||||||
|
pub enum NonSteerableTurnKind {
|
||||||
|
Review,
|
||||||
|
Compact,
|
||||||
|
}
|
||||||
|
|
||||||
/// Codex errors that we expose to clients.
|
/// Codex errors that we expose to clients.
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
@@ -1565,6 +1574,11 @@ pub enum CodexErrorInfo {
|
|||||||
ResponseTooManyFailedAttempts {
|
ResponseTooManyFailedAttempts {
|
||||||
http_status_code: Option<u16>,
|
http_status_code: Option<u16>,
|
||||||
},
|
},
|
||||||
|
/// Returned when `turn/start` or `turn/steer` is submitted while the current active turn
|
||||||
|
/// cannot accept same-turn steering, for example `/review` or manual `/compact`.
|
||||||
|
ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind,
|
||||||
|
},
|
||||||
ThreadRollbackFailed,
|
ThreadRollbackFailed,
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1587,7 @@ impl CodexErrorInfo {
|
|||||||
/// Whether this error should mark the current turn as failed when replaying history.
|
/// Whether this error should mark the current turn as failed when replaying history.
|
||||||
pub fn affects_turn_status(&self) -> bool {
|
pub fn affects_turn_status(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::ThreadRollbackFailed => false,
|
Self::ThreadRollbackFailed | Self::ActiveTurnNotSteerable { .. } => false,
|
||||||
Self::ContextWindowExceeded
|
Self::ContextWindowExceeded
|
||||||
| Self::UsageLimitExceeded
|
| Self::UsageLimitExceeded
|
||||||
| Self::ServerOverloaded
|
| Self::ServerOverloaded
|
||||||
@@ -4211,6 +4225,17 @@ mod tests {
|
|||||||
assert!(!event.affects_turn_status());
|
assert!(!event.affects_turn_status());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn active_turn_not_steerable_error_does_not_affect_turn_status() {
|
||||||
|
let event = ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".into(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
assert!(!event.affects_turn_status());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn generic_error_affects_turn_status() {
|
fn generic_error_affects_turn_status() {
|
||||||
let event = ErrorEvent {
|
let event = ErrorEvent {
|
||||||
|
|||||||
@@ -398,8 +398,8 @@ fn emit_project_config_warnings(app_event_tx: &AppEventSender, config: &Config)
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_missing_system_bwrap_warning(app_event_tx: &AppEventSender) {
|
fn emit_system_bwrap_warning(app_event_tx: &AppEventSender) {
|
||||||
let Some(message) = codex_core::config::missing_system_bwrap_warning() else {
|
let Some(message) = codex_core::config::system_bwrap_warning() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2197,7 +2197,7 @@ impl App {
|
|||||||
let (app_event_tx, mut app_event_rx) = unbounded_channel();
|
let (app_event_tx, mut app_event_rx) = unbounded_channel();
|
||||||
let app_event_tx = AppEventSender::new(app_event_tx);
|
let app_event_tx = AppEventSender::new(app_event_tx);
|
||||||
emit_project_config_warnings(&app_event_tx, &config);
|
emit_project_config_warnings(&app_event_tx, &config);
|
||||||
emit_missing_system_bwrap_warning(&app_event_tx);
|
emit_system_bwrap_warning(&app_event_tx);
|
||||||
emit_custom_prompt_deprecation_notice(&app_event_tx, &config.codex_home).await;
|
emit_custom_prompt_deprecation_notice(&app_event_tx, &config.codex_home).await;
|
||||||
tui.set_notification_method(config.tui_notification_method);
|
tui.set_notification_method(config.tui_notification_method);
|
||||||
|
|
||||||
@@ -5008,7 +5008,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5090,7 +5090,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5171,7 +5171,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5246,7 +5246,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
|
|||||||
@@ -3584,6 +3584,13 @@ impl ChatComposer {
|
|||||||
|
|
||||||
fn mention_items(&self) -> Vec<MentionItem> {
|
fn mention_items(&self) -> Vec<MentionItem> {
|
||||||
let mut mentions = Vec::new();
|
let mut mentions = Vec::new();
|
||||||
|
let plugin_display_names: HashSet<String> =
|
||||||
|
self.plugins.as_ref().map_or_else(HashSet::new, |plugins| {
|
||||||
|
plugins
|
||||||
|
.iter()
|
||||||
|
.map(|plugin| plugin.display_name.to_ascii_lowercase())
|
||||||
|
.collect()
|
||||||
|
});
|
||||||
|
|
||||||
if let Some(skills) = self.skills.as_ref() {
|
if let Some(skills) = self.skills.as_ref() {
|
||||||
for skill in skills {
|
for skill in skills {
|
||||||
@@ -3666,18 +3673,30 @@ impl ChatComposer {
|
|||||||
if !connector.is_accessible || !connector.is_enabled {
|
if !connector.is_accessible || !connector.is_enabled {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let plugin_backed_connector = connector
|
||||||
|
.plugin_display_names
|
||||||
|
.iter()
|
||||||
|
.any(|name| plugin_display_names.contains(&name.to_ascii_lowercase()));
|
||||||
|
if plugin_backed_connector {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let display_name = connectors::connector_display_label(connector);
|
let display_name = connectors::connector_display_label(connector);
|
||||||
let description = Some(Self::connector_brief_description(connector));
|
let description = Some(Self::connector_brief_description(connector));
|
||||||
let slug = codex_core::connectors::connector_mention_slug(connector);
|
let slug = codex_core::connectors::connector_mention_slug(connector);
|
||||||
let search_terms = vec![display_name.clone(), connector.id.clone(), slug.clone()];
|
let search_terms = vec![display_name.clone(), connector.id.clone(), slug.clone()];
|
||||||
let connector_id = connector.id.as_str();
|
let connector_id = connector.id.as_str();
|
||||||
|
let category_tag = if connector.plugin_display_names.is_empty() {
|
||||||
|
"[App]".to_string()
|
||||||
|
} else {
|
||||||
|
"[Plugin]".to_string()
|
||||||
|
};
|
||||||
mentions.push(MentionItem {
|
mentions.push(MentionItem {
|
||||||
display_name: display_name.clone(),
|
display_name: display_name.clone(),
|
||||||
description,
|
description,
|
||||||
insert_text: format!("${slug}"),
|
insert_text: format!("${slug}"),
|
||||||
search_terms,
|
search_terms,
|
||||||
path: Some(format!("app://{connector_id}")),
|
path: Some(format!("app://{connector_id}")),
|
||||||
category_tag: Some("[App]".to_string()),
|
category_tag: Some(category_tag),
|
||||||
sort_rank: 1,
|
sort_rank: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -5383,6 +5402,93 @@ mod tests {
|
|||||||
assert_eq!(mention.path, Some("plugin://sample@test".to_string()));
|
assert_eq!(mention.path, Some("plugin://sample@test".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mention_items_keep_plugin_owned_skills_but_hide_duplicate_apps() {
|
||||||
|
let (tx, _rx) = unbounded_channel::<AppEvent>();
|
||||||
|
let sender = AppEventSender::new(tx);
|
||||||
|
let mut composer = ChatComposer::new(
|
||||||
|
true,
|
||||||
|
sender,
|
||||||
|
false,
|
||||||
|
"Ask Codex to do anything".to_string(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
composer.set_connectors_enabled(true);
|
||||||
|
composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new());
|
||||||
|
composer.set_skill_mentions(Some(vec![SkillMetadata {
|
||||||
|
name: "google-calendar:availability".to_string(),
|
||||||
|
description: "Find availability and plan event changes".to_string(),
|
||||||
|
short_description: None,
|
||||||
|
interface: Some(codex_core::skills::model::SkillInterface {
|
||||||
|
display_name: Some("Google Calendar".to_string()),
|
||||||
|
short_description: None,
|
||||||
|
icon_small: None,
|
||||||
|
icon_large: None,
|
||||||
|
brand_color: None,
|
||||||
|
default_prompt: None,
|
||||||
|
}),
|
||||||
|
dependencies: None,
|
||||||
|
policy: None,
|
||||||
|
permission_profile: None,
|
||||||
|
managed_network_override: None,
|
||||||
|
path_to_skills_md: PathBuf::from("/tmp/repo/google-calendar/SKILL.md"),
|
||||||
|
scope: codex_protocol::protocol::SkillScope::Repo,
|
||||||
|
}]));
|
||||||
|
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
|
||||||
|
config_name: "google-calendar@debug".to_string(),
|
||||||
|
display_name: "Google Calendar".to_string(),
|
||||||
|
description: Some(
|
||||||
|
"Connect Google Calendar for scheduling, availability, and event management."
|
||||||
|
.to_string(),
|
||||||
|
),
|
||||||
|
has_skills: true,
|
||||||
|
mcp_server_names: vec!["google-calendar".to_string()],
|
||||||
|
app_connector_ids: vec![codex_core::plugins::AppConnectorId(
|
||||||
|
"google_calendar".to_string(),
|
||||||
|
)],
|
||||||
|
}]));
|
||||||
|
composer.set_connector_mentions(Some(ConnectorsSnapshot {
|
||||||
|
connectors: vec![AppInfo {
|
||||||
|
id: "google_calendar".to_string(),
|
||||||
|
name: "Google Calendar".to_string(),
|
||||||
|
description: Some("Look up events and availability".to_string()),
|
||||||
|
logo_url: None,
|
||||||
|
logo_url_dark: None,
|
||||||
|
distribution_channel: None,
|
||||||
|
branding: None,
|
||||||
|
app_metadata: None,
|
||||||
|
labels: None,
|
||||||
|
install_url: Some("https://example.test/google-calendar".to_string()),
|
||||||
|
is_accessible: true,
|
||||||
|
is_enabled: true,
|
||||||
|
plugin_display_names: vec!["Google Calendar".to_string()],
|
||||||
|
}],
|
||||||
|
}));
|
||||||
|
|
||||||
|
let mut mention_summaries: Vec<_> = composer
|
||||||
|
.mention_items()
|
||||||
|
.into_iter()
|
||||||
|
.map(|mention| (mention.display_name, mention.category_tag, mention.path))
|
||||||
|
.collect();
|
||||||
|
mention_summaries.sort();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
mention_summaries,
|
||||||
|
vec![
|
||||||
|
(
|
||||||
|
"Google Calendar".to_string(),
|
||||||
|
Some("[Plugin]".to_string()),
|
||||||
|
Some("plugin://google-calendar@debug".to_string()),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Google Calendar".to_string(),
|
||||||
|
Some("[Skill]".to_string()),
|
||||||
|
Some("/tmp/repo/google-calendar/SKILL.md".to_string()),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn plugin_mention_popup_snapshot() {
|
fn plugin_mention_popup_snapshot() {
|
||||||
snapshot_composer_state("plugin_mention_popup", false, |composer| {
|
snapshot_composer_state("plugin_mention_popup", false, |composer| {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ impl FileSearchPopup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.display_query = query.to_string();
|
self.display_query = query.to_string();
|
||||||
self.matches = matches;
|
self.matches = matches.into_iter().take(MAX_POPUP_ROWS).collect();
|
||||||
self.waiting = false;
|
self.waiting = false;
|
||||||
let len = self.matches.len();
|
let len = self.matches.len();
|
||||||
self.state.clamp_selection(len);
|
self.state.clamp_selection(len);
|
||||||
@@ -152,3 +152,33 @@ impl WidgetRef for &FileSearchPopup {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use codex_file_search::MatchType;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
fn file_match(index: usize) -> FileMatch {
|
||||||
|
FileMatch {
|
||||||
|
score: index as u32,
|
||||||
|
path: PathBuf::from(format!("src/file_{index:02}.rs")),
|
||||||
|
match_type: MatchType::File,
|
||||||
|
root: PathBuf::from("/tmp/repo"),
|
||||||
|
indices: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn set_matches_keeps_only_the_first_page_of_results() {
|
||||||
|
let mut popup = FileSearchPopup::new();
|
||||||
|
popup.set_query("file");
|
||||||
|
popup.set_matches("file", (0..(MAX_POPUP_ROWS + 2)).map(file_match).collect());
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
popup.matches,
|
||||||
|
(0..MAX_POPUP_ROWS).map(file_match).collect::<Vec<_>>()
|
||||||
|
);
|
||||||
|
assert_eq!(popup.calculate_required_height(), MAX_POPUP_ROWS as u16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -825,8 +825,10 @@ impl BottomPane {
|
|||||||
&mut self,
|
&mut self,
|
||||||
queued: Vec<String>,
|
queued: Vec<String>,
|
||||||
pending_steers: Vec<String>,
|
pending_steers: Vec<String>,
|
||||||
|
rejected_steers: Vec<String>,
|
||||||
) {
|
) {
|
||||||
self.pending_input_preview.pending_steers = pending_steers;
|
self.pending_input_preview.pending_steers = pending_steers;
|
||||||
|
self.pending_input_preview.rejected_steers = rejected_steers;
|
||||||
self.pending_input_preview.queued_messages = queued;
|
self.pending_input_preview.queued_messages = queued;
|
||||||
self.request_redraw();
|
self.request_redraw();
|
||||||
}
|
}
|
||||||
@@ -1153,7 +1155,8 @@ impl BottomPane {
|
|||||||
}
|
}
|
||||||
let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty();
|
let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty();
|
||||||
let has_pending_input = !self.pending_input_preview.queued_messages.is_empty()
|
let has_pending_input = !self.pending_input_preview.queued_messages.is_empty()
|
||||||
|| !self.pending_input_preview.pending_steers.is_empty();
|
|| !self.pending_input_preview.pending_steers.is_empty()
|
||||||
|
|| !self.pending_input_preview.rejected_steers.is_empty();
|
||||||
let has_status_or_footer =
|
let has_status_or_footer =
|
||||||
self.status.is_some() || !self.unified_exec_footer.is_empty();
|
self.status.is_some() || !self.unified_exec_footer.is_empty();
|
||||||
let has_inline_previews = has_pending_thread_approvals || has_pending_input;
|
let has_inline_previews = has_pending_thread_approvals || has_pending_input;
|
||||||
@@ -1556,7 +1559,11 @@ mod tests {
|
|||||||
StatusDetailsCapitalization::CapitalizeFirst,
|
StatusDetailsCapitalization::CapitalizeFirst,
|
||||||
STATUS_DETAILS_DEFAULT_MAX_LINES,
|
STATUS_DETAILS_DEFAULT_MAX_LINES,
|
||||||
);
|
);
|
||||||
pane.set_pending_input_preview(vec!["Queued follow-up question".to_string()], Vec::new());
|
pane.set_pending_input_preview(
|
||||||
|
vec!["Queued follow-up question".to_string()],
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
|
|
||||||
let width = 48;
|
let width = 48;
|
||||||
let height = pane.desired_height(width);
|
let height = pane.desired_height(width);
|
||||||
@@ -1583,7 +1590,11 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
pane.set_task_running(true);
|
pane.set_task_running(true);
|
||||||
pane.set_pending_input_preview(vec!["Queued follow-up question".to_string()], Vec::new());
|
pane.set_pending_input_preview(
|
||||||
|
vec!["Queued follow-up question".to_string()],
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
pane.hide_status_indicator();
|
pane.hide_status_indicator();
|
||||||
|
|
||||||
let width = 48;
|
let width = 48;
|
||||||
@@ -1611,7 +1622,11 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
pane.set_task_running(true);
|
pane.set_task_running(true);
|
||||||
pane.set_pending_input_preview(vec!["Queued follow-up question".to_string()], Vec::new());
|
pane.set_pending_input_preview(
|
||||||
|
vec!["Queued follow-up question".to_string()],
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
|
|
||||||
let width = 48;
|
let width = 48;
|
||||||
let height = pane.desired_height(width);
|
let height = pane.desired_height(width);
|
||||||
|
|||||||
@@ -10,17 +10,19 @@ use crate::render::renderable::Renderable;
|
|||||||
use crate::wrapping::RtOptions;
|
use crate::wrapping::RtOptions;
|
||||||
use crate::wrapping::adaptive_wrap_lines;
|
use crate::wrapping::adaptive_wrap_lines;
|
||||||
|
|
||||||
/// Widget that displays pending steers plus user messages queued while a turn is in progress.
|
/// Widget that displays pending steers plus follow-up messages held while a turn is in progress.
|
||||||
///
|
///
|
||||||
/// The widget renders pending steers first, then queued user messages, as two
|
/// The widget renders pending steers first, then rejected steers that will be
|
||||||
/// labeled sections. Pending steers explain that they will be submitted after
|
/// resubmitted at end of turn, then ordinary queued user messages. Pending
|
||||||
/// the next tool/result boundary unless the user presses Esc to interrupt and
|
/// steers explain that they will be submitted after the next tool/result
|
||||||
/// send them immediately. The edit hint at the bottom only appears when there
|
/// boundary unless the user presses Esc to interrupt and send them
|
||||||
/// are actual queued user messages to pop back into the composer. Because some
|
/// immediately. The edit hint at the bottom only appears when there are actual
|
||||||
/// terminals intercept certain modifier-key combinations, the displayed
|
/// queued user messages to pop back into the composer. Because some terminals
|
||||||
/// binding is configurable via [`set_edit_binding`](Self::set_edit_binding).
|
/// intercept certain modifier-key combinations, the displayed binding is
|
||||||
|
/// configurable via [`set_edit_binding`](Self::set_edit_binding).
|
||||||
pub(crate) struct PendingInputPreview {
|
pub(crate) struct PendingInputPreview {
|
||||||
pub pending_steers: Vec<String>,
|
pub pending_steers: Vec<String>,
|
||||||
|
pub rejected_steers: Vec<String>,
|
||||||
pub queued_messages: Vec<String>,
|
pub queued_messages: Vec<String>,
|
||||||
/// Key combination rendered in the hint line. Defaults to Alt+Up but may
|
/// Key combination rendered in the hint line. Defaults to Alt+Up but may
|
||||||
/// be overridden for terminals where that chord is unavailable.
|
/// be overridden for terminals where that chord is unavailable.
|
||||||
@@ -33,6 +35,7 @@ impl PendingInputPreview {
|
|||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
pending_steers: Vec::new(),
|
pending_steers: Vec::new(),
|
||||||
|
rejected_steers: Vec::new(),
|
||||||
queued_messages: Vec::new(),
|
queued_messages: Vec::new(),
|
||||||
edit_binding: key_hint::alt(KeyCode::Up),
|
edit_binding: key_hint::alt(KeyCode::Up),
|
||||||
}
|
}
|
||||||
@@ -67,7 +70,11 @@ impl PendingInputPreview {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn as_renderable(&self, width: u16) -> Box<dyn Renderable> {
|
fn as_renderable(&self, width: u16) -> Box<dyn Renderable> {
|
||||||
if (self.pending_steers.is_empty() && self.queued_messages.is_empty()) || width < 4 {
|
if (self.pending_steers.is_empty()
|
||||||
|
&& self.rejected_steers.is_empty()
|
||||||
|
&& self.queued_messages.is_empty())
|
||||||
|
|| width < 4
|
||||||
|
{
|
||||||
return Box::new(());
|
return Box::new(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +103,27 @@ impl PendingInputPreview {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !self.rejected_steers.is_empty() {
|
||||||
|
if !lines.is_empty() {
|
||||||
|
lines.push(Line::from(""));
|
||||||
|
}
|
||||||
|
Self::push_section_header(
|
||||||
|
&mut lines,
|
||||||
|
width,
|
||||||
|
"Messages to be submitted at end of turn".into(),
|
||||||
|
);
|
||||||
|
|
||||||
|
for steer in &self.rejected_steers {
|
||||||
|
let wrapped = adaptive_wrap_lines(
|
||||||
|
steer.lines().map(|line| Line::from(line.dim())),
|
||||||
|
RtOptions::new(width as usize)
|
||||||
|
.initial_indent(Line::from(" ↳ ".dim()))
|
||||||
|
.subsequent_indent(Line::from(" ")),
|
||||||
|
);
|
||||||
|
Self::push_truncated_preview_lines(&mut lines, wrapped, Line::from(" …".dim()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !self.queued_messages.is_empty() {
|
if !self.queued_messages.is_empty() {
|
||||||
if !lines.is_empty() {
|
if !lines.is_empty() {
|
||||||
lines.push(Line::from(""));
|
lines.push(Line::from(""));
|
||||||
@@ -304,6 +332,9 @@ mod tests {
|
|||||||
queue
|
queue
|
||||||
.pending_steers
|
.pending_steers
|
||||||
.push("Check the last command output.".to_string());
|
.push("Check the last command output.".to_string());
|
||||||
|
queue
|
||||||
|
.rejected_steers
|
||||||
|
.push("Rejected steer that will be retried.".to_string());
|
||||||
queue
|
queue
|
||||||
.queued_messages
|
.queued_messages
|
||||||
.push("Queued follow-up question".to_string());
|
.push("Queued follow-up question".to_string());
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ impl SkillPopup {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
out.truncate(MAX_POPUP_ROWS);
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,3 +230,43 @@ fn skill_popup_hint_line() -> Line<'static> {
|
|||||||
" to close".into(),
|
" to close".into(),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
fn mention_item(index: usize) -> MentionItem {
|
||||||
|
MentionItem {
|
||||||
|
display_name: format!("Mention {index:02}"),
|
||||||
|
description: Some(format!("Description {index:02}")),
|
||||||
|
insert_text: format!("$mention-{index:02}"),
|
||||||
|
search_terms: vec![format!("mention-{index:02}")],
|
||||||
|
path: Some(format!("skill://mention-{index:02}")),
|
||||||
|
category_tag: Some("[Skill]".to_string()),
|
||||||
|
sort_rank: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn filtered_mentions_are_capped_to_max_popup_rows() {
|
||||||
|
let popup = SkillPopup::new((0..(MAX_POPUP_ROWS + 2)).map(mention_item).collect());
|
||||||
|
|
||||||
|
let filtered_names: Vec<String> = popup
|
||||||
|
.filtered_items()
|
||||||
|
.into_iter()
|
||||||
|
.map(|idx| popup.mentions[idx].display_name.clone())
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
filtered_names,
|
||||||
|
(0..MAX_POPUP_ROWS)
|
||||||
|
.map(|idx| format!("Mention {idx:02}"))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
popup.calculate_required_height(72),
|
||||||
|
(MAX_POPUP_ROWS as u16) + 2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+12
-5
@@ -3,13 +3,16 @@ source: tui/src/bottom_pane/pending_input_preview.rs
|
|||||||
expression: "format!(\"{buf:?}\")"
|
expression: "format!(\"{buf:?}\")"
|
||||||
---
|
---
|
||||||
Buffer {
|
Buffer {
|
||||||
area: Rect { x: 0, y: 0, width: 52, height: 8 },
|
area: Rect { x: 0, y: 0, width: 52, height: 11 },
|
||||||
content: [
|
content: [
|
||||||
"• Messages to be submitted after next tool call ",
|
"• Messages to be submitted after next tool call ",
|
||||||
" (press esc to interrupt and send immediately) ",
|
" (press esc to interrupt and send immediately) ",
|
||||||
" ↳ Please continue. ",
|
" ↳ Please continue. ",
|
||||||
" ↳ Check the last command output. ",
|
" ↳ Check the last command output. ",
|
||||||
" ",
|
" ",
|
||||||
|
"• Messages to be submitted at end of turn ",
|
||||||
|
" ↳ Rejected steer that will be retried. ",
|
||||||
|
" ",
|
||||||
"• Queued follow-up messages ",
|
"• Queued follow-up messages ",
|
||||||
" ↳ Queued follow-up question ",
|
" ↳ Queued follow-up question ",
|
||||||
" ⌥ + ↑ edit last queued message ",
|
" ⌥ + ↑ edit last queued message ",
|
||||||
@@ -26,9 +29,13 @@ Buffer {
|
|||||||
x: 0, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
x: 0, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
x: 2, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
x: 2, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
x: 0, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
x: 0, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
x: 4, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM | ITALIC,
|
x: 40, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
x: 29, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
x: 0, y: 8, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
x: 0, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
x: 2, y: 8, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
x: 34, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
x: 0, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
|
x: 4, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: DIM | ITALIC,
|
||||||
|
x: 29, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
|
x: 0, y: 10, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
|
x: 34, y: 10, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+113
-31
@@ -765,6 +765,8 @@ pub(crate) struct ChatWidget {
|
|||||||
suppress_session_configured_redraw: bool,
|
suppress_session_configured_redraw: bool,
|
||||||
// User messages queued while a turn is in progress
|
// User messages queued while a turn is in progress
|
||||||
queued_user_messages: VecDeque<UserMessage>,
|
queued_user_messages: VecDeque<UserMessage>,
|
||||||
|
// User messages that tried to steer a non-regular turn and must be retried first.
|
||||||
|
rejected_steers_queue: VecDeque<UserMessage>,
|
||||||
// Steers already submitted to core but not yet committed into history.
|
// Steers already submitted to core but not yet committed into history.
|
||||||
//
|
//
|
||||||
// The bottom pane shows these above queued drafts until core records the
|
// The bottom pane shows these above queued drafts until core records the
|
||||||
@@ -925,9 +927,11 @@ impl ThreadComposerState {
|
|||||||
pub(crate) struct ThreadInputState {
|
pub(crate) struct ThreadInputState {
|
||||||
composer: Option<ThreadComposerState>,
|
composer: Option<ThreadComposerState>,
|
||||||
pending_steers: VecDeque<UserMessage>,
|
pending_steers: VecDeque<UserMessage>,
|
||||||
|
rejected_steers_queue: VecDeque<UserMessage>,
|
||||||
queued_user_messages: VecDeque<UserMessage>,
|
queued_user_messages: VecDeque<UserMessage>,
|
||||||
current_collaboration_mode: CollaborationMode,
|
current_collaboration_mode: CollaborationMode,
|
||||||
active_collaboration_mask: Option<CollaborationModeMask>,
|
active_collaboration_mask: Option<CollaborationModeMask>,
|
||||||
|
task_running: bool,
|
||||||
agent_turn_running: bool,
|
agent_turn_running: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1810,7 +1814,7 @@ impl ChatWidget {
|
|||||||
let had_pending_steers = !self.pending_steers.is_empty();
|
let had_pending_steers = !self.pending_steers.is_empty();
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
|
|
||||||
if !from_replay && self.queued_user_messages.is_empty() && !had_pending_steers {
|
if !from_replay && !self.has_queued_follow_up_messages() && !had_pending_steers {
|
||||||
self.maybe_prompt_plan_implementation();
|
self.maybe_prompt_plan_implementation();
|
||||||
}
|
}
|
||||||
// Keep this flag for replayed completion events so a subsequent live TurnComplete can
|
// Keep this flag for replayed completion events so a subsequent live TurnComplete can
|
||||||
@@ -1832,7 +1836,7 @@ impl ChatWidget {
|
|||||||
if !self.collaboration_modes_enabled() {
|
if !self.collaboration_modes_enabled() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !self.queued_user_messages.is_empty() {
|
if self.has_queued_follow_up_messages() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if self.active_mode_kind() != ModeKind::Plan {
|
if self.active_mode_kind() != ModeKind::Plan {
|
||||||
@@ -1904,6 +1908,50 @@ impl ChatWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn has_queued_follow_up_messages(&self) -> bool {
|
||||||
|
!self.rejected_steers_queue.is_empty() || !self.queued_user_messages.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pop_next_queued_user_message(&mut self) -> Option<UserMessage> {
|
||||||
|
if self.rejected_steers_queue.is_empty() {
|
||||||
|
self.queued_user_messages.pop_front()
|
||||||
|
} else {
|
||||||
|
Some(merge_user_messages(
|
||||||
|
self.rejected_steers_queue.drain(..).collect(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pop_latest_queued_user_message(&mut self) -> Option<UserMessage> {
|
||||||
|
self.queued_user_messages
|
||||||
|
.pop_back()
|
||||||
|
.or_else(|| self.rejected_steers_queue.pop_back())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn enqueue_rejected_steer(&mut self) -> bool {
|
||||||
|
let Some(pending_steer) = self.pending_steers.pop_front() else {
|
||||||
|
tracing::warn!(
|
||||||
|
"received active-turn-not-steerable error without a matching pending steer"
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
self.rejected_steers_queue
|
||||||
|
.push_back(pending_steer.user_message);
|
||||||
|
if !self.bottom_pane.is_task_running() {
|
||||||
|
// Will drain rejected_steers_queue in case the steer rejection arrives after task completion
|
||||||
|
self.maybe_send_next_queued_input();
|
||||||
|
}
|
||||||
|
self.refresh_pending_input_preview();
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_steer_rejected_error(&mut self, codex_error_info: &CodexErrorInfo) -> bool {
|
||||||
|
matches!(
|
||||||
|
codex_error_info,
|
||||||
|
CodexErrorInfo::ActiveTurnNotSteerable { .. }
|
||||||
|
) && self.enqueue_rejected_steer()
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn open_multi_agent_enable_prompt(&mut self) {
|
pub(crate) fn open_multi_agent_enable_prompt(&mut self) {
|
||||||
let items = vec![
|
let items = vec![
|
||||||
SelectionItem {
|
SelectionItem {
|
||||||
@@ -2268,7 +2316,7 @@ impl ChatWidget {
|
|||||||
/// state stays aligned with the merged attachment list. Returns `None` when there is nothing to
|
/// state stays aligned with the merged attachment list. Returns `None` when there is nothing to
|
||||||
/// restore.
|
/// restore.
|
||||||
fn drain_pending_messages_for_restore(&mut self) -> Option<UserMessage> {
|
fn drain_pending_messages_for_restore(&mut self) -> Option<UserMessage> {
|
||||||
if self.pending_steers.is_empty() && self.queued_user_messages.is_empty() {
|
if self.pending_steers.is_empty() && !self.has_queued_follow_up_messages() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2280,11 +2328,12 @@ impl ChatWidget {
|
|||||||
mention_bindings: self.bottom_pane.composer_mention_bindings(),
|
mention_bindings: self.bottom_pane.composer_mention_bindings(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut to_merge: Vec<UserMessage> = self
|
let mut to_merge: Vec<UserMessage> = self.rejected_steers_queue.drain(..).collect();
|
||||||
.pending_steers
|
to_merge.extend(
|
||||||
.drain(..)
|
self.pending_steers
|
||||||
.map(|steer| steer.user_message)
|
.drain(..)
|
||||||
.collect();
|
.map(|steer| steer.user_message),
|
||||||
|
);
|
||||||
to_merge.extend(self.queued_user_messages.drain(..));
|
to_merge.extend(self.queued_user_messages.drain(..));
|
||||||
if !existing_message.text.is_empty()
|
if !existing_message.text.is_empty()
|
||||||
|| !existing_message.local_images.is_empty()
|
|| !existing_message.local_images.is_empty()
|
||||||
@@ -2330,14 +2379,17 @@ impl ChatWidget {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|pending| pending.user_message.clone())
|
.map(|pending| pending.user_message.clone())
|
||||||
.collect(),
|
.collect(),
|
||||||
|
rejected_steers_queue: self.rejected_steers_queue.clone(),
|
||||||
queued_user_messages: self.queued_user_messages.clone(),
|
queued_user_messages: self.queued_user_messages.clone(),
|
||||||
current_collaboration_mode: self.current_collaboration_mode.clone(),
|
current_collaboration_mode: self.current_collaboration_mode.clone(),
|
||||||
active_collaboration_mask: self.active_collaboration_mask.clone(),
|
active_collaboration_mask: self.active_collaboration_mask.clone(),
|
||||||
|
task_running: self.bottom_pane.is_task_running(),
|
||||||
agent_turn_running: self.agent_turn_running,
|
agent_turn_running: self.agent_turn_running,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn restore_thread_input_state(&mut self, input_state: Option<ThreadInputState>) {
|
pub(crate) fn restore_thread_input_state(&mut self, input_state: Option<ThreadInputState>) {
|
||||||
|
let restored_task_running = input_state.as_ref().is_some_and(|state| state.task_running);
|
||||||
if let Some(input_state) = input_state {
|
if let Some(input_state) = input_state {
|
||||||
self.current_collaboration_mode = input_state.current_collaboration_mode;
|
self.current_collaboration_mode = input_state.current_collaboration_mode;
|
||||||
self.active_collaboration_mask = input_state.active_collaboration_mask;
|
self.active_collaboration_mask = input_state.active_collaboration_mask;
|
||||||
@@ -2369,13 +2421,24 @@ impl ChatWidget {
|
|||||||
);
|
);
|
||||||
self.bottom_pane.set_composer_pending_pastes(Vec::new());
|
self.bottom_pane.set_composer_pending_pastes(Vec::new());
|
||||||
}
|
}
|
||||||
self.pending_steers.clear();
|
self.pending_steers = input_state
|
||||||
self.queued_user_messages = input_state.pending_steers;
|
.pending_steers
|
||||||
self.queued_user_messages
|
.into_iter()
|
||||||
.extend(input_state.queued_user_messages);
|
.map(|user_message| PendingSteer {
|
||||||
|
compare_key: PendingSteerCompareKey {
|
||||||
|
message: user_message.text.clone(),
|
||||||
|
image_count: user_message.local_images.len()
|
||||||
|
+ user_message.remote_image_urls.len(),
|
||||||
|
},
|
||||||
|
user_message,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
self.rejected_steers_queue = input_state.rejected_steers_queue;
|
||||||
|
self.queued_user_messages = input_state.queued_user_messages;
|
||||||
} else {
|
} else {
|
||||||
self.agent_turn_running = false;
|
self.agent_turn_running = false;
|
||||||
self.pending_steers.clear();
|
self.pending_steers.clear();
|
||||||
|
self.rejected_steers_queue.clear();
|
||||||
self.set_remote_image_urls(Vec::new());
|
self.set_remote_image_urls(Vec::new());
|
||||||
self.bottom_pane.set_composer_text_with_mention_bindings(
|
self.bottom_pane.set_composer_text_with_mention_bindings(
|
||||||
String::new(),
|
String::new(),
|
||||||
@@ -2389,6 +2452,10 @@ impl ChatWidget {
|
|||||||
self.turn_sleep_inhibitor
|
self.turn_sleep_inhibitor
|
||||||
.set_turn_running(self.agent_turn_running);
|
.set_turn_running(self.agent_turn_running);
|
||||||
self.update_task_running_state();
|
self.update_task_running_state();
|
||||||
|
if restored_task_running && !self.bottom_pane.is_task_running() {
|
||||||
|
self.bottom_pane.set_task_running(/*running*/ true);
|
||||||
|
self.refresh_terminal_title();
|
||||||
|
}
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
self.request_redraw();
|
self.request_redraw();
|
||||||
}
|
}
|
||||||
@@ -3693,6 +3760,7 @@ impl ChatWidget {
|
|||||||
thread_name: None,
|
thread_name: None,
|
||||||
forked_from: None,
|
forked_from: None,
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
submit_pending_steers_after_interrupt: false,
|
submit_pending_steers_after_interrupt: false,
|
||||||
queued_message_edit_binding,
|
queued_message_edit_binding,
|
||||||
@@ -3899,6 +3967,7 @@ impl ChatWidget {
|
|||||||
plan_delta_buffer: String::new(),
|
plan_delta_buffer: String::new(),
|
||||||
plan_item_active: false,
|
plan_item_active: false,
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
submit_pending_steers_after_interrupt: false,
|
submit_pending_steers_after_interrupt: false,
|
||||||
queued_message_edit_binding,
|
queued_message_edit_binding,
|
||||||
@@ -4087,6 +4156,7 @@ impl ChatWidget {
|
|||||||
thread_name: None,
|
thread_name: None,
|
||||||
forked_from: None,
|
forked_from: None,
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
submit_pending_steers_after_interrupt: false,
|
submit_pending_steers_after_interrupt: false,
|
||||||
queued_message_edit_binding,
|
queued_message_edit_binding,
|
||||||
@@ -4229,9 +4299,9 @@ impl ChatWidget {
|
|||||||
|
|
||||||
if key_event.kind == KeyEventKind::Press
|
if key_event.kind == KeyEventKind::Press
|
||||||
&& self.queued_message_edit_binding.is_press(key_event)
|
&& self.queued_message_edit_binding.is_press(key_event)
|
||||||
&& !self.queued_user_messages.is_empty()
|
&& self.has_queued_follow_up_messages()
|
||||||
{
|
{
|
||||||
if let Some(user_message) = self.queued_user_messages.pop_back() {
|
if let Some(user_message) = self.pop_latest_queued_user_message() {
|
||||||
self.restore_user_message_to_composer(user_message);
|
self.restore_user_message_to_composer(user_message);
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
self.request_redraw();
|
self.request_redraw();
|
||||||
@@ -4455,6 +4525,9 @@ impl ChatWidget {
|
|||||||
}
|
}
|
||||||
SlashCommand::Compact => {
|
SlashCommand::Compact => {
|
||||||
self.clear_token_usage();
|
self.clear_token_usage();
|
||||||
|
if !self.bottom_pane.is_task_running() {
|
||||||
|
self.bottom_pane.set_task_running(/*running*/ true);
|
||||||
|
}
|
||||||
self.app_event_tx.send(AppEvent::CodexOp(Op::Compact));
|
self.app_event_tx.send(AppEvent::CodexOp(Op::Compact));
|
||||||
}
|
}
|
||||||
SlashCommand::Review => {
|
SlashCommand::Review => {
|
||||||
@@ -4960,10 +5033,7 @@ impl ChatWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn queue_user_message(&mut self, user_message: UserMessage) {
|
fn queue_user_message(&mut self, user_message: UserMessage) {
|
||||||
if !self.is_session_configured()
|
if !self.is_session_configured() || self.bottom_pane.is_task_running() {
|
||||||
|| self.bottom_pane.is_task_running()
|
|
||||||
|| self.is_review_mode
|
|
||||||
{
|
|
||||||
self.queued_user_messages.push_back(user_message);
|
self.queued_user_messages.push_back(user_message);
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
} else {
|
} else {
|
||||||
@@ -4978,12 +5048,6 @@ impl ChatWidget {
|
|||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if self.is_review_mode {
|
|
||||||
self.queued_user_messages.push_back(user_message);
|
|
||||||
self.refresh_pending_input_preview();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let UserMessage {
|
let UserMessage {
|
||||||
text,
|
text,
|
||||||
local_images,
|
local_images,
|
||||||
@@ -5388,7 +5452,9 @@ impl ChatWidget {
|
|||||||
}
|
}
|
||||||
EventMsg::TurnComplete(TurnCompleteEvent {
|
EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
last_agent_message, ..
|
last_agent_message, ..
|
||||||
}) => self.on_task_complete(last_agent_message, from_replay),
|
}) => {
|
||||||
|
self.on_task_complete(last_agent_message, from_replay);
|
||||||
|
}
|
||||||
EventMsg::TokenCount(ev) => {
|
EventMsg::TokenCount(ev) => {
|
||||||
self.set_token_info(ev.info);
|
self.set_token_info(ev.info);
|
||||||
self.on_rate_limit_snapshot(ev.rate_limits);
|
self.on_rate_limit_snapshot(ev.rate_limits);
|
||||||
@@ -5400,8 +5466,11 @@ impl ChatWidget {
|
|||||||
message,
|
message,
|
||||||
codex_error_info,
|
codex_error_info,
|
||||||
}) => {
|
}) => {
|
||||||
if let Some(info) = codex_error_info
|
if codex_error_info
|
||||||
&& let Some(kind) = rate_limit_error_kind(&info)
|
.as_ref()
|
||||||
|
.is_some_and(|info| self.handle_steer_rejected_error(info))
|
||||||
|
{
|
||||||
|
} else if let Some(kind) = codex_error_info.as_ref().and_then(rate_limit_error_kind)
|
||||||
{
|
{
|
||||||
match kind {
|
match kind {
|
||||||
RateLimitErrorKind::ServerOverloaded => {
|
RateLimitErrorKind::ServerOverloaded => {
|
||||||
@@ -5760,7 +5829,7 @@ impl ChatWidget {
|
|||||||
if self.bottom_pane.is_task_running() {
|
if self.bottom_pane.is_task_running() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Some(user_message) = self.queued_user_messages.pop_front() {
|
if let Some(user_message) = self.pop_next_queued_user_message() {
|
||||||
self.submit_user_message(user_message);
|
self.submit_user_message(user_message);
|
||||||
}
|
}
|
||||||
// Update the list to reflect the remaining queued messages (if any).
|
// Update the list to reflect the remaining queued messages (if any).
|
||||||
@@ -5779,8 +5848,16 @@ impl ChatWidget {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|steer| steer.user_message.text.clone())
|
.map(|steer| steer.user_message.text.clone())
|
||||||
.collect();
|
.collect();
|
||||||
self.bottom_pane
|
let rejected_steers: Vec<String> = self
|
||||||
.set_pending_input_preview(queued_messages, pending_steers);
|
.rejected_steers_queue
|
||||||
|
.iter()
|
||||||
|
.map(|message| message.text.clone())
|
||||||
|
.collect();
|
||||||
|
self.bottom_pane.set_pending_input_preview(
|
||||||
|
queued_messages,
|
||||||
|
pending_steers,
|
||||||
|
rejected_steers,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_pending_thread_approvals(&mut self, threads: Vec<String>) {
|
pub(crate) fn set_pending_thread_approvals(&mut self, threads: Vec<String>) {
|
||||||
@@ -8802,9 +8879,14 @@ impl ChatWidget {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) fn queued_user_message_texts(&self) -> Vec<String> {
|
pub(crate) fn queued_user_message_texts(&self) -> Vec<String> {
|
||||||
self.queued_user_messages
|
self.rejected_steers_queue
|
||||||
.iter()
|
.iter()
|
||||||
.map(|message| message.text.clone())
|
.map(|message| message.text.clone())
|
||||||
|
.chain(
|
||||||
|
self.queued_user_messages
|
||||||
|
.iter()
|
||||||
|
.map(|message| message.text.clone()),
|
||||||
|
)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
source: tui/src/chatwidget/tests.rs
|
||||||
|
expression: term.backend().vt100().screen().contents()
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
• Working (0s • esc to interrupt)
|
||||||
|
|
||||||
|
• Messages to be submitted at end of turn
|
||||||
|
↳ Steer submitted while /compact was running.
|
||||||
|
|
||||||
|
› Ask Codex to do anything
|
||||||
|
|
||||||
|
? for shortcuts 100% context left
|
||||||
+3
-3
@@ -11,11 +11,11 @@ expression: term.backend().vt100().screen().contents()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
• Working (0s • esc to interrupt)
|
• Working (0s • esc to interrupt)
|
||||||
|
|
||||||
• Queued follow-up messages
|
• Messages to be submitted at end of turn
|
||||||
↳ Queued while /review is running.
|
↳ Steer submitted while /review was running.
|
||||||
⌥ + ↑ edit last queued message
|
|
||||||
|
|
||||||
› Ask Codex to do anything
|
› Ask Codex to do anything
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ use codex_protocol::protocol::ItemCompletedEvent;
|
|||||||
use codex_protocol::protocol::McpStartupCompleteEvent;
|
use codex_protocol::protocol::McpStartupCompleteEvent;
|
||||||
use codex_protocol::protocol::McpStartupStatus;
|
use codex_protocol::protocol::McpStartupStatus;
|
||||||
use codex_protocol::protocol::McpStartupUpdateEvent;
|
use codex_protocol::protocol::McpStartupUpdateEvent;
|
||||||
|
use codex_protocol::protocol::NonSteerableTurnKind;
|
||||||
use codex_protocol::protocol::Op;
|
use codex_protocol::protocol::Op;
|
||||||
use codex_protocol::protocol::PatchApplyBeginEvent;
|
use codex_protocol::protocol::PatchApplyBeginEvent;
|
||||||
use codex_protocol::protocol::PatchApplyEndEvent;
|
use codex_protocol::protocol::PatchApplyEndEvent;
|
||||||
@@ -1536,6 +1537,131 @@ async fn entered_review_mode_defaults_to_current_changes_banner() {
|
|||||||
assert!(chat.is_review_mode);
|
assert!(chat.is_review_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn steer_rejection_queues_review_follow_up_before_existing_queued_messages() {
|
||||||
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "review-start".into(),
|
||||||
|
msg: EventMsg::EnteredReviewMode(ReviewRequest {
|
||||||
|
target: ReviewTarget::BaseBranch {
|
||||||
|
branch: "feature".to_string(),
|
||||||
|
},
|
||||||
|
user_facing_hint: Some("feature branch".to_string()),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
let _ = drain_insert_history(&mut rx);
|
||||||
|
chat.queued_user_messages
|
||||||
|
.push_back(UserMessage::from("queued later"));
|
||||||
|
|
||||||
|
chat.submit_user_message(UserMessage::from("review follow-up one"));
|
||||||
|
chat.submit_user_message(UserMessage::from("review follow-up two"));
|
||||||
|
|
||||||
|
assert_eq!(chat.pending_steers.len(), 2);
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "review follow-up one".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected running-turn steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "review follow-up two".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected second running-turn steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected-1".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected-2".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
assert!(chat.pending_steers.is_empty());
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_message_texts(),
|
||||||
|
vec![
|
||||||
|
"review follow-up one",
|
||||||
|
"review follow-up two",
|
||||||
|
"queued later"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
assert!(drain_insert_history(&mut rx).is_empty());
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "review-exit".into(),
|
||||||
|
msg: EventMsg::ExitedReviewMode(ExitedReviewModeEvent {
|
||||||
|
review_output: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-complete".into(),
|
||||||
|
msg: EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
last_agent_message: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "review follow-up one\nreview follow-up two".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected merged rejected-steer follow-up submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-complete-2".into(),
|
||||||
|
msg: EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
|
turn_id: "turn-2".to_string(),
|
||||||
|
last_agent_message: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "queued later".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected queued draft submit after rejected steers, got {other:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn live_agent_message_renders_during_review_mode() {
|
async fn live_agent_message_renders_during_review_mode() {
|
||||||
let (mut chat, mut rx, _ops) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, _ops) = make_chatwidget_manual(None).await;
|
||||||
@@ -1915,6 +2041,7 @@ async fn make_chatwidget_manual(
|
|||||||
show_welcome_banner: true,
|
show_welcome_banner: true,
|
||||||
startup_tooltip_override: None,
|
startup_tooltip_override: None,
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
submit_pending_steers_after_interrupt: false,
|
submit_pending_steers_after_interrupt: false,
|
||||||
queued_message_edit_binding: crate::key_hint::alt(KeyCode::Up),
|
queued_message_edit_binding: crate::key_hint::alt(KeyCode::Up),
|
||||||
@@ -3707,9 +3834,11 @@ async fn restore_thread_input_state_syncs_sleep_inhibitor_state() {
|
|||||||
chat.restore_thread_input_state(Some(ThreadInputState {
|
chat.restore_thread_input_state(Some(ThreadInputState {
|
||||||
composer: None,
|
composer: None,
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
current_collaboration_mode: chat.current_collaboration_mode.clone(),
|
current_collaboration_mode: chat.current_collaboration_mode.clone(),
|
||||||
active_collaboration_mask: chat.active_collaboration_mask.clone(),
|
active_collaboration_mask: chat.active_collaboration_mask.clone(),
|
||||||
|
task_running: true,
|
||||||
agent_turn_running: true,
|
agent_turn_running: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -3724,6 +3853,38 @@ async fn restore_thread_input_state_syncs_sleep_inhibitor_state() {
|
|||||||
assert!(!chat.bottom_pane.is_task_running());
|
assert!(!chat.bottom_pane.is_task_running());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn restore_thread_input_state_restores_pending_steers_without_downgrading_them() {
|
||||||
|
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
let mut pending_steers = VecDeque::new();
|
||||||
|
pending_steers.push_back(UserMessage::from("pending steer"));
|
||||||
|
let mut rejected_steers_queue = VecDeque::new();
|
||||||
|
rejected_steers_queue.push_back(UserMessage::from("already rejected"));
|
||||||
|
let mut queued_user_messages = VecDeque::new();
|
||||||
|
queued_user_messages.push_back(UserMessage::from("queued draft"));
|
||||||
|
|
||||||
|
chat.restore_thread_input_state(Some(ThreadInputState {
|
||||||
|
composer: None,
|
||||||
|
pending_steers,
|
||||||
|
rejected_steers_queue,
|
||||||
|
queued_user_messages,
|
||||||
|
current_collaboration_mode: chat.current_collaboration_mode.clone(),
|
||||||
|
active_collaboration_mask: chat.active_collaboration_mask.clone(),
|
||||||
|
task_running: false,
|
||||||
|
agent_turn_running: false,
|
||||||
|
}));
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_message_texts(),
|
||||||
|
vec!["already rejected", "queued draft"]
|
||||||
|
);
|
||||||
|
assert_eq!(chat.pending_steers.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
chat.pending_steers.front().unwrap().user_message.text,
|
||||||
|
"pending steer"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn alt_up_edits_most_recent_queued_message() {
|
async fn alt_up_edits_most_recent_queued_message() {
|
||||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
@@ -4128,6 +4289,97 @@ async fn steer_enter_queues_while_plan_stream_is_active() {
|
|||||||
assert!(drain_insert_history(&mut rx).is_empty());
|
assert!(drain_insert_history(&mut rx).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn submit_user_message_queues_while_compaction_turn_is_running() {
|
||||||
|
let (mut chat, _rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-started".to_string(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
chat.submit_user_message(UserMessage::from("queued while compacting"));
|
||||||
|
|
||||||
|
assert_eq!(chat.pending_steers.len(), 1);
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "queued while compacting".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected running-turn compact steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a compact turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Compact,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
assert!(chat.pending_steers.is_empty());
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_message_texts(),
|
||||||
|
vec!["queued while compacting"]
|
||||||
|
);
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-complete".to_string(),
|
||||||
|
msg: EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
last_agent_message: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "queued while compacting".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected queued compact follow-up Op::UserTurn, got {other:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn slash_compact_eagerly_queues_follow_up_before_turn_start() {
|
||||||
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
|
||||||
|
chat.dispatch_command(SlashCommand::Compact);
|
||||||
|
|
||||||
|
assert!(chat.bottom_pane.is_task_running());
|
||||||
|
match rx.try_recv() {
|
||||||
|
Ok(AppEvent::CodexOp(Op::Compact)) => {}
|
||||||
|
other => panic!("expected compact op to be submitted, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.bottom_pane.set_composer_text(
|
||||||
|
"queued before compact turn start".to_string(),
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
|
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||||
|
|
||||||
|
assert!(chat.pending_steers.is_empty());
|
||||||
|
assert_eq!(chat.queued_user_messages.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_messages.front().unwrap().text,
|
||||||
|
"queued before compact turn start"
|
||||||
|
);
|
||||||
|
assert_matches!(op_rx.try_recv(), Err(TryRecvError::Empty));
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn steer_enter_uses_pending_steers_while_turn_is_running_without_streaming() {
|
async fn steer_enter_uses_pending_steers_while_turn_is_running_without_streaming() {
|
||||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
@@ -11568,9 +11820,17 @@ async fn chatwidget_tall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn enter_queues_user_messages_while_review_is_running() {
|
async fn enter_submits_steer_while_review_is_running() {
|
||||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
chat.thread_id = Some(ThreadId::new());
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
chat.handle_codex_event(Event {
|
chat.handle_codex_event(Event {
|
||||||
id: "review-1".into(),
|
id: "review-1".into(),
|
||||||
@@ -11582,19 +11842,28 @@ async fn enter_queues_user_messages_while_review_is_running() {
|
|||||||
let _ = drain_insert_history(&mut rx);
|
let _ = drain_insert_history(&mut rx);
|
||||||
|
|
||||||
chat.bottom_pane.set_composer_text(
|
chat.bottom_pane.set_composer_text(
|
||||||
"Queued while /review is running.".to_string(),
|
"Steer submitted while /review was running.".to_string(),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
);
|
);
|
||||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||||
|
|
||||||
assert_eq!(chat.queued_user_messages.len(), 1);
|
assert!(chat.queued_user_messages.is_empty());
|
||||||
|
assert_eq!(chat.pending_steers.len(), 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
chat.queued_user_messages.front().unwrap().text,
|
chat.pending_steers.front().unwrap().user_message.text,
|
||||||
"Queued while /review is running."
|
"Steer submitted while /review was running."
|
||||||
);
|
);
|
||||||
assert!(chat.pending_steers.is_empty());
|
match next_submit_op(&mut op_rx) {
|
||||||
assert_no_submit_op(&mut op_rx);
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "Steer submitted while /review was running.".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected running-turn steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
assert!(drain_insert_history(&mut rx).is_empty());
|
assert!(drain_insert_history(&mut rx).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11602,6 +11871,14 @@ async fn enter_queues_user_messages_while_review_is_running() {
|
|||||||
async fn review_queues_user_messages_snapshot() {
|
async fn review_queues_user_messages_snapshot() {
|
||||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
chat.thread_id = Some(ThreadId::new());
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
chat.handle_codex_event(Event {
|
chat.handle_codex_event(Event {
|
||||||
id: "review-1".into(),
|
id: "review-1".into(),
|
||||||
@@ -11612,9 +11889,57 @@ async fn review_queues_user_messages_snapshot() {
|
|||||||
});
|
});
|
||||||
let _ = drain_insert_history(&mut rx);
|
let _ = drain_insert_history(&mut rx);
|
||||||
|
|
||||||
chat.queue_user_message(UserMessage::from(
|
chat.submit_user_message(UserMessage::from(
|
||||||
"Queued while /review is running.".to_string(),
|
"Steer submitted while /review was running.".to_string(),
|
||||||
));
|
));
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
let width: u16 = 80;
|
||||||
|
let height: u16 = 18;
|
||||||
|
let backend = VT100Backend::new(width, height);
|
||||||
|
let mut term = crate::custom_terminal::Terminal::with_options(backend).expect("terminal");
|
||||||
|
let desired_height = chat.desired_height(width).min(height);
|
||||||
|
term.set_viewport_area(Rect::new(0, height - desired_height, width, desired_height));
|
||||||
|
term.draw(|f| {
|
||||||
|
chat.render(f.area(), f.buffer_mut());
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
assert_snapshot!(term.backend().vt100().screen().contents());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn compact_queues_user_messages_snapshot() {
|
||||||
|
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
chat.submit_user_message(UserMessage::from(
|
||||||
|
"Steer submitted while /compact was running.".to_string(),
|
||||||
|
));
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a compact turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Compact,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
let width: u16 = 80;
|
let width: u16 = 80;
|
||||||
let height: u16 = 18;
|
let height: u16 = 18;
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ use crate::update_action::UpdateAction;
|
|||||||
use crate::version::CODEX_CLI_VERSION;
|
use crate::version::CODEX_CLI_VERSION;
|
||||||
use codex_ansi_escape::ansi_escape_line;
|
use codex_ansi_escape::ansi_escape_line;
|
||||||
use codex_app_server_client::AppServerRequestHandle;
|
use codex_app_server_client::AppServerRequestHandle;
|
||||||
|
use codex_app_server_client::TypedRequestError;
|
||||||
use codex_app_server_protocol::ClientRequest;
|
use codex_app_server_protocol::ClientRequest;
|
||||||
|
use codex_app_server_protocol::CodexErrorInfo as AppServerCodexErrorInfo;
|
||||||
use codex_app_server_protocol::ConfigLayerSource;
|
use codex_app_server_protocol::ConfigLayerSource;
|
||||||
use codex_app_server_protocol::ListMcpServerStatusParams;
|
use codex_app_server_protocol::ListMcpServerStatusParams;
|
||||||
use codex_app_server_protocol::ListMcpServerStatusResponse;
|
use codex_app_server_protocol::ListMcpServerStatusResponse;
|
||||||
@@ -63,6 +65,7 @@ use codex_app_server_protocol::ServerRequest;
|
|||||||
use codex_app_server_protocol::SkillsListResponse;
|
use codex_app_server_protocol::SkillsListResponse;
|
||||||
use codex_app_server_protocol::ThreadRollbackResponse;
|
use codex_app_server_protocol::ThreadRollbackResponse;
|
||||||
use codex_app_server_protocol::Turn;
|
use codex_app_server_protocol::Turn;
|
||||||
|
use codex_app_server_protocol::TurnError as AppServerTurnError;
|
||||||
use codex_app_server_protocol::TurnStatus;
|
use codex_app_server_protocol::TurnStatus;
|
||||||
use codex_core::config::Config;
|
use codex_core::config::Config;
|
||||||
use codex_core::config::ConfigBuilder;
|
use codex_core::config::ConfigBuilder;
|
||||||
@@ -435,8 +438,8 @@ fn emit_project_config_warnings(app_event_tx: &AppEventSender, config: &Config)
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_missing_system_bwrap_warning(app_event_tx: &AppEventSender) {
|
fn emit_system_bwrap_warning(app_event_tx: &AppEventSender) {
|
||||||
let Some(message) = codex_core::config::missing_system_bwrap_warning() else {
|
let Some(message) = codex_core::config::system_bwrap_warning() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -967,6 +970,18 @@ fn normalize_harness_overrides_for_cwd(
|
|||||||
Ok(overrides)
|
Ok(overrides)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn active_turn_not_steerable_turn_error(error: &TypedRequestError) -> Option<AppServerTurnError> {
|
||||||
|
let TypedRequestError::Server { source, .. } = error else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
let turn_error: AppServerTurnError = serde_json::from_value(source.data.clone()?).ok()?;
|
||||||
|
matches!(
|
||||||
|
turn_error.codex_error_info,
|
||||||
|
Some(AppServerCodexErrorInfo::ActiveTurnNotSteerable { .. })
|
||||||
|
)
|
||||||
|
.then_some(turn_error)
|
||||||
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub fn chatwidget_init_for_forked_or_resumed_thread(
|
pub fn chatwidget_init_for_forked_or_resumed_thread(
|
||||||
&self,
|
&self,
|
||||||
@@ -1950,9 +1965,21 @@ impl App {
|
|||||||
personality,
|
personality,
|
||||||
} => {
|
} => {
|
||||||
if let Some(turn_id) = self.active_turn_id_for_thread(thread_id).await {
|
if let Some(turn_id) = self.active_turn_id_for_thread(thread_id).await {
|
||||||
app_server
|
match app_server
|
||||||
.turn_steer(thread_id, turn_id, items.to_vec())
|
.turn_steer(thread_id, turn_id, items.to_vec())
|
||||||
.await?;
|
.await
|
||||||
|
{
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(error) => {
|
||||||
|
if let Some(turn_error) = active_turn_not_steerable_turn_error(&error) {
|
||||||
|
if !self.chat_widget.enqueue_rejected_steer() {
|
||||||
|
self.chat_widget.add_error_message(turn_error.message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Err(error.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
app_server
|
app_server
|
||||||
.turn_start(
|
.turn_start(
|
||||||
@@ -2794,7 +2821,7 @@ impl App {
|
|||||||
let (app_event_tx, mut app_event_rx) = unbounded_channel();
|
let (app_event_tx, mut app_event_rx) = unbounded_channel();
|
||||||
let app_event_tx = AppEventSender::new(app_event_tx);
|
let app_event_tx = AppEventSender::new(app_event_tx);
|
||||||
emit_project_config_warnings(&app_event_tx, &config);
|
emit_project_config_warnings(&app_event_tx, &config);
|
||||||
emit_missing_system_bwrap_warning(&app_event_tx);
|
emit_system_bwrap_warning(&app_event_tx);
|
||||||
tui.set_notification_method(config.tui_notification_method);
|
tui.set_notification_method(config.tui_notification_method);
|
||||||
|
|
||||||
let harness_overrides =
|
let harness_overrides =
|
||||||
@@ -5170,10 +5197,12 @@ mod tests {
|
|||||||
use codex_app_server_protocol::AgentMessageDeltaNotification;
|
use codex_app_server_protocol::AgentMessageDeltaNotification;
|
||||||
use codex_app_server_protocol::CommandExecutionRequestApprovalParams;
|
use codex_app_server_protocol::CommandExecutionRequestApprovalParams;
|
||||||
use codex_app_server_protocol::ConfigWarningNotification;
|
use codex_app_server_protocol::ConfigWarningNotification;
|
||||||
|
use codex_app_server_protocol::JSONRPCErrorError;
|
||||||
use codex_app_server_protocol::NetworkApprovalContext as AppServerNetworkApprovalContext;
|
use codex_app_server_protocol::NetworkApprovalContext as AppServerNetworkApprovalContext;
|
||||||
use codex_app_server_protocol::NetworkApprovalProtocol as AppServerNetworkApprovalProtocol;
|
use codex_app_server_protocol::NetworkApprovalProtocol as AppServerNetworkApprovalProtocol;
|
||||||
use codex_app_server_protocol::NetworkPolicyAmendment as AppServerNetworkPolicyAmendment;
|
use codex_app_server_protocol::NetworkPolicyAmendment as AppServerNetworkPolicyAmendment;
|
||||||
use codex_app_server_protocol::NetworkPolicyRuleAction as AppServerNetworkPolicyRuleAction;
|
use codex_app_server_protocol::NetworkPolicyRuleAction as AppServerNetworkPolicyRuleAction;
|
||||||
|
use codex_app_server_protocol::NonSteerableTurnKind as AppServerNonSteerableTurnKind;
|
||||||
use codex_app_server_protocol::RequestId as AppServerRequestId;
|
use codex_app_server_protocol::RequestId as AppServerRequestId;
|
||||||
use codex_app_server_protocol::ServerNotification;
|
use codex_app_server_protocol::ServerNotification;
|
||||||
use codex_app_server_protocol::ServerRequest;
|
use codex_app_server_protocol::ServerRequest;
|
||||||
@@ -5186,6 +5215,7 @@ mod tests {
|
|||||||
use codex_app_server_protocol::TokenUsageBreakdown;
|
use codex_app_server_protocol::TokenUsageBreakdown;
|
||||||
use codex_app_server_protocol::Turn;
|
use codex_app_server_protocol::Turn;
|
||||||
use codex_app_server_protocol::TurnCompletedNotification;
|
use codex_app_server_protocol::TurnCompletedNotification;
|
||||||
|
use codex_app_server_protocol::TurnError as AppServerTurnError;
|
||||||
use codex_app_server_protocol::TurnStartedNotification;
|
use codex_app_server_protocol::TurnStartedNotification;
|
||||||
use codex_app_server_protocol::TurnStatus;
|
use codex_app_server_protocol::TurnStatus;
|
||||||
use codex_app_server_protocol::UserInput as AppServerUserInput;
|
use codex_app_server_protocol::UserInput as AppServerUserInput;
|
||||||
@@ -5735,7 +5765,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5785,7 +5815,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5834,7 +5864,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5881,7 +5911,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -5951,7 +5981,7 @@ mod tests {
|
|||||||
app.chat_widget
|
app.chat_widget
|
||||||
.apply_external_edit("queued follow-up".to_string());
|
.apply_external_edit("queued follow-up".to_string());
|
||||||
app.chat_widget
|
app.chat_widget
|
||||||
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
.handle_key_event(KeyEvent::new(KeyCode::Tab, KeyModifiers::NONE));
|
||||||
let input_state = app
|
let input_state = app
|
||||||
.chat_widget
|
.chat_widget
|
||||||
.capture_thread_input_state()
|
.capture_thread_input_state()
|
||||||
@@ -8017,6 +8047,30 @@ guardian_approval = true
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn active_turn_not_steerable_turn_error_extracts_structured_server_error() {
|
||||||
|
let turn_error = AppServerTurnError {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(AppServerCodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: AppServerNonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
additional_details: None,
|
||||||
|
};
|
||||||
|
let error = TypedRequestError::Server {
|
||||||
|
method: "turn/steer".to_string(),
|
||||||
|
source: JSONRPCErrorError {
|
||||||
|
code: -32602,
|
||||||
|
message: turn_error.message.clone(),
|
||||||
|
data: Some(serde_json::to_value(&turn_error).expect("turn error should serialize")),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
active_turn_not_steerable_turn_error(&error),
|
||||||
|
Some(turn_error)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn select_model_availability_nux_uses_existing_model_order_as_priority() {
|
fn select_model_availability_nux_uses_existing_model_order_as_priority() {
|
||||||
let mut presets = all_model_presets();
|
let mut presets = all_model_presets();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use codex_app_server_client::AppServerClient;
|
use codex_app_server_client::AppServerClient;
|
||||||
use codex_app_server_client::AppServerEvent;
|
use codex_app_server_client::AppServerEvent;
|
||||||
use codex_app_server_client::AppServerRequestHandle;
|
use codex_app_server_client::AppServerRequestHandle;
|
||||||
|
use codex_app_server_client::TypedRequestError;
|
||||||
use codex_app_server_protocol::Account;
|
use codex_app_server_protocol::Account;
|
||||||
use codex_app_server_protocol::AuthMode;
|
use codex_app_server_protocol::AuthMode;
|
||||||
use codex_app_server_protocol::ClientRequest;
|
use codex_app_server_protocol::ClientRequest;
|
||||||
@@ -429,7 +430,7 @@ impl AppServerSession {
|
|||||||
thread_id: ThreadId,
|
thread_id: ThreadId,
|
||||||
turn_id: String,
|
turn_id: String,
|
||||||
items: Vec<codex_protocol::user_input::UserInput>,
|
items: Vec<codex_protocol::user_input::UserInput>,
|
||||||
) -> Result<TurnSteerResponse> {
|
) -> std::result::Result<TurnSteerResponse, TypedRequestError> {
|
||||||
let request_id = self.next_request_id();
|
let request_id = self.next_request_id();
|
||||||
self.client
|
self.client
|
||||||
.request_typed(ClientRequest::TurnSteer {
|
.request_typed(ClientRequest::TurnSteer {
|
||||||
@@ -441,7 +442,6 @@ impl AppServerSession {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.wrap_err("turn/steer failed in app-server TUI")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn thread_set_name(
|
pub(crate) async fn thread_set_name(
|
||||||
|
|||||||
@@ -3599,6 +3599,13 @@ impl ChatComposer {
|
|||||||
|
|
||||||
fn mention_items(&self) -> Vec<MentionItem> {
|
fn mention_items(&self) -> Vec<MentionItem> {
|
||||||
let mut mentions = Vec::new();
|
let mut mentions = Vec::new();
|
||||||
|
let plugin_display_names: HashSet<String> =
|
||||||
|
self.plugins.as_ref().map_or_else(HashSet::new, |plugins| {
|
||||||
|
plugins
|
||||||
|
.iter()
|
||||||
|
.map(|plugin| plugin.display_name.to_ascii_lowercase())
|
||||||
|
.collect()
|
||||||
|
});
|
||||||
|
|
||||||
if let Some(skills) = self.skills.as_ref() {
|
if let Some(skills) = self.skills.as_ref() {
|
||||||
for skill in skills {
|
for skill in skills {
|
||||||
@@ -3681,18 +3688,30 @@ impl ChatComposer {
|
|||||||
if !connector.is_accessible || !connector.is_enabled {
|
if !connector.is_accessible || !connector.is_enabled {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let plugin_backed_connector = connector
|
||||||
|
.plugin_display_names
|
||||||
|
.iter()
|
||||||
|
.any(|name| plugin_display_names.contains(&name.to_ascii_lowercase()));
|
||||||
|
if plugin_backed_connector {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let display_name = connectors::connector_display_label(connector);
|
let display_name = connectors::connector_display_label(connector);
|
||||||
let description = Some(Self::connector_brief_description(connector));
|
let description = Some(Self::connector_brief_description(connector));
|
||||||
let slug = codex_core::connectors::connector_mention_slug(connector);
|
let slug = codex_core::connectors::connector_mention_slug(connector);
|
||||||
let search_terms = vec![display_name.clone(), connector.id.clone(), slug.clone()];
|
let search_terms = vec![display_name.clone(), connector.id.clone(), slug.clone()];
|
||||||
let connector_id = connector.id.as_str();
|
let connector_id = connector.id.as_str();
|
||||||
|
let category_tag = if connector.plugin_display_names.is_empty() {
|
||||||
|
"[App]".to_string()
|
||||||
|
} else {
|
||||||
|
"[Plugin]".to_string()
|
||||||
|
};
|
||||||
mentions.push(MentionItem {
|
mentions.push(MentionItem {
|
||||||
display_name: display_name.clone(),
|
display_name: display_name.clone(),
|
||||||
description,
|
description,
|
||||||
insert_text: format!("${slug}"),
|
insert_text: format!("${slug}"),
|
||||||
search_terms,
|
search_terms,
|
||||||
path: Some(format!("app://{connector_id}")),
|
path: Some(format!("app://{connector_id}")),
|
||||||
category_tag: Some("[App]".to_string()),
|
category_tag: Some(category_tag),
|
||||||
sort_rank: 1,
|
sort_rank: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -5398,6 +5417,93 @@ mod tests {
|
|||||||
assert_eq!(mention.path, Some("plugin://sample@test".to_string()));
|
assert_eq!(mention.path, Some("plugin://sample@test".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mention_items_keep_plugin_owned_skills_but_hide_duplicate_apps() {
|
||||||
|
let (tx, _rx) = unbounded_channel::<AppEvent>();
|
||||||
|
let sender = AppEventSender::new(tx);
|
||||||
|
let mut composer = ChatComposer::new(
|
||||||
|
true,
|
||||||
|
sender,
|
||||||
|
false,
|
||||||
|
"Ask Codex to do anything".to_string(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
composer.set_connectors_enabled(true);
|
||||||
|
composer.set_text_content("$goog".to_string(), Vec::new(), Vec::new());
|
||||||
|
composer.set_skill_mentions(Some(vec![SkillMetadata {
|
||||||
|
name: "google-calendar:availability".to_string(),
|
||||||
|
description: "Find availability and plan event changes".to_string(),
|
||||||
|
short_description: None,
|
||||||
|
interface: Some(codex_core::skills::model::SkillInterface {
|
||||||
|
display_name: Some("Google Calendar".to_string()),
|
||||||
|
short_description: None,
|
||||||
|
icon_small: None,
|
||||||
|
icon_large: None,
|
||||||
|
brand_color: None,
|
||||||
|
default_prompt: None,
|
||||||
|
}),
|
||||||
|
dependencies: None,
|
||||||
|
policy: None,
|
||||||
|
permission_profile: None,
|
||||||
|
managed_network_override: None,
|
||||||
|
path_to_skills_md: PathBuf::from("/tmp/repo/google-calendar/SKILL.md"),
|
||||||
|
scope: codex_protocol::protocol::SkillScope::Repo,
|
||||||
|
}]));
|
||||||
|
composer.set_plugin_mentions(Some(vec![PluginCapabilitySummary {
|
||||||
|
config_name: "google-calendar@debug".to_string(),
|
||||||
|
display_name: "Google Calendar".to_string(),
|
||||||
|
description: Some(
|
||||||
|
"Connect Google Calendar for scheduling, availability, and event management."
|
||||||
|
.to_string(),
|
||||||
|
),
|
||||||
|
has_skills: true,
|
||||||
|
mcp_server_names: vec!["google-calendar".to_string()],
|
||||||
|
app_connector_ids: vec![codex_core::plugins::AppConnectorId(
|
||||||
|
"google_calendar".to_string(),
|
||||||
|
)],
|
||||||
|
}]));
|
||||||
|
composer.set_connector_mentions(Some(ConnectorsSnapshot {
|
||||||
|
connectors: vec![AppInfo {
|
||||||
|
id: "google_calendar".to_string(),
|
||||||
|
name: "Google Calendar".to_string(),
|
||||||
|
description: Some("Look up events and availability".to_string()),
|
||||||
|
logo_url: None,
|
||||||
|
logo_url_dark: None,
|
||||||
|
distribution_channel: None,
|
||||||
|
branding: None,
|
||||||
|
app_metadata: None,
|
||||||
|
labels: None,
|
||||||
|
install_url: Some("https://example.test/google-calendar".to_string()),
|
||||||
|
is_accessible: true,
|
||||||
|
is_enabled: true,
|
||||||
|
plugin_display_names: vec!["Google Calendar".to_string()],
|
||||||
|
}],
|
||||||
|
}));
|
||||||
|
|
||||||
|
let mut mention_summaries: Vec<_> = composer
|
||||||
|
.mention_items()
|
||||||
|
.into_iter()
|
||||||
|
.map(|mention| (mention.display_name, mention.category_tag, mention.path))
|
||||||
|
.collect();
|
||||||
|
mention_summaries.sort();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
mention_summaries,
|
||||||
|
vec![
|
||||||
|
(
|
||||||
|
"Google Calendar".to_string(),
|
||||||
|
Some("[Plugin]".to_string()),
|
||||||
|
Some("plugin://google-calendar@debug".to_string()),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Google Calendar".to_string(),
|
||||||
|
Some("[Skill]".to_string()),
|
||||||
|
Some("/tmp/repo/google-calendar/SKILL.md".to_string()),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn plugin_mention_popup_snapshot() {
|
fn plugin_mention_popup_snapshot() {
|
||||||
snapshot_composer_state("plugin_mention_popup", false, |composer| {
|
snapshot_composer_state("plugin_mention_popup", false, |composer| {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ impl FileSearchPopup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.display_query = query.to_string();
|
self.display_query = query.to_string();
|
||||||
self.matches = matches;
|
self.matches = matches.into_iter().take(MAX_POPUP_ROWS).collect();
|
||||||
self.waiting = false;
|
self.waiting = false;
|
||||||
let len = self.matches.len();
|
let len = self.matches.len();
|
||||||
self.state.clamp_selection(len);
|
self.state.clamp_selection(len);
|
||||||
@@ -152,3 +152,33 @@ impl WidgetRef for &FileSearchPopup {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use codex_file_search::MatchType;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
fn file_match(index: usize) -> FileMatch {
|
||||||
|
FileMatch {
|
||||||
|
score: index as u32,
|
||||||
|
path: PathBuf::from(format!("src/file_{index:02}.rs")),
|
||||||
|
match_type: MatchType::File,
|
||||||
|
root: PathBuf::from("/tmp/repo"),
|
||||||
|
indices: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn set_matches_keeps_only_the_first_page_of_results() {
|
||||||
|
let mut popup = FileSearchPopup::new();
|
||||||
|
popup.set_query("file");
|
||||||
|
popup.set_matches("file", (0..(MAX_POPUP_ROWS + 2)).map(file_match).collect());
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
popup.matches,
|
||||||
|
(0..MAX_POPUP_ROWS).map(file_match).collect::<Vec<_>>()
|
||||||
|
);
|
||||||
|
assert_eq!(popup.calculate_required_height(), MAX_POPUP_ROWS as u16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -821,8 +821,10 @@ impl BottomPane {
|
|||||||
&mut self,
|
&mut self,
|
||||||
queued: Vec<String>,
|
queued: Vec<String>,
|
||||||
pending_steers: Vec<String>,
|
pending_steers: Vec<String>,
|
||||||
|
rejected_steers: Vec<String>,
|
||||||
) {
|
) {
|
||||||
self.pending_input_preview.pending_steers = pending_steers;
|
self.pending_input_preview.pending_steers = pending_steers;
|
||||||
|
self.pending_input_preview.rejected_steers = rejected_steers;
|
||||||
self.pending_input_preview.queued_messages = queued;
|
self.pending_input_preview.queued_messages = queued;
|
||||||
self.request_redraw();
|
self.request_redraw();
|
||||||
}
|
}
|
||||||
@@ -1143,7 +1145,8 @@ impl BottomPane {
|
|||||||
}
|
}
|
||||||
let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty();
|
let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty();
|
||||||
let has_pending_input = !self.pending_input_preview.queued_messages.is_empty()
|
let has_pending_input = !self.pending_input_preview.queued_messages.is_empty()
|
||||||
|| !self.pending_input_preview.pending_steers.is_empty();
|
|| !self.pending_input_preview.pending_steers.is_empty()
|
||||||
|
|| !self.pending_input_preview.rejected_steers.is_empty();
|
||||||
let has_status_or_footer =
|
let has_status_or_footer =
|
||||||
self.status.is_some() || !self.unified_exec_footer.is_empty();
|
self.status.is_some() || !self.unified_exec_footer.is_empty();
|
||||||
let has_inline_previews = has_pending_thread_approvals || has_pending_input;
|
let has_inline_previews = has_pending_thread_approvals || has_pending_input;
|
||||||
@@ -1546,7 +1549,11 @@ mod tests {
|
|||||||
StatusDetailsCapitalization::CapitalizeFirst,
|
StatusDetailsCapitalization::CapitalizeFirst,
|
||||||
STATUS_DETAILS_DEFAULT_MAX_LINES,
|
STATUS_DETAILS_DEFAULT_MAX_LINES,
|
||||||
);
|
);
|
||||||
pane.set_pending_input_preview(vec!["Queued follow-up question".to_string()], Vec::new());
|
pane.set_pending_input_preview(
|
||||||
|
vec!["Queued follow-up question".to_string()],
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
|
|
||||||
let width = 48;
|
let width = 48;
|
||||||
let height = pane.desired_height(width);
|
let height = pane.desired_height(width);
|
||||||
@@ -1573,7 +1580,11 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
pane.set_task_running(true);
|
pane.set_task_running(true);
|
||||||
pane.set_pending_input_preview(vec!["Queued follow-up question".to_string()], Vec::new());
|
pane.set_pending_input_preview(
|
||||||
|
vec!["Queued follow-up question".to_string()],
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
pane.hide_status_indicator();
|
pane.hide_status_indicator();
|
||||||
|
|
||||||
let width = 48;
|
let width = 48;
|
||||||
@@ -1601,7 +1612,11 @@ mod tests {
|
|||||||
});
|
});
|
||||||
|
|
||||||
pane.set_task_running(true);
|
pane.set_task_running(true);
|
||||||
pane.set_pending_input_preview(vec!["Queued follow-up question".to_string()], Vec::new());
|
pane.set_pending_input_preview(
|
||||||
|
vec!["Queued follow-up question".to_string()],
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
|
|
||||||
let width = 48;
|
let width = 48;
|
||||||
let height = pane.desired_height(width);
|
let height = pane.desired_height(width);
|
||||||
|
|||||||
@@ -10,17 +10,19 @@ use crate::render::renderable::Renderable;
|
|||||||
use crate::wrapping::RtOptions;
|
use crate::wrapping::RtOptions;
|
||||||
use crate::wrapping::adaptive_wrap_lines;
|
use crate::wrapping::adaptive_wrap_lines;
|
||||||
|
|
||||||
/// Widget that displays pending steers plus user messages queued while a turn is in progress.
|
/// Widget that displays pending steers plus follow-up messages held while a turn is in progress.
|
||||||
///
|
///
|
||||||
/// The widget renders pending steers first, then queued user messages, as two
|
/// The widget renders pending steers first, then rejected steers that will be
|
||||||
/// labeled sections. Pending steers explain that they will be submitted after
|
/// resubmitted at end of turn, then ordinary queued user messages. Pending
|
||||||
/// the next tool/result boundary unless the user presses Esc to interrupt and
|
/// steers explain that they will be submitted after the next tool/result
|
||||||
/// send them immediately. The edit hint at the bottom only appears when there
|
/// boundary unless the user presses Esc to interrupt and send them
|
||||||
/// are actual queued user messages to pop back into the composer. Because some
|
/// immediately. The edit hint at the bottom only appears when there are actual
|
||||||
/// terminals intercept certain modifier-key combinations, the displayed
|
/// queued user messages to pop back into the composer. Because some terminals
|
||||||
/// binding is configurable via [`set_edit_binding`](Self::set_edit_binding).
|
/// intercept certain modifier-key combinations, the displayed binding is
|
||||||
|
/// configurable via [`set_edit_binding`](Self::set_edit_binding).
|
||||||
pub(crate) struct PendingInputPreview {
|
pub(crate) struct PendingInputPreview {
|
||||||
pub pending_steers: Vec<String>,
|
pub pending_steers: Vec<String>,
|
||||||
|
pub rejected_steers: Vec<String>,
|
||||||
pub queued_messages: Vec<String>,
|
pub queued_messages: Vec<String>,
|
||||||
/// Key combination rendered in the hint line. Defaults to Alt+Up but may
|
/// Key combination rendered in the hint line. Defaults to Alt+Up but may
|
||||||
/// be overridden for terminals where that chord is unavailable.
|
/// be overridden for terminals where that chord is unavailable.
|
||||||
@@ -33,6 +35,7 @@ impl PendingInputPreview {
|
|||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
pending_steers: Vec::new(),
|
pending_steers: Vec::new(),
|
||||||
|
rejected_steers: Vec::new(),
|
||||||
queued_messages: Vec::new(),
|
queued_messages: Vec::new(),
|
||||||
edit_binding: key_hint::alt(KeyCode::Up),
|
edit_binding: key_hint::alt(KeyCode::Up),
|
||||||
}
|
}
|
||||||
@@ -67,7 +70,11 @@ impl PendingInputPreview {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn as_renderable(&self, width: u16) -> Box<dyn Renderable> {
|
fn as_renderable(&self, width: u16) -> Box<dyn Renderable> {
|
||||||
if (self.pending_steers.is_empty() && self.queued_messages.is_empty()) || width < 4 {
|
if (self.pending_steers.is_empty()
|
||||||
|
&& self.rejected_steers.is_empty()
|
||||||
|
&& self.queued_messages.is_empty())
|
||||||
|
|| width < 4
|
||||||
|
{
|
||||||
return Box::new(());
|
return Box::new(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +103,27 @@ impl PendingInputPreview {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !self.rejected_steers.is_empty() {
|
||||||
|
if !lines.is_empty() {
|
||||||
|
lines.push(Line::from(""));
|
||||||
|
}
|
||||||
|
Self::push_section_header(
|
||||||
|
&mut lines,
|
||||||
|
width,
|
||||||
|
"Messages to be submitted at end of turn".into(),
|
||||||
|
);
|
||||||
|
|
||||||
|
for steer in &self.rejected_steers {
|
||||||
|
let wrapped = adaptive_wrap_lines(
|
||||||
|
steer.lines().map(|line| Line::from(line.dim())),
|
||||||
|
RtOptions::new(width as usize)
|
||||||
|
.initial_indent(Line::from(" ↳ ".dim()))
|
||||||
|
.subsequent_indent(Line::from(" ")),
|
||||||
|
);
|
||||||
|
Self::push_truncated_preview_lines(&mut lines, wrapped, Line::from(" …".dim()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !self.queued_messages.is_empty() {
|
if !self.queued_messages.is_empty() {
|
||||||
if !lines.is_empty() {
|
if !lines.is_empty() {
|
||||||
lines.push(Line::from(""));
|
lines.push(Line::from(""));
|
||||||
@@ -304,6 +332,9 @@ mod tests {
|
|||||||
queue
|
queue
|
||||||
.pending_steers
|
.pending_steers
|
||||||
.push("Check the last command output.".to_string());
|
.push("Check the last command output.".to_string());
|
||||||
|
queue
|
||||||
|
.rejected_steers
|
||||||
|
.push("Rejected steer that will be retried.".to_string());
|
||||||
queue
|
queue
|
||||||
.queued_messages
|
.queued_messages
|
||||||
.push("Queued follow-up question".to_string());
|
.push("Queued follow-up question".to_string());
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ impl SkillPopup {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
out.truncate(MAX_POPUP_ROWS);
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,3 +230,43 @@ fn skill_popup_hint_line() -> Line<'static> {
|
|||||||
" to close".into(),
|
" to close".into(),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
fn mention_item(index: usize) -> MentionItem {
|
||||||
|
MentionItem {
|
||||||
|
display_name: format!("Mention {index:02}"),
|
||||||
|
description: Some(format!("Description {index:02}")),
|
||||||
|
insert_text: format!("$mention-{index:02}"),
|
||||||
|
search_terms: vec![format!("mention-{index:02}")],
|
||||||
|
path: Some(format!("skill://mention-{index:02}")),
|
||||||
|
category_tag: Some("[Skill]".to_string()),
|
||||||
|
sort_rank: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn filtered_mentions_are_capped_to_max_popup_rows() {
|
||||||
|
let popup = SkillPopup::new((0..(MAX_POPUP_ROWS + 2)).map(mention_item).collect());
|
||||||
|
|
||||||
|
let filtered_names: Vec<String> = popup
|
||||||
|
.filtered_items()
|
||||||
|
.into_iter()
|
||||||
|
.map(|idx| popup.mentions[idx].display_name.clone())
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
filtered_names,
|
||||||
|
(0..MAX_POPUP_ROWS)
|
||||||
|
.map(|idx| format!("Mention {idx:02}"))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
popup.calculate_required_height(72),
|
||||||
|
(MAX_POPUP_ROWS as u16) + 2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+12
-5
@@ -3,13 +3,16 @@ source: tui_app_server/src/bottom_pane/pending_input_preview.rs
|
|||||||
expression: "format!(\"{buf:?}\")"
|
expression: "format!(\"{buf:?}\")"
|
||||||
---
|
---
|
||||||
Buffer {
|
Buffer {
|
||||||
area: Rect { x: 0, y: 0, width: 52, height: 8 },
|
area: Rect { x: 0, y: 0, width: 52, height: 11 },
|
||||||
content: [
|
content: [
|
||||||
"• Messages to be submitted after next tool call ",
|
"• Messages to be submitted after next tool call ",
|
||||||
" (press esc to interrupt and send immediately) ",
|
" (press esc to interrupt and send immediately) ",
|
||||||
" ↳ Please continue. ",
|
" ↳ Please continue. ",
|
||||||
" ↳ Check the last command output. ",
|
" ↳ Check the last command output. ",
|
||||||
" ",
|
" ",
|
||||||
|
"• Messages to be submitted at end of turn ",
|
||||||
|
" ↳ Rejected steer that will be retried. ",
|
||||||
|
" ",
|
||||||
"• Queued follow-up messages ",
|
"• Queued follow-up messages ",
|
||||||
" ↳ Queued follow-up question ",
|
" ↳ Queued follow-up question ",
|
||||||
" ⌥ + ↑ edit last queued message ",
|
" ⌥ + ↑ edit last queued message ",
|
||||||
@@ -26,9 +29,13 @@ Buffer {
|
|||||||
x: 0, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
x: 0, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
x: 2, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
x: 2, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
x: 0, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
x: 0, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
x: 4, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: DIM | ITALIC,
|
x: 40, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
x: 29, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
x: 0, y: 8, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
x: 0, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
x: 2, y: 8, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
x: 34, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
x: 0, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
|
x: 4, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: DIM | ITALIC,
|
||||||
|
x: 29, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
|
x: 0, y: 10, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
|
||||||
|
x: 34, y: 10, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -807,6 +807,8 @@ pub(crate) struct ChatWidget {
|
|||||||
suppress_initial_user_message_submit: bool,
|
suppress_initial_user_message_submit: bool,
|
||||||
// User messages queued while a turn is in progress
|
// User messages queued while a turn is in progress
|
||||||
queued_user_messages: VecDeque<UserMessage>,
|
queued_user_messages: VecDeque<UserMessage>,
|
||||||
|
// User messages that tried to steer a non-regular turn and must be retried first.
|
||||||
|
rejected_steers_queue: VecDeque<UserMessage>,
|
||||||
// Steers already submitted to core but not yet committed into history.
|
// Steers already submitted to core but not yet committed into history.
|
||||||
//
|
//
|
||||||
// The bottom pane shows these above queued drafts until core records the
|
// The bottom pane shows these above queued drafts until core records the
|
||||||
@@ -958,9 +960,11 @@ impl ThreadComposerState {
|
|||||||
pub(crate) struct ThreadInputState {
|
pub(crate) struct ThreadInputState {
|
||||||
composer: Option<ThreadComposerState>,
|
composer: Option<ThreadComposerState>,
|
||||||
pending_steers: VecDeque<UserMessage>,
|
pending_steers: VecDeque<UserMessage>,
|
||||||
|
rejected_steers_queue: VecDeque<UserMessage>,
|
||||||
queued_user_messages: VecDeque<UserMessage>,
|
queued_user_messages: VecDeque<UserMessage>,
|
||||||
current_collaboration_mode: CollaborationMode,
|
current_collaboration_mode: CollaborationMode,
|
||||||
active_collaboration_mask: Option<CollaborationModeMask>,
|
active_collaboration_mask: Option<CollaborationModeMask>,
|
||||||
|
task_running: bool,
|
||||||
agent_turn_running: bool,
|
agent_turn_running: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2172,7 +2176,7 @@ impl ChatWidget {
|
|||||||
let had_pending_steers = !self.pending_steers.is_empty();
|
let had_pending_steers = !self.pending_steers.is_empty();
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
|
|
||||||
if !from_replay && self.queued_user_messages.is_empty() && !had_pending_steers {
|
if !from_replay && !self.has_queued_follow_up_messages() && !had_pending_steers {
|
||||||
self.maybe_prompt_plan_implementation();
|
self.maybe_prompt_plan_implementation();
|
||||||
}
|
}
|
||||||
// Keep this flag for replayed completion events so a subsequent live TurnComplete can
|
// Keep this flag for replayed completion events so a subsequent live TurnComplete can
|
||||||
@@ -2194,7 +2198,7 @@ impl ChatWidget {
|
|||||||
if !self.collaboration_modes_enabled() {
|
if !self.collaboration_modes_enabled() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !self.queued_user_messages.is_empty() {
|
if self.has_queued_follow_up_messages() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if self.active_mode_kind() != ModeKind::Plan {
|
if self.active_mode_kind() != ModeKind::Plan {
|
||||||
@@ -2266,6 +2270,57 @@ impl ChatWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn has_queued_follow_up_messages(&self) -> bool {
|
||||||
|
!self.rejected_steers_queue.is_empty() || !self.queued_user_messages.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pop_next_queued_user_message(&mut self) -> Option<UserMessage> {
|
||||||
|
if self.rejected_steers_queue.is_empty() {
|
||||||
|
self.queued_user_messages.pop_front()
|
||||||
|
} else {
|
||||||
|
Some(merge_user_messages(
|
||||||
|
self.rejected_steers_queue.drain(..).collect(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pop_latest_queued_user_message(&mut self) -> Option<UserMessage> {
|
||||||
|
self.queued_user_messages
|
||||||
|
.pop_back()
|
||||||
|
.or_else(|| self.rejected_steers_queue.pop_back())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn enqueue_rejected_steer(&mut self) -> bool {
|
||||||
|
let Some(pending_steer) = self.pending_steers.pop_front() else {
|
||||||
|
tracing::warn!(
|
||||||
|
"received active-turn-not-steerable error without a matching pending steer"
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
self.rejected_steers_queue
|
||||||
|
.push_back(pending_steer.user_message);
|
||||||
|
self.refresh_pending_input_preview();
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
fn handle_steer_rejected_error(&mut self, codex_error_info: &CoreCodexErrorInfo) -> bool {
|
||||||
|
matches!(
|
||||||
|
codex_error_info,
|
||||||
|
CoreCodexErrorInfo::ActiveTurnNotSteerable { .. }
|
||||||
|
) && self.enqueue_rejected_steer()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_app_server_steer_rejected_error(
|
||||||
|
&mut self,
|
||||||
|
codex_error_info: &AppServerCodexErrorInfo,
|
||||||
|
) -> bool {
|
||||||
|
matches!(
|
||||||
|
codex_error_info,
|
||||||
|
AppServerCodexErrorInfo::ActiveTurnNotSteerable { .. }
|
||||||
|
) && self.enqueue_rejected_steer()
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn open_multi_agent_enable_prompt(&mut self) {
|
pub(crate) fn open_multi_agent_enable_prompt(&mut self) {
|
||||||
let items = vec![
|
let items = vec![
|
||||||
SelectionItem {
|
SelectionItem {
|
||||||
@@ -2508,7 +2563,11 @@ impl ChatWidget {
|
|||||||
message: String,
|
message: String,
|
||||||
codex_error_info: Option<AppServerCodexErrorInfo>,
|
codex_error_info: Option<AppServerCodexErrorInfo>,
|
||||||
) {
|
) {
|
||||||
if let Some(info) = codex_error_info
|
if codex_error_info
|
||||||
|
.as_ref()
|
||||||
|
.is_some_and(|info| self.handle_app_server_steer_rejected_error(info))
|
||||||
|
{
|
||||||
|
} else if let Some(info) = codex_error_info
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(app_server_rate_limit_error_kind)
|
.and_then(app_server_rate_limit_error_kind)
|
||||||
{
|
{
|
||||||
@@ -2648,7 +2707,7 @@ impl ChatWidget {
|
|||||||
/// state stays aligned with the merged attachment list. Returns `None` when there is nothing to
|
/// state stays aligned with the merged attachment list. Returns `None` when there is nothing to
|
||||||
/// restore.
|
/// restore.
|
||||||
fn drain_pending_messages_for_restore(&mut self) -> Option<UserMessage> {
|
fn drain_pending_messages_for_restore(&mut self) -> Option<UserMessage> {
|
||||||
if self.pending_steers.is_empty() && self.queued_user_messages.is_empty() {
|
if self.pending_steers.is_empty() && !self.has_queued_follow_up_messages() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2660,11 +2719,12 @@ impl ChatWidget {
|
|||||||
mention_bindings: self.bottom_pane.composer_mention_bindings(),
|
mention_bindings: self.bottom_pane.composer_mention_bindings(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut to_merge: Vec<UserMessage> = self
|
let mut to_merge: Vec<UserMessage> = self.rejected_steers_queue.drain(..).collect();
|
||||||
.pending_steers
|
to_merge.extend(
|
||||||
.drain(..)
|
self.pending_steers
|
||||||
.map(|steer| steer.user_message)
|
.drain(..)
|
||||||
.collect();
|
.map(|steer| steer.user_message),
|
||||||
|
);
|
||||||
to_merge.extend(self.queued_user_messages.drain(..));
|
to_merge.extend(self.queued_user_messages.drain(..));
|
||||||
if !existing_message.text.is_empty()
|
if !existing_message.text.is_empty()
|
||||||
|| !existing_message.local_images.is_empty()
|
|| !existing_message.local_images.is_empty()
|
||||||
@@ -2710,14 +2770,17 @@ impl ChatWidget {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|pending| pending.user_message.clone())
|
.map(|pending| pending.user_message.clone())
|
||||||
.collect(),
|
.collect(),
|
||||||
|
rejected_steers_queue: self.rejected_steers_queue.clone(),
|
||||||
queued_user_messages: self.queued_user_messages.clone(),
|
queued_user_messages: self.queued_user_messages.clone(),
|
||||||
current_collaboration_mode: self.current_collaboration_mode.clone(),
|
current_collaboration_mode: self.current_collaboration_mode.clone(),
|
||||||
active_collaboration_mask: self.active_collaboration_mask.clone(),
|
active_collaboration_mask: self.active_collaboration_mask.clone(),
|
||||||
|
task_running: self.bottom_pane.is_task_running(),
|
||||||
agent_turn_running: self.agent_turn_running,
|
agent_turn_running: self.agent_turn_running,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn restore_thread_input_state(&mut self, input_state: Option<ThreadInputState>) {
|
pub(crate) fn restore_thread_input_state(&mut self, input_state: Option<ThreadInputState>) {
|
||||||
|
let restored_task_running = input_state.as_ref().is_some_and(|state| state.task_running);
|
||||||
if let Some(input_state) = input_state {
|
if let Some(input_state) = input_state {
|
||||||
self.current_collaboration_mode = input_state.current_collaboration_mode;
|
self.current_collaboration_mode = input_state.current_collaboration_mode;
|
||||||
self.active_collaboration_mask = input_state.active_collaboration_mask;
|
self.active_collaboration_mask = input_state.active_collaboration_mask;
|
||||||
@@ -2749,13 +2812,24 @@ impl ChatWidget {
|
|||||||
);
|
);
|
||||||
self.bottom_pane.set_composer_pending_pastes(Vec::new());
|
self.bottom_pane.set_composer_pending_pastes(Vec::new());
|
||||||
}
|
}
|
||||||
self.pending_steers.clear();
|
self.pending_steers = input_state
|
||||||
self.queued_user_messages = input_state.pending_steers;
|
.pending_steers
|
||||||
self.queued_user_messages
|
.into_iter()
|
||||||
.extend(input_state.queued_user_messages);
|
.map(|user_message| PendingSteer {
|
||||||
|
compare_key: PendingSteerCompareKey {
|
||||||
|
message: user_message.text.clone(),
|
||||||
|
image_count: user_message.local_images.len()
|
||||||
|
+ user_message.remote_image_urls.len(),
|
||||||
|
},
|
||||||
|
user_message,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
self.rejected_steers_queue = input_state.rejected_steers_queue;
|
||||||
|
self.queued_user_messages = input_state.queued_user_messages;
|
||||||
} else {
|
} else {
|
||||||
self.agent_turn_running = false;
|
self.agent_turn_running = false;
|
||||||
self.pending_steers.clear();
|
self.pending_steers.clear();
|
||||||
|
self.rejected_steers_queue.clear();
|
||||||
self.set_remote_image_urls(Vec::new());
|
self.set_remote_image_urls(Vec::new());
|
||||||
self.bottom_pane.set_composer_text_with_mention_bindings(
|
self.bottom_pane.set_composer_text_with_mention_bindings(
|
||||||
String::new(),
|
String::new(),
|
||||||
@@ -2769,6 +2843,9 @@ impl ChatWidget {
|
|||||||
self.turn_sleep_inhibitor
|
self.turn_sleep_inhibitor
|
||||||
.set_turn_running(self.agent_turn_running);
|
.set_turn_running(self.agent_turn_running);
|
||||||
self.update_task_running_state();
|
self.update_task_running_state();
|
||||||
|
if restored_task_running && !self.bottom_pane.is_task_running() {
|
||||||
|
self.bottom_pane.set_task_running(/*running*/ true);
|
||||||
|
}
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
self.request_redraw();
|
self.request_redraw();
|
||||||
}
|
}
|
||||||
@@ -4244,6 +4321,7 @@ impl ChatWidget {
|
|||||||
thread_name: None,
|
thread_name: None,
|
||||||
forked_from: None,
|
forked_from: None,
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
submit_pending_steers_after_interrupt: false,
|
submit_pending_steers_after_interrupt: false,
|
||||||
queued_message_edit_binding,
|
queued_message_edit_binding,
|
||||||
@@ -4381,9 +4459,9 @@ impl ChatWidget {
|
|||||||
|
|
||||||
if key_event.kind == KeyEventKind::Press
|
if key_event.kind == KeyEventKind::Press
|
||||||
&& self.queued_message_edit_binding.is_press(key_event)
|
&& self.queued_message_edit_binding.is_press(key_event)
|
||||||
&& !self.queued_user_messages.is_empty()
|
&& self.has_queued_follow_up_messages()
|
||||||
{
|
{
|
||||||
if let Some(user_message) = self.queued_user_messages.pop_back() {
|
if let Some(user_message) = self.pop_latest_queued_user_message() {
|
||||||
self.restore_user_message_to_composer(user_message);
|
self.restore_user_message_to_composer(user_message);
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
self.request_redraw();
|
self.request_redraw();
|
||||||
@@ -4607,6 +4685,9 @@ impl ChatWidget {
|
|||||||
}
|
}
|
||||||
SlashCommand::Compact => {
|
SlashCommand::Compact => {
|
||||||
self.clear_token_usage();
|
self.clear_token_usage();
|
||||||
|
if !self.bottom_pane.is_task_running() {
|
||||||
|
self.bottom_pane.set_task_running(/*running*/ true);
|
||||||
|
}
|
||||||
self.app_event_tx.compact();
|
self.app_event_tx.compact();
|
||||||
}
|
}
|
||||||
SlashCommand::Review => {
|
SlashCommand::Review => {
|
||||||
@@ -5099,10 +5180,7 @@ impl ChatWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn queue_user_message(&mut self, user_message: UserMessage) {
|
fn queue_user_message(&mut self, user_message: UserMessage) {
|
||||||
if !self.is_session_configured()
|
if !self.is_session_configured() || self.bottom_pane.is_task_running() {
|
||||||
|| self.bottom_pane.is_task_running()
|
|
||||||
|| self.is_review_mode
|
|
||||||
{
|
|
||||||
self.queued_user_messages.push_back(user_message);
|
self.queued_user_messages.push_back(user_message);
|
||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
} else {
|
} else {
|
||||||
@@ -5117,12 +5195,6 @@ impl ChatWidget {
|
|||||||
self.refresh_pending_input_preview();
|
self.refresh_pending_input_preview();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if self.is_review_mode {
|
|
||||||
self.queued_user_messages.push_back(user_message);
|
|
||||||
self.refresh_pending_input_preview();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let UserMessage {
|
let UserMessage {
|
||||||
text,
|
text,
|
||||||
local_images,
|
local_images,
|
||||||
@@ -6406,7 +6478,9 @@ impl ChatWidget {
|
|||||||
}
|
}
|
||||||
EventMsg::TurnComplete(TurnCompleteEvent {
|
EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
last_agent_message, ..
|
last_agent_message, ..
|
||||||
}) => self.on_task_complete(last_agent_message, from_replay),
|
}) => {
|
||||||
|
self.on_task_complete(last_agent_message, from_replay);
|
||||||
|
}
|
||||||
EventMsg::TokenCount(ev) => {
|
EventMsg::TokenCount(ev) => {
|
||||||
self.set_token_info(ev.info);
|
self.set_token_info(ev.info);
|
||||||
self.on_rate_limit_snapshot(ev.rate_limits);
|
self.on_rate_limit_snapshot(ev.rate_limits);
|
||||||
@@ -6418,8 +6492,13 @@ impl ChatWidget {
|
|||||||
message,
|
message,
|
||||||
codex_error_info,
|
codex_error_info,
|
||||||
}) => {
|
}) => {
|
||||||
if let Some(info) = codex_error_info
|
if codex_error_info
|
||||||
&& let Some(kind) = core_rate_limit_error_kind(&info)
|
.as_ref()
|
||||||
|
.is_some_and(|info| self.handle_steer_rejected_error(info))
|
||||||
|
{
|
||||||
|
} else if let Some(kind) = codex_error_info
|
||||||
|
.as_ref()
|
||||||
|
.and_then(core_rate_limit_error_kind)
|
||||||
{
|
{
|
||||||
match kind {
|
match kind {
|
||||||
RateLimitErrorKind::ServerOverloaded => {
|
RateLimitErrorKind::ServerOverloaded => {
|
||||||
@@ -6784,7 +6863,7 @@ impl ChatWidget {
|
|||||||
if self.bottom_pane.is_task_running() {
|
if self.bottom_pane.is_task_running() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Some(user_message) = self.queued_user_messages.pop_front() {
|
if let Some(user_message) = self.pop_next_queued_user_message() {
|
||||||
self.submit_user_message(user_message);
|
self.submit_user_message(user_message);
|
||||||
}
|
}
|
||||||
// Update the list to reflect the remaining queued messages (if any).
|
// Update the list to reflect the remaining queued messages (if any).
|
||||||
@@ -6803,8 +6882,16 @@ impl ChatWidget {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|steer| steer.user_message.text.clone())
|
.map(|steer| steer.user_message.text.clone())
|
||||||
.collect();
|
.collect();
|
||||||
self.bottom_pane
|
let rejected_steers: Vec<String> = self
|
||||||
.set_pending_input_preview(queued_messages, pending_steers);
|
.rejected_steers_queue
|
||||||
|
.iter()
|
||||||
|
.map(|message| message.text.clone())
|
||||||
|
.collect();
|
||||||
|
self.bottom_pane.set_pending_input_preview(
|
||||||
|
queued_messages,
|
||||||
|
pending_steers,
|
||||||
|
rejected_steers,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_pending_thread_approvals(&mut self, threads: Vec<String>) {
|
pub(crate) fn set_pending_thread_approvals(&mut self, threads: Vec<String>) {
|
||||||
@@ -10035,9 +10122,14 @@ impl ChatWidget {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) fn queued_user_message_texts(&self) -> Vec<String> {
|
pub(crate) fn queued_user_message_texts(&self) -> Vec<String> {
|
||||||
self.queued_user_messages
|
self.rejected_steers_queue
|
||||||
.iter()
|
.iter()
|
||||||
.map(|message| message.text.clone())
|
.map(|message| message.text.clone())
|
||||||
|
.chain(
|
||||||
|
self.queued_user_messages
|
||||||
|
.iter()
|
||||||
|
.map(|message| message.text.clone()),
|
||||||
|
)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
source: tui_app_server/src/chatwidget/tests.rs
|
||||||
|
expression: term.backend().vt100().screen().contents()
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
• Working (0s • esc to interrupt)
|
||||||
|
|
||||||
|
• Messages to be submitted at end of turn
|
||||||
|
↳ Steer submitted while /compact was running.
|
||||||
|
|
||||||
|
› Ask Codex to do anything
|
||||||
|
|
||||||
|
? for shortcuts 100% context left
|
||||||
+3
-3
@@ -11,11 +11,11 @@ expression: term.backend().vt100().screen().contents()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
• Working (0s • esc to interrupt)
|
• Working (0s • esc to interrupt)
|
||||||
|
|
||||||
• Queued follow-up messages
|
• Messages to be submitted at end of turn
|
||||||
↳ Queued while /review is running.
|
↳ Steer submitted while /review was running.
|
||||||
⌥ + ↑ edit last queued message
|
|
||||||
|
|
||||||
› Ask Codex to do anything
|
› Ask Codex to do anything
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ use codex_protocol::protocol::ItemCompletedEvent;
|
|||||||
use codex_protocol::protocol::McpStartupCompleteEvent;
|
use codex_protocol::protocol::McpStartupCompleteEvent;
|
||||||
use codex_protocol::protocol::McpStartupStatus;
|
use codex_protocol::protocol::McpStartupStatus;
|
||||||
use codex_protocol::protocol::McpStartupUpdateEvent;
|
use codex_protocol::protocol::McpStartupUpdateEvent;
|
||||||
|
use codex_protocol::protocol::NonSteerableTurnKind;
|
||||||
use codex_protocol::protocol::Op;
|
use codex_protocol::protocol::Op;
|
||||||
use codex_protocol::protocol::PatchApplyBeginEvent;
|
use codex_protocol::protocol::PatchApplyBeginEvent;
|
||||||
use codex_protocol::protocol::PatchApplyEndEvent;
|
use codex_protocol::protocol::PatchApplyEndEvent;
|
||||||
@@ -1560,6 +1561,131 @@ async fn entered_review_mode_defaults_to_current_changes_banner() {
|
|||||||
assert!(chat.is_review_mode);
|
assert!(chat.is_review_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn steer_rejection_queues_review_follow_up_before_existing_queued_messages() {
|
||||||
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "review-start".into(),
|
||||||
|
msg: EventMsg::EnteredReviewMode(ReviewRequest {
|
||||||
|
target: ReviewTarget::BaseBranch {
|
||||||
|
branch: "feature".to_string(),
|
||||||
|
},
|
||||||
|
user_facing_hint: Some("feature branch".to_string()),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
let _ = drain_insert_history(&mut rx);
|
||||||
|
chat.queued_user_messages
|
||||||
|
.push_back(UserMessage::from("queued later"));
|
||||||
|
|
||||||
|
chat.submit_user_message(UserMessage::from("review follow-up one"));
|
||||||
|
chat.submit_user_message(UserMessage::from("review follow-up two"));
|
||||||
|
|
||||||
|
assert_eq!(chat.pending_steers.len(), 2);
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "review follow-up one".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected running-turn steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "review follow-up two".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected second running-turn steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected-1".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected-2".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
assert!(chat.pending_steers.is_empty());
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_message_texts(),
|
||||||
|
vec![
|
||||||
|
"review follow-up one",
|
||||||
|
"review follow-up two",
|
||||||
|
"queued later"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
assert!(drain_insert_history(&mut rx).is_empty());
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "review-exit".into(),
|
||||||
|
msg: EventMsg::ExitedReviewMode(ExitedReviewModeEvent {
|
||||||
|
review_output: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-complete".into(),
|
||||||
|
msg: EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
last_agent_message: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "review follow-up one\nreview follow-up two".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected merged rejected-steer follow-up submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-complete-2".into(),
|
||||||
|
msg: EventMsg::TurnComplete(TurnCompleteEvent {
|
||||||
|
turn_id: "turn-2".to_string(),
|
||||||
|
last_agent_message: None,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "queued later".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected queued draft submit after rejected steers, got {other:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn live_agent_message_renders_during_review_mode() {
|
async fn live_agent_message_renders_during_review_mode() {
|
||||||
let (mut chat, mut rx, _ops) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, _ops) = make_chatwidget_manual(None).await;
|
||||||
@@ -1934,6 +2060,7 @@ async fn make_chatwidget_manual(
|
|||||||
show_welcome_banner: true,
|
show_welcome_banner: true,
|
||||||
startup_tooltip_override: None,
|
startup_tooltip_override: None,
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
submit_pending_steers_after_interrupt: false,
|
submit_pending_steers_after_interrupt: false,
|
||||||
queued_message_edit_binding: crate::key_hint::alt(KeyCode::Up),
|
queued_message_edit_binding: crate::key_hint::alt(KeyCode::Up),
|
||||||
@@ -3716,9 +3843,11 @@ async fn restore_thread_input_state_syncs_sleep_inhibitor_state() {
|
|||||||
chat.restore_thread_input_state(Some(ThreadInputState {
|
chat.restore_thread_input_state(Some(ThreadInputState {
|
||||||
composer: None,
|
composer: None,
|
||||||
pending_steers: VecDeque::new(),
|
pending_steers: VecDeque::new(),
|
||||||
|
rejected_steers_queue: VecDeque::new(),
|
||||||
queued_user_messages: VecDeque::new(),
|
queued_user_messages: VecDeque::new(),
|
||||||
current_collaboration_mode: chat.current_collaboration_mode.clone(),
|
current_collaboration_mode: chat.current_collaboration_mode.clone(),
|
||||||
active_collaboration_mask: chat.active_collaboration_mask.clone(),
|
active_collaboration_mask: chat.active_collaboration_mask.clone(),
|
||||||
|
task_running: true,
|
||||||
agent_turn_running: true,
|
agent_turn_running: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -3733,6 +3862,38 @@ async fn restore_thread_input_state_syncs_sleep_inhibitor_state() {
|
|||||||
assert!(!chat.bottom_pane.is_task_running());
|
assert!(!chat.bottom_pane.is_task_running());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn restore_thread_input_state_restores_pending_steers_without_downgrading_them() {
|
||||||
|
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
let mut pending_steers = VecDeque::new();
|
||||||
|
pending_steers.push_back(UserMessage::from("pending steer"));
|
||||||
|
let mut rejected_steers_queue = VecDeque::new();
|
||||||
|
rejected_steers_queue.push_back(UserMessage::from("already rejected"));
|
||||||
|
let mut queued_user_messages = VecDeque::new();
|
||||||
|
queued_user_messages.push_back(UserMessage::from("queued draft"));
|
||||||
|
|
||||||
|
chat.restore_thread_input_state(Some(ThreadInputState {
|
||||||
|
composer: None,
|
||||||
|
pending_steers,
|
||||||
|
rejected_steers_queue,
|
||||||
|
queued_user_messages,
|
||||||
|
current_collaboration_mode: chat.current_collaboration_mode.clone(),
|
||||||
|
active_collaboration_mask: chat.active_collaboration_mask.clone(),
|
||||||
|
task_running: false,
|
||||||
|
agent_turn_running: false,
|
||||||
|
}));
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_message_texts(),
|
||||||
|
vec!["already rejected", "queued draft"]
|
||||||
|
);
|
||||||
|
assert_eq!(chat.pending_steers.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
chat.pending_steers.front().unwrap().user_message.text,
|
||||||
|
"pending steer"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn alt_up_edits_most_recent_queued_message() {
|
async fn alt_up_edits_most_recent_queued_message() {
|
||||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
@@ -4131,6 +4292,107 @@ async fn steer_enter_queues_while_plan_stream_is_active() {
|
|||||||
assert!(drain_insert_history(&mut rx).is_empty());
|
assert!(drain_insert_history(&mut rx).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn submit_user_message_queues_while_compaction_turn_is_running() {
|
||||||
|
let (mut chat, _rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
let thread_id = ThreadId::new();
|
||||||
|
chat.thread_id = Some(thread_id);
|
||||||
|
chat.handle_server_notification(
|
||||||
|
ServerNotification::TurnStarted(TurnStartedNotification {
|
||||||
|
thread_id: thread_id.to_string(),
|
||||||
|
turn: AppServerTurn {
|
||||||
|
id: "turn-1".to_string(),
|
||||||
|
items: Vec::new(),
|
||||||
|
status: AppServerTurnStatus::InProgress,
|
||||||
|
error: None,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
|
chat.submit_user_message(UserMessage::from("queued while compacting"));
|
||||||
|
|
||||||
|
assert_eq!(chat.pending_steers.len(), 1);
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "queued while compacting".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected running-turn compact steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a compact turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Compact,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
assert!(chat.pending_steers.is_empty());
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_message_texts(),
|
||||||
|
vec!["queued while compacting"]
|
||||||
|
);
|
||||||
|
|
||||||
|
chat.handle_server_notification(
|
||||||
|
ServerNotification::TurnCompleted(TurnCompletedNotification {
|
||||||
|
thread_id: thread_id.to_string(),
|
||||||
|
turn: AppServerTurn {
|
||||||
|
id: "turn-1".to_string(),
|
||||||
|
items: Vec::new(),
|
||||||
|
status: AppServerTurnStatus::Completed,
|
||||||
|
error: None,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
|
match next_submit_op(&mut op_rx) {
|
||||||
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "queued while compacting".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected queued compact follow-up Op::UserTurn, got {other:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn slash_compact_eagerly_queues_follow_up_before_turn_start() {
|
||||||
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
|
||||||
|
chat.dispatch_command(SlashCommand::Compact);
|
||||||
|
|
||||||
|
assert!(chat.bottom_pane.is_task_running());
|
||||||
|
match rx.try_recv() {
|
||||||
|
Ok(AppEvent::CodexOp(Op::Compact)) => {}
|
||||||
|
other => panic!("expected compact op to be submitted, got {other:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
chat.bottom_pane.set_composer_text(
|
||||||
|
"queued before compact turn start".to_string(),
|
||||||
|
Vec::new(),
|
||||||
|
Vec::new(),
|
||||||
|
);
|
||||||
|
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||||
|
|
||||||
|
assert!(chat.pending_steers.is_empty());
|
||||||
|
assert_eq!(chat.queued_user_messages.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
chat.queued_user_messages.front().unwrap().text,
|
||||||
|
"queued before compact turn start"
|
||||||
|
);
|
||||||
|
assert_matches!(op_rx.try_recv(), Err(TryRecvError::Empty));
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn steer_enter_uses_pending_steers_while_turn_is_running_without_streaming() {
|
async fn steer_enter_uses_pending_steers_while_turn_is_running_without_streaming() {
|
||||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
@@ -11971,9 +12233,17 @@ async fn chatwidget_tall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn enter_queues_user_messages_while_review_is_running() {
|
async fn enter_submits_steer_while_review_is_running() {
|
||||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
|
||||||
chat.thread_id = Some(ThreadId::new());
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
chat.handle_codex_event(Event {
|
chat.handle_codex_event(Event {
|
||||||
id: "review-1".into(),
|
id: "review-1".into(),
|
||||||
@@ -11985,19 +12255,28 @@ async fn enter_queues_user_messages_while_review_is_running() {
|
|||||||
let _ = drain_insert_history(&mut rx);
|
let _ = drain_insert_history(&mut rx);
|
||||||
|
|
||||||
chat.bottom_pane.set_composer_text(
|
chat.bottom_pane.set_composer_text(
|
||||||
"Queued while /review is running.".to_string(),
|
"Steer submitted while /review was running.".to_string(),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
);
|
);
|
||||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||||
|
|
||||||
assert_eq!(chat.queued_user_messages.len(), 1);
|
assert!(chat.queued_user_messages.is_empty());
|
||||||
|
assert_eq!(chat.pending_steers.len(), 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
chat.queued_user_messages.front().unwrap().text,
|
chat.pending_steers.front().unwrap().user_message.text,
|
||||||
"Queued while /review is running."
|
"Steer submitted while /review was running."
|
||||||
);
|
);
|
||||||
assert!(chat.pending_steers.is_empty());
|
match next_submit_op(&mut op_rx) {
|
||||||
assert_no_submit_op(&mut op_rx);
|
Op::UserTurn { items, .. } => assert_eq!(
|
||||||
|
items,
|
||||||
|
vec![UserInput::Text {
|
||||||
|
text: "Steer submitted while /review was running.".to_string(),
|
||||||
|
text_elements: Vec::new(),
|
||||||
|
}]
|
||||||
|
),
|
||||||
|
other => panic!("expected running-turn steer submit, got {other:?}"),
|
||||||
|
}
|
||||||
assert!(drain_insert_history(&mut rx).is_empty());
|
assert!(drain_insert_history(&mut rx).is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12005,6 +12284,14 @@ async fn enter_queues_user_messages_while_review_is_running() {
|
|||||||
async fn review_queues_user_messages_snapshot() {
|
async fn review_queues_user_messages_snapshot() {
|
||||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
chat.thread_id = Some(ThreadId::new());
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
chat.handle_codex_event(Event {
|
chat.handle_codex_event(Event {
|
||||||
id: "review-1".into(),
|
id: "review-1".into(),
|
||||||
@@ -12015,9 +12302,57 @@ async fn review_queues_user_messages_snapshot() {
|
|||||||
});
|
});
|
||||||
let _ = drain_insert_history(&mut rx);
|
let _ = drain_insert_history(&mut rx);
|
||||||
|
|
||||||
chat.queue_user_message(UserMessage::from(
|
chat.submit_user_message(UserMessage::from(
|
||||||
"Queued while /review is running.".to_string(),
|
"Steer submitted while /review was running.".to_string(),
|
||||||
));
|
));
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a review turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Review,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
let width: u16 = 80;
|
||||||
|
let height: u16 = 18;
|
||||||
|
let backend = VT100Backend::new(width, height);
|
||||||
|
let mut term = crate::custom_terminal::Terminal::with_options(backend).expect("terminal");
|
||||||
|
let desired_height = chat.desired_height(width).min(height);
|
||||||
|
term.set_viewport_area(Rect::new(0, height - desired_height, width, desired_height));
|
||||||
|
term.draw(|f| {
|
||||||
|
chat.render(f.area(), f.buffer_mut());
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
assert_snapshot!(term.backend().vt100().screen().contents());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn compact_queues_user_messages_snapshot() {
|
||||||
|
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||||
|
chat.thread_id = Some(ThreadId::new());
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "turn-start".into(),
|
||||||
|
msg: EventMsg::TurnStarted(TurnStartedEvent {
|
||||||
|
turn_id: "turn-1".to_string(),
|
||||||
|
model_context_window: None,
|
||||||
|
collaboration_mode_kind: ModeKind::Default,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
chat.submit_user_message(UserMessage::from(
|
||||||
|
"Steer submitted while /compact was running.".to_string(),
|
||||||
|
));
|
||||||
|
chat.handle_codex_event(Event {
|
||||||
|
id: "steer-rejected".into(),
|
||||||
|
msg: EventMsg::Error(ErrorEvent {
|
||||||
|
message: "cannot steer a compact turn".to_string(),
|
||||||
|
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||||
|
turn_kind: NonSteerableTurnKind::Compact,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
let width: u16 = 80;
|
let width: u16 = 80;
|
||||||
let height: u16 = 18;
|
let height: u16 = 18;
|
||||||
|
|||||||
Reference in New Issue
Block a user