-
Notifications
You must be signed in to change notification settings - Fork 22
(MOT-3748) fix(harness): preserve registrations across engine reloads #666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
44a6010
c9cec3b
b8114af
f542b25
18e73e9
94218fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,8 @@ const DEFINE_RETRY_BACKOFF_MS: u64 = 250; | |
| /// Exhaustion is fatal to harness startup: accepting sends without this queue | ||
| /// would acknowledge work that cannot run durably. | ||
| pub async fn ensure_turn_queue(iii: &IIIClient) -> Result<(), String> { | ||
| let payload = turn_queue_definition(); | ||
| let mut payload = turn_queue_definition(); | ||
| let mut restart_redelivery_requested = true; | ||
| let mut last_error = String::new(); | ||
|
|
||
| for attempt in 1..=DEFINE_ATTEMPTS { | ||
|
|
@@ -42,6 +43,16 @@ pub async fn ensure_turn_queue(iii: &IIIClient) -> Result<(), String> { | |
| } | ||
| Err(error) => { | ||
| last_error = error.to_string(); | ||
| if restart_redelivery_requested && is_legacy_queue_schema_error(&last_error) { | ||
| tracing::warn!( | ||
| queue = TURN_QUEUE, | ||
| error = %last_error, | ||
| "queue worker does not support restart redelivery; retrying with the legacy queue schema" | ||
| ); | ||
| payload = legacy_turn_queue_definition(); | ||
| restart_redelivery_requested = false; | ||
| continue; | ||
| } | ||
|
Comment on lines
+46
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Allow the fallback to consume a retry after the primary budget is exhausted. If the unsupported-field error occurs on the final The supplied Also applies to: 132-162 🤖 Prompt for AI Agents |
||
| if attempt < DEFINE_ATTEMPTS { | ||
| tracing::warn!( | ||
| queue = TURN_QUEUE, | ||
|
|
@@ -60,6 +71,10 @@ pub async fn ensure_turn_queue(iii: &IIIClient) -> Result<(), String> { | |
| )) | ||
| } | ||
|
|
||
| fn is_legacy_queue_schema_error(error: &str) -> bool { | ||
| error.contains("unknown field `redeliver_on_engine_restart`") | ||
| } | ||
|
|
||
| fn turn_queue_definition() -> Value { | ||
| json!({ | ||
| "queue": TURN_QUEUE, | ||
|
|
@@ -75,6 +90,20 @@ fn turn_queue_definition() -> Value { | |
| }) | ||
| } | ||
|
|
||
| fn legacy_turn_queue_definition() -> Value { | ||
| json!({ | ||
| "queue": TURN_QUEUE, | ||
| "config": { | ||
| "type": "fifo", | ||
| "message_group_field": "session_id", | ||
| "concurrency": 10, | ||
| "max_retries": 3, | ||
| "backoff_ms": 1_000, | ||
| "poll_interval_ms": 100 | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
@@ -100,4 +129,35 @@ mod tests { | |
| .get("timeout_ms") | ||
| .is_none()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn legacy_turn_queue_definition_omits_restart_redelivery() { | ||
| assert_eq!( | ||
| legacy_turn_queue_definition(), | ||
| json!({ | ||
| "queue": "harness-turn", | ||
| "config": { | ||
| "type": "fifo", | ||
| "message_group_field": "session_id", | ||
| "concurrency": 10, | ||
| "max_retries": 3, | ||
| "backoff_ms": 1_000, | ||
| "poll_interval_ms": 100 | ||
| } | ||
| }) | ||
| ); | ||
| assert!(legacy_turn_queue_definition()["config"] | ||
| .get("redeliver_on_engine_restart") | ||
| .is_none()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn only_the_unsupported_restart_redelivery_field_triggers_fallback() { | ||
| assert!(is_legacy_queue_schema_error( | ||
| "serialization error: unknown field `redeliver_on_engine_restart`" | ||
| )); | ||
| assert!(!is_legacy_queue_schema_error( | ||
| "serialization error: unknown field `message_group_field`" | ||
| )); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Pass only the declared secrets to the reusable workflow.
secrets: inheritexposes every secret available to the release job. The quickstart contract requires onlySLACK_BOT_TOKENandZAI_API_KEY. Pass those names explicitly.Proposed fix
with: channel: ${{ needs.setup.outputs.registry_tag }} - secrets: inherit + secrets: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }}📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.28.0)
[warning] 283-283: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow
(secrets-inherit)
🤖 Prompt for AI Agents
Source: Linters/SAST tools