Repository navigation
Add node_clock_drift Problem - #894
Conversation
|
Quick note: I'll run a few more agent runs for further testing purposes on different models if this solution approach is okay, for now I've only tested on gpt 4o with Stratus. I'd appreciate any feedback or any type of suggestions for the code, for both the mitigation oracle as well as the injection |
Saadmrp1038
left a comment
There was a problem hiding this comment.
@haani-maybe Thanks for the effort!
I ran and tested the problem end-to-end on a 3-node CloudLab cluster. I found some issues. I left inline comments below with details. Please ping me when you've addressed them.
|
@Saadmrp1038 hii, updated! sorry for the delay the changed code is all the fixes you mentioned (elaborated in the replies to your code review comments) + one tiny thing more, i added a guard to ensure the node we're injecting on is one of the worker nodes (not control node) although once again the control node IS tainted within standard setup so this wouldn't be a problem, but just incase someone else is running the problem and there's an issue in setup due to which the taint isn't present or misconfigured, the guard might help clarify please let me know if the fixes are fine and if there's anything else to add/edit :) |
Saadmrp1038
left a comment
There was a problem hiding this comment.
@haani-maybe Sorry for the delayed review.
I tested the fault thoroughly and did not find any major bugs. Only found some minor things. Can you please address them. Meanwhile I will do some agent runs.
@Saadmrp1038 No worries! I added in all the required changes, let me know if there's anything else |
Saadmrp1038
left a comment
There was a problem hiding this comment.
@haani-maybe Working great now!
I did 5 agent runs on this (claudecode+sonnet-5). 4 times the agent failed both diagnosis and mitigation. The only time it succeeded was when I added a hint ("Check node clock") in the prompt. Without the hint, agents get stuck investigating the sidecar's cert expiry or startup restarts and never make the leap to checking the node's system clock.
So, seems like it's quite a hard problem which is exactly what we want for the benchmark. Also, thanks for taking the time. It took quite a while for me to review this PR.
Congrats on the first PR merged here 🎉
|
WoW This is incredible persistence! |
No worries at all! Glad I could start contributing here :) |
|
@haani-maybe I'm not sure if you are already in the Slack or are here for the UIUC+ program. If so, let me know so I can add you into the channels. |
@tianyin I joined the Slack (reu-2026-general and benchmark channel) when I got the evaluation task email for the UIUC+ program, are there any other channels I have to join for the program? |
|
Can you DM me on the Slack? I can't find you... (and I'm guessing you don't want to reveal your name/ID on GitHub) |
* adding clock drift problem * fixing race condition causing sidecar log delay * fixing recover_fault to reverse time sync removal applied, improve cleanup * global cleanup added + fixed restoration for node_clock_drift problem * fixing mitigation oracle to ensure correct node checked * adding problem to non emulated cluster problems list * extending wait * indentation error fix * fixing time restoration in global cleanup * adding in check to make sure it picks worker node * adding another control plane filter, fixing clock step-back in global recovery * increase sidecar rollout timeout, make podnames/labels generic, idempotancy check * formatting fixes * format fix * fix * fix ruff check/format issues --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
* Updated default mitigation oracle * Stop timeout for 0 replicas * TBC in CloudLab * Pushing all attempts at the problem * Enable idempotence * Add mutating_webhook_resource_limits problem (#847) * Add mutating_webhook_resource_limits problem * Add mutating_webhook_resource_limits to Problem List * mutating_webhook_resource_limits problem docstring fix Removed incorrect information about mitigation options. * Additions to mutating_webhook_limits_resource_limits problem - Memory limit/request patching before activating the webhook - Decoy pods for increased complexity * More additions to mutating_webhook problem - Make decoys realisticly named - Similar minor changes --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Derive the default problem namespace from the application (#876) * add the the probem redundency * base. * the fixed and dynamic app name are fixed. hte namespace are also fixed. * unessessry formating is reverted. * unessessry formating is reverted. * formating correction. * formating correction. * formating correction. * add fault injection decorator markers to test_problem_bsae.py --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Confluent kafka attempt * Custom image attempt * Threaded producer and added consumer * Syntax error * Added some imports * fix edge cases * run ruff check adn format * New OOM attempt * Force crash on OOM * Add file_descriptor_exhaustion problem (#832) * add file_descriptor_exhaustion problem * Modify fault injection and recovery methods * Fix fault recovery * Change fault injection method Add fault injection by flooding connections * Update fault injection method and add custom oracle --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Finalizer deadlock controller clean (#873) * finalizzer code is reaoslve dadlock benchmark. * yaml file corrected. * reverting hte comments back to their place. * read only rbac * controller log is generalized and avoiding any sregym related name exposing. * applied ruff linter formatter accordingly. * replace metadata naming and includding all the oprations on mitigation side. --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Add: secret_rotation_stale_env_credentials_astronomy_shop problem (#851) * Add secret rotation stale env credentials problem * Simplify secret rotation mitigation oracle checks * Require rotated PostgreSQL in oracle * Fix stale DB credential rotation shortcuts - Remove old password from postgresql-init ConfigMap - Keep PostgreSQL password rotation durable after pod restart - Reject mitigations that revert otelu to the old password - Remove old password leaks from unrelated pods * Fix fault recovery to satisfy the oracle * Fix problem registry import ordering --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Add cumulative_admission_webhook_timeout_hotel_reservation problem (#886) * Add cumulative_admission_webhook_timeout_hotel_reservation problem * Pin webhook backends to worker nodes via nodeAffinity * Make webhook backends realistic admission services Replace the dummy webhook backends with HTTPS admission servers that terminate TLS using Secret-mounted certificates, validate AdmissionReview requests, and return proper admission responses. Certificates are signed by the same CA referenced in each webhook's `caBundle`, with SANs covering the backend Service DNS names. The admission logic enforces a trusted image registry allowlist and a per-container CPU limit. All Hotel Reservation workloads satisfy these policies, so the webhooks remain transparent during normal operation and recovery. Also: * Vary webhook `timeoutSeconds` (12, 8, 11, 9) to make the cumulative timeout less obvious. * Rename the CA CN from `sregym-webhook-ca` to `compliance-webhook-ca`. * Remove a duplicate `rule.from_` check in the oracle. * Fix create-or-replace handling for webhooks, NetworkPolicies, Deployments, and Services so re-injection updates existing resources instead of failing or silently skipping changes. * Model the fault as a missing apiserver NetworkPolicy allow * Model the fault as a missing apiserver allow with a near-miss policy --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Add psa_restricted_blocks_recreation problem (#891) Labelling a namespace pod-security.kubernetes.io/enforce=restricted leaves running pods untouched but makes the apiserver reject recreated pods that run as root / set no seccomp profile, so a deployment silently goes under-replicated. Unlike the existing webhook problems, the policy is enforced by the apiserver via a namespace label, not a webhook config. * Add copilot cli agent (#893) * add copilot cli agent * remove -s flag * Fix MCP retry error handling and CRLF parsing in CI (#896) * fix(mcp): broaden MCP retry exceptions and return error instead of raising * fix(ci): strip CRLF from PR description before parsing problem ID * Fix kind cluster detection (#897) * Fix custom kind cluster detection * Handle failed kind detection output * fix edge cases * run ruff check adn format * Shell state persistence (#903) * Include shell persistence * Include shell persistence * Isolate problem IDs from agent runtime artifacts * update SREGym-applications (18620ed) (#910) * Add Calico route-reflector label drift problem (#828) * Add Calico route-reflector label drift problem * Address Calico route-reflector review comments * Harden Calico cleanup ownership tracking * Fix Codex agent install verification * Tighten Codex platform package detection * Restore kubelet eviction reset cleanup * Neutralize Calico ownership metadata --------- Co-authored-by: Munim Thahmid <[email protected]> Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Fail alert oracle on Prometheus query errors (#912) * Decouple failure configmaps from mongo pods in `hotel-reservation` (#899) * decouple failure configmaps from mongo pods * remove empty failure configmaps creation * Support local LLM endpoints for Stratus and OpenCode (#917) * Support local LLM endpoints for Stratus * Prefer env vars for local LLM endpoints * Support local LLM endpoints for OpenCode * Route local endpoints into agent containers * Normalize OpenCode local judge models --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Preflight check the judge model (#924) * Add support for uniform agent trajectory (ATIF format) (#918) * add support for ATIF trajectory conversion and normalization, add claudecode adapter * fix: make _finish_problem idempotent * isolate .codex mount in container runner * better temp dir cleanup * add codex adapter * add opencode adapter * add copilot adapter * add stratus adapter * fix antropic caching for stratus * add gemini adapter * store normalized ATIF trajectories in SQLite indexed by problem type * edge tests * bump litellm, tikoken * update docker lib versions * Add node_clock_drift Problem (#894) * adding clock drift problem * fixing race condition causing sidecar log delay * fixing recover_fault to reverse time sync removal applied, improve cleanup * global cleanup added + fixed restoration for node_clock_drift problem * fixing mitigation oracle to ensure correct node checked * adding problem to non emulated cluster problems list * extending wait * indentation error fix * fixing time restoration in global cleanup * adding in check to make sure it picks worker node * adding another control plane filter, fixing clock step-back in global recovery * increase sidecar rollout timeout, make podnames/labels generic, idempotancy check * formatting fixes * format fix * fix * fix ruff check/format issues --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> * Minimum viable python version * Changed diagnosis oracle * Cleaned up fault recovery * Edit tasklist.yml * Removed old Java artifacts * Updated mitigation oracle to be more robust * Added polling * Fail Kafka producer leak injection on timeout --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]> Co-authored-by: Kerem Akcalioglu <[email protected]> Co-authored-by: ermias mulugeta <[email protected]> Co-authored-by: Tejas Shukla <[email protected]> Co-authored-by: Petr Myagkov <[email protected]> Co-authored-by: Omar Faruqe Riyad <[email protected]> Co-authored-by: Mohammad Tamimul Ehsan <[email protected]> Co-authored-by: Munim Thahmid <[email protected]> Co-authored-by: Om Kumar <[email protected]> Co-authored-by: Munim Thahmid <[email protected]> Co-authored-by: Tanzim Hossain Romel <[email protected]> Co-authored-by: haani-maybe <[email protected]>
Node Clock Drift Causing TLS Handshake Failures on Hotel Reservation
This PR adds a new SREGym problem,
node_clock_drift_hotel_reservation, as part of my evaluation task for UIUC++ SRSE.It models a worker node's system clock drifting significantly forward after its time-sync service is disabled. All pods on that node fail outbound TLS connections with
certificate has expired or is not yet valid, even though the certificate itself is completely healthy. The interesting part for an agent is thatkubectl get podslooks completely normal (Running/Ready), and the certificate, inspected on its own, is valid; the broken state only becomes visible once the agent connects the node's clock to the TLS validation failures.Related RFC: #826
/validate-problem node_clock_drift_hotel_reservation1. Real-world failure story
TLS validation checks a certificate's
notBefore/notAfterwindow against the local system clock, not against any external source of truth. If a node's clock is wrong, even a perfectly valid certificate appears expired or not-yet-valid from that node's perspective.This pattern recurs across unrelated stacks once time-sync stops running:
kubernetes/kubernetes#76714(kubelet TLS failures from clock skew),hashicorp/vault#11150(Vault cert renewal failing the same way), and a D2iQ support article documenting an etcd cluster rejecting connections with the identical x509 error whilekubectl get podsreported a fully healthy cluster. The Cloudflare leap-second postmortem was additional inspiration for how small, time-sync-driven clock steps can cascade into TLS failures cluster-wide.References:
kubernetes/kubernetes#76714: https://github.com/PKI creation using now.UTC breaks after system clock drift corrections kubernetes/kubernetes#76714hashicorp/vault#11150: https://github.com/raft-based cluster unavailable after active node suffered clock drift hashicorp/vault#111502. How the failure is simulated on SREGym
The problem targets the Hotel Reservation app in the
hotel-reservationnamespace, specifically thefrontenddeployment and whichever worker node it's scheduled on.hotel_reservationdoesn't have a native TLS surface (services talk to each other over plain HTTP, no ingress controller deployed), so fault injection first builds a minimal one to break:kubernetes.io/tlsSecret (hotel-frontend-tls).hotel-frontend-ca), mounted into a sidecar as the CA bundle.frontenddeployment to add atls-health-checksidecar that runsopenssl verifyagainst the mounted cert every 30 seconds — simulating a service performing routine outbound TLS validation. This is the only way to surface a TLS-shaped log signal, since the app itself has no real TLS surface to break.apt-get install opensslruns once at sidecar startup, before the clock is touched, so it isn't blocked by the drift that follows.Running, all containers ready, sidecar present) before selecting a target node.hostPID/hostNetwork/hostIPC) that usesnsenterto dynamically discover whichever time-sync service is currently active (queriessystemctl list-units --state=runningfor any unit matchingntp|chrony|timesync), stops and masks it, then advances the system clock 30 days forward viadate -s.The injector pod stays alive for the duration of the fault so the clock change persists. Recovery deletes all clock-drift injector pods; it does not automatically restore the time-sync service or roll back the clock, since reversing the fault yourself isn't a valid mitigation strategy.
Bugs found and fixed during testing
Rollout race condition. The deployment patch that adds the sidecar triggers a rolling update. During testing, the old frontend pod (no sidecar) could still be
Runningon its original node at the exact moment node selection ran, while the new pod (with sidecar) was being scheduled to a different node, causing the clock drift to target a node the sidecar never ran on. Fixed by adding_wait_for_sidecar_rollout(), which polls until a frontend pod isRunningwith the sidecar container present and ready, and tightening node selection to only match pods that actually have thetls-health-checkcontainer.Hardcoded time-sync service name. The original injector tried to mask
systemd-timesyncd,chrony, andntpdby fixed name. On the actual CloudLab test cluster, none of those three matched; the real service was running as legacyntpdunder the systemd unit namentp.service(no "d"). This silently failed to disable time-sync at all, sincesystemctl stop ntpddoesn't match a unit literally namedntp. Fixed by queryingsystemctl list-unitsfor any currently running service matchingntp|chrony|timesyncand acting on whatever is actually found, rather than guessing names. This makes the fault portable across environments without needing to maintain an exhaustive daemon name list.3. Problem runtime behavior and mitigation oracle
After injection, pod health looks normal:
frontendshows2/2 Running, no restarts. The diagnostic signal isn't in pod status — it's in the sidecar's behavior and the node's own clock:Expected output (recurring every 30s once drift hits):
Cross-checking the node directly confirms the root cause:
datereports a timestamp ~30 days ahead of the rest of the cluster. The second command reveals which time-sync service is actually masked; on the CloudLab test cluster this wasntp.service; the specific service name is environment-dependent, which is why the oracle (below) doesn't check for any specific daemon by name.A correct diagnosis identifies the actual cause: the certificate is healthy, the node's clock is wrong, and that skew is what makes TLS validation fail.
The canonical mitigation, from a privileged pod on the affected node (substituting whatever service name was found above
ntpas an example):Restarting the frontend pod alone should not pass as the node's clock is still skewed, so a new pod scheduled on the same node would immediately hit the same TLS failure once the sidecar runs again.
Oracle behavior
The default pod-health oracle can't grade this either, since pods stay
Running/Readythroughout, so this PR addsNodeClockDriftMitigationOracle.It passes only when:
Running/Succeededphase, or shows awaiting/terminatedcontainer state referencingcertificateortls.4. Agent behavior and validation
Manual testing (
kubectl/cli.py): confirmed the fault injects correctly (clock confirmed skewed viakubectl debug node, x509 errors confirmed appearing in sidecar logs), and the oracle correctly returnsFalsewhile the clock remains skewed andTrueonce the time-sync service is unmasked, restarted, and the clock resyncs.Stratus, three runs (judge matching model):
gpt-4o-miniwas expected to underperform; testing withgpt-4owas included as a stronger baseline but produced similarly unsuccessful diagnoses, plan to test against a more capable model as well if this approach for the problem is okay.In all runs the agent noticed several pods had nonzero restart counts and investigated logs, events, the Jaeger dependency graph, and Prometheus CPU/memory metrics (all of which were clean) and never inspected the
frontendpod specifically (despite it being the only pod with 2/2 containers instead of 1/1), nor checked node clocks, time-sync status or any time related detail on any node. This matches the intended difficulty: the certificate itself is valid, so log-level and metric-level investigation alone doesn't surface the fault, and the agent has to connect node clock state to the TLS symptom.