fix: detect reordered codex title spinners

refs #1281
This commit is contained in:
Ogulcan Celik 2026-07-13 03:46:02 +03:00
parent 5cfe5e5e73
commit 4800ff54f0
4 changed files with 28 additions and 28 deletions

View File

@ -156,7 +156,7 @@ line_regex = ["^exact line$"]
#[test]
fn remote_manifest_loads_between_local_override_and_bundled() {
with_manifest_dirs("remote-source", || {
write_remote_codex(&remote_manifest("2026.06.10.5", "blocked", "remote-ready"));
write_remote_codex(&remote_manifest("9999.01.01.1", "blocked", "remote-ready"));
let explain = explain(Agent::Codex, "remote-ready");
@ -165,10 +165,10 @@ fn remote_manifest_loads_between_local_override_and_bundled() {
explain.source,
Some(ManifestSource::Remote { .. })
));
assert_eq!(explain.manifest_version.as_deref(), Some("2026.06.10.5"));
assert_eq!(explain.manifest_version.as_deref(), Some("9999.01.01.1"));
assert_eq!(
explain.cached_remote_version.as_deref(),
Some("2026.06.10.5")
Some("9999.01.01.1")
);
});
}
@ -176,7 +176,7 @@ fn remote_manifest_loads_between_local_override_and_bundled() {
#[test]
fn fallback_explain_preserves_active_manifest_version() {
with_manifest_dirs("fallback-version", || {
write_remote_codex(&remote_manifest("2026.06.10.5", "blocked", "remote-ready"));
write_remote_codex(&remote_manifest("9999.01.01.1", "blocked", "remote-ready"));
let explain = explain(Agent::Codex, "ordinary prompt text");
@ -185,7 +185,7 @@ fn fallback_explain_preserves_active_manifest_version() {
explain.fallback_reason.as_deref(),
Some(DEFAULT_KNOWN_AGENT_IDLE_FALLBACK)
);
assert_eq!(explain.manifest_version.as_deref(), Some("2026.06.10.5"));
assert_eq!(explain.manifest_version.as_deref(), Some("9999.01.01.1"));
assert!(matches!(
explain.source,
Some(ManifestSource::Remote { .. })
@ -216,7 +216,7 @@ fn older_cached_remote_manifest_does_not_shadow_newer_bundled_manifest() {
#[test]
fn local_override_shadows_cached_remote_manifest() {
with_manifest_dirs("local-shadows-remote", || {
write_remote_codex(&remote_manifest("2026.06.10.5", "blocked", "remote-ready"));
write_remote_codex(&remote_manifest("9999.01.01.1", "blocked", "remote-ready"));
write_local_codex(&local_manifest("idle", "local-ready"));
let explain = explain(Agent::Codex, "local-ready");
@ -226,7 +226,7 @@ fn local_override_shadows_cached_remote_manifest() {
assert!(explain.local_override_shadowing_remote);
assert_eq!(
explain.cached_remote_version.as_deref(),
Some("2026.06.10.5")
Some("9999.01.01.1")
);
});
}
@ -234,7 +234,7 @@ fn local_override_shadows_cached_remote_manifest() {
#[test]
fn invalid_local_override_falls_back_to_cached_remote_manifest() {
with_manifest_dirs("invalid-local-remote-fallback", || {
write_remote_codex(&remote_manifest("2026.06.10.5", "blocked", "remote-ready"));
write_remote_codex(&remote_manifest("9999.01.01.1", "blocked", "remote-ready"));
write_local_codex("id = ");
let explain = explain(Agent::Codex, "remote-ready");
@ -251,7 +251,7 @@ fn invalid_local_override_falls_back_to_cached_remote_manifest() {
#[test]
fn detection_uses_cached_manifest_until_explicit_reload() {
with_manifest_dirs("cache-boundary", || {
write_remote_codex(&remote_manifest("2026.06.10.5", "blocked", "cached-ready"));
write_remote_codex(&remote_manifest("9999.01.01.1", "blocked", "cached-ready"));
let cached = explain(Agent::Codex, "cached-ready");
assert_eq!(cached.state, AgentState::Blocked);
@ -261,7 +261,7 @@ fn detection_uses_cached_manifest_until_explicit_reload() {
Some("test")
);
write_remote_codex_without_reload(&remote_manifest("2026.06.10.6", "working", "new-ready"));
write_remote_codex_without_reload(&remote_manifest("9999.01.01.2", "working", "new-ready"));
let unchanged = explain(Agent::Codex, "new-ready");
assert_eq!(unchanged.state, AgentState::Idle);
@ -271,7 +271,7 @@ fn detection_uses_cached_manifest_until_explicit_reload() {
);
assert_eq!(
unchanged.cached_remote_version.as_deref(),
Some("2026.06.10.5")
Some("9999.01.01.1")
);
reload_manifests();
@ -280,7 +280,7 @@ fn detection_uses_cached_manifest_until_explicit_reload() {
assert_eq!(reloaded.state, AgentState::Working);
assert_eq!(
reloaded.cached_remote_version.as_deref(),
Some("2026.06.10.6")
Some("9999.01.01.2")
);
assert_eq!(
reloaded.matched_rule.as_ref().map(|rule| rule.id.as_str()),

View File

@ -614,7 +614,7 @@ contains = ["{contains}"]
#[test]
fn process_agent_manifest_commits_newer_manifest_atomically() {
with_state_dir("commit-newer", || {
let content = remote_manifest("2026.06.10.5", "ready");
let content = remote_manifest("9999.01.01.1", "ready");
let commit = process_agent_manifest(Agent::Codex, &content, 1)
.unwrap()
.unwrap();
@ -622,7 +622,7 @@ contains = ["{contains}"]
assert_eq!(commit.agent, Agent::Codex);
assert_eq!(
commit.version,
ManifestVersion::parse("2026.06.10.5").unwrap()
ManifestVersion::parse("9999.01.01.1").unwrap()
);
assert_eq!(
fs::read_to_string(remote_manifest_path(Agent::Codex)).unwrap(),
@ -652,7 +652,7 @@ path = "codex.toml"
.unwrap();
fs::write(
web_dir.join("codex.toml"),
remote_manifest("2026.06.10.5", "auto-update-ready"),
remote_manifest("9999.01.01.1", "auto-update-ready"),
)
.unwrap();
std::env::set_var(
@ -693,10 +693,10 @@ path = "codex.toml"
#[test]
fn process_agent_manifest_rejects_downgrade_and_keeps_cached_manifest() {
with_state_dir("reject-downgrade", || {
let current = remote_manifest("2026.06.10.5", "current");
let current = remote_manifest("9999.01.01.1", "current");
process_agent_manifest(Agent::Codex, &current, 1).unwrap();
let older = remote_manifest("2026.06.10.4", "older");
let older = remote_manifest("9999.01.01.0", "older");
assert!(process_agent_manifest(Agent::Codex, &older, 2).is_err());
assert_eq!(
fs::read_to_string(remote_manifest_path(Agent::Codex)).unwrap(),
@ -708,10 +708,10 @@ path = "codex.toml"
#[test]
fn process_agent_manifest_rejects_equal_version_content_change() {
with_state_dir("reject-equal-change", || {
let current = remote_manifest("2026.06.10.5", "current");
let current = remote_manifest("9999.01.01.1", "current");
process_agent_manifest(Agent::Codex, &current, 1).unwrap();
let changed = remote_manifest("2026.06.10.5", "changed");
let changed = remote_manifest("9999.01.01.1", "changed");
assert!(process_agent_manifest(Agent::Codex, &changed, 2).is_err());
assert_eq!(
fs::read_to_string(remote_manifest_path(Agent::Codex)).unwrap(),
@ -723,7 +723,7 @@ path = "codex.toml"
#[test]
fn process_agent_manifest_skips_same_version_same_content() {
with_state_dir("skip-same", || {
let current = remote_manifest("2026.06.10.5", "current");
let current = remote_manifest("9999.01.01.1", "current");
process_agent_manifest(Agent::Codex, &current, 1).unwrap();
let result = process_agent_manifest(Agent::Codex, &current, 2).unwrap();

View File

@ -1,7 +1,7 @@
id = "codex"
version = "2026.06.10.3"
version = "2026.07.13.1"
min_engine_version = 2
updated_at = "2026-06-10T00:00:00Z"
updated_at = "2026-07-13T00:00:00Z"
[[rules]]
id = "osc_title_blocked"
@ -17,7 +17,7 @@ state = "working"
priority = 1050
region = "osc_title"
visible_working = true
regex = ['^[\x{2800}-\x{28FF}] ']
regex = ['(?:^| )[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏](?: |$)']
[[rules]]
id = "transcript_viewer"
@ -64,6 +64,6 @@ region = "osc_title"
visible_idle = true
regex = ['\S']
not = [
{ regex = ['^[\x{2800}-\x{28FF}]'] },
{ regex = ['(?:^| )[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏](?: |$)'] },
{ contains = ["Action Required"] },
]

View File

@ -1,7 +1,7 @@
id = "codex"
version = "2026.06.10.3"
version = "2026.07.13.1"
min_engine_version = 2
updated_at = "2026-06-10T00:00:00Z"
updated_at = "2026-07-13T00:00:00Z"
[[rules]]
id = "osc_title_blocked"
@ -17,7 +17,7 @@ state = "working"
priority = 1050
region = "osc_title"
visible_working = true
regex = ['^[\x{2800}-\x{28FF}] ']
regex = ['(?:^| )[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏](?: |$)']
[[rules]]
id = "transcript_viewer"
@ -64,6 +64,6 @@ region = "osc_title"
visible_idle = true
regex = ['\S']
not = [
{ regex = ['^[\x{2800}-\x{28FF}]'] },
{ regex = ['(?:^| )[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏](?: |$)'] },
{ contains = ["Action Required"] },
]