Skip to content

One Alert Was Hiding Three Failures

S5·E15 ·Rootweaver · Kubernetes · Observability · KnowledgeGraphs

A scheduled pipeline can keep making useful progress and still never record a successful run. That was the next problem behind the operational alerts: the nightly job that turned my architecture documents into searchable graph knowledge kept ending in failure.

I needed the job to finish the work it accepted, preserve completed work when something failed, and produce a completion signal I could trust. The investigation uncovered three different obstacles. Its deadline was shorter than the expected work. Its embedding dependency could stay overloaded beyond its retry window. One code-bearing document then broke a full-text query every time it reached the same path.

The engineer inspects a freed winch in a dark slate-mine gallery, with another jammed mechanism visible beyond the open first barrier.

Removing the first obstruction can reveal the next one. A conceptual illustration of the investigation, not a reconstruction of the infrastructure.

This episode covers 16–17 July 2026. It follows the scorer recovery in Episode 14, using the ingestion handover and retained application, test and GitOps source. I owned direction and review, with agent-assisted investigation and implementation. Runtime observations remain attributed to the historical handover. The worked examples below are new explanations; they do not replay the original cluster or establish a later scheduled recovery that the retained evidence does not show.

The alert was about a missing success record

The job read permitted architecture documents, sent their contents through Graphiti for extraction, and added the resulting knowledge to FalkorDB. An embedding call was one dependency in that process. An embedding is a numerical representation used to compare meaning; it was not the final graph write or a guarantee that the document had been ingested.

The warning was DataPipelineCronJobNeverSucceeded. This was a different condition from the timestamp-gap alert in the previous episode. Its retained expression selected scheduled CronJobs for which the corresponding successful-completion series was absent:

alert-rules.yaml · DataPipelineCronJobNeverSucceeded · GitOps cc5531af · exact historical expression

kube_cronjob_status_last_schedule_time{namespace=~"rootweaver|rw-.*"}
  unless kube_cronjob_status_last_successful_time{namespace=~"rootweaver|rw-.*"}
Explain this code line by line
  • The first metric identifies CronJobs with a recorded scheduling time.
  • unless keeps the left-hand entries that have no matching entry on the right.
  • The second metric supplies recognised successful-completion records.
  • This checks for a missing series. It does not subtract two times or measure the number of failed documents.

The Prometheus authors describe unless as a set operation. The rule also required the condition to persist for two hours before firing. That pending period was separate from the Job’s two-hour execution deadline, even though the two durations happened to match.

This gave the alert a clear meaning and a limited diagnostic role. It said that recognised scheduled success was missing. It did not say whether the cause was insufficient time, a remote dependency, an input-specific defect or a broken ownership relationship. The investigation had to supply that explanation.

A two-hour deadline could not contain the queue

The handover reports nightly DeadlineExceeded failures and identifies activeDeadlineSeconds: 7200. The GitOps history independently shows that field being raised to 21600, from two hours to six. This is the Job’s running-time budget, not the setting that decides how late a missed schedule may start.

The manifest’s explanation recorded a typical pending queue of about 124 records and roughly 148 seconds per episode. At that rate, the simple estimate is:

124 × 148 seconds = 18,352 seconds, or about 5.10 hours.

That arithmetic is a new check of the recorded assumptions. The historical comment rounded the workload to about 5.2 hours. Either estimate was far beyond a two-hour budget. Increasing retries on the same Job would not make a single permitted execution window large enough to contain that work.

cronjob-deadline.yaml · spec.jobTemplate.spec · GitOps a3c242b8 · exact historical field

activeDeadlineSeconds: 21600
Explain this code line by line
  • activeDeadlineSeconds limits how long the Job may remain active.
  • 21600 is measured in seconds: six hours.
  • This field belongs to the Job template. It is distinct from a single HTTP request timeout and from the CronJob’s scheduling grace period.
  • Raising it gives the work more time. It does not make extraction faster or prove that the pending queue will always fit.

The Kubernetes Job documentation explains the deadline and its relationship to retries. The surrounding manifest contained several controls with different jobs:

SettingRetained value after the deadline changeWhat it controlled
Job activeDeadlineSeconds21,600 secondsHow long the Job could remain active
CronJob startingDeadlineSeconds600 secondsHow late a missed scheduled start could be considered
Job backoffLimit1A retry limit, not an execution-time allowance
CronJob concurrencyPolicyForbidOverlap between Jobs created by this CronJob

The handover reports that the deadline change was reconciled and describes a run reaching all 25 batches in roughly 2.3 hours. That was useful progress evidence, but it was not a matched throughput benchmark against the earlier estimate. Queue size, skips and input difficulty can change. The sound conclusion was that the old time budget had been inadequate; a longer budget allowed the investigation to reach failures it had previously obscured.

Progress and Job success were separate states

A failed Job did not mean every record it touched had been lost. The ingestion loop kept a marker for each successfully processed document. The marker included its identifier and content hash, a fingerprint of the exact text.

That mattered for recovery. If a document had already been processed and its content had not changed, the next run could skip it. If its content changed, a matching identifier alone was insufficient. The stored hash also had to match.

ingest_documents.py · DocumentKnowledgeMarkerStore.is_processed · platform c111f0b3 · exact historical excerpt

def is_processed(self, record: DocumentKnowledgeRecord) -> bool:
    entry = self._state.get(record.document_id)
    return bool(entry) and entry.get("content_hash") == record.content_hash
Explain this code line by line
  • The function receives the document record being considered.
  • It looks for a stored entry under that record’s document identifier.
  • A record is considered processed only when an entry exists and its stored content hash matches the current hash.
  • The check is about this version of the document. It is not a claim that every document in the corpus is complete.

The serial ingestion branch wrote a marker only after _add_episode_with_retry returned success. Failed records increased a failure counter. At the command boundary, the process used that counter to decide its exit status:

ingest_documents.py · main · platform c111f0b3 · exact historical exit policy

return 0 if stats["failed"] == 0 else 1
Explain this code line by line
  • stats["failed"] is the count of records that failed during this invocation.
  • Zero failures produces exit code zero, the normal successful process outcome.
  • Any failed record produces exit code one, even if other records completed.
  • Previously written per-record markers are not removed by this return statement.

A small synthetic run makes the distinction easier to see:

Record in this illustrative runDocument resultMarker after the runNext run with unchanged content
A: architecture noteSucceededSavedSkip A
B: code-bearing noteFailedNot savedTry B again
C: design noteSucceededSavedSkip C
Whole invocationOne failed recordA and C retainedExit code 1 for this run

This is an explanatory example, not the original run’s document list. It shows why useful partial progress and an unsuccessful Job can coexist. It also shows why the same bad record can remain in every future pending set while completed records disappear from that set.

The engineer checks secure anchor bolts on a stone maintenance ledge while an unfinished section of the footway remains ahead.

Completed sections remain useful even when the whole route is unfinished. The illustration represents per-record progress, not a claim of transactional graph writes.

The marker file lived on persistent host storage in the historical manifest. That made progress available across ordinary Job runs. The retained implementation wrote JSON directly; it did not establish an atomic transaction spanning the graph write and marker file. A missing or unreadable marker file could cause work to be reconsidered. I would keep those durability limits separate from the narrower benefit the code provided.

An overloaded dependency needed a different retry policy

With enough execution time available, an embedding dependency became the next boundary. The handover reports OpenRouter 429 overload windows outlasting the earlier retry policy. The hardening requirement describes three attempts with short linear waits. Repeating quickly was a poor fit for an upstream service that could remain busy beyond that brief window.

The retained repair used environment-backed defaults: five attempts, a two-second base delay and a thirty-second computed-delay cap. Explicit constructor arguments took precedence over the environment. That made the policy configurable without requiring a separate source change for every operational adjustment.

The implementation also inspected the response body. For example, this synthetic error payload, returned with an HTTP status of 200, would still enter the error path:

{
  "error": {
    "code": 429,
    "message": "engine_overloaded"
  }
}

A successful HTTP envelope did not supply an embedding vector. In the retained client, a body containing error was recorded as a provider error; a normal body was parsed and checked for the expected vector count and dimensions. Ordinary non-429 client-error statuses failed immediately. Those were separate branches, not one blanket rule to retry every failure forever.

The sleep calculation was the important mechanism:

openrouter_client.py · generate_embeddings · platform c111f0b3 · exact historical retry calculation

base_delay = min(
    self._retry_delay_s * 2 ** (attempt - 1),
    self._retry_delay_cap_s,
)
computed_delay = min(
    base_delay * random.uniform(0.9, 1.1),
    self._retry_delay_cap_s,
)
await asyncio.sleep(max(retry_after_s, computed_delay))
Explain this code line by line
  • The first calculation doubles the base delay as the attempt number grows.
  • min applies the configured cap to that exponential delay.
  • A random factor between 0.9 and 1.1 spreads retry timing slightly. This is jitter.
  • The second min prevents that computed jittered delay from exceeding the cap.
  • The final max honours a longer parsed Retry-After value from the response.
  • The cap therefore bounds the computed delay, not every possible sleep after the header is considered.

For the default five attempts, there are four intervening sleeps. Ignoring jitter and a server-supplied delay, they are 2, 4, 8 and 16 seconds, totalling 30 seconds. The thirty-second cap is not reached by that default ladder.

The client parsed a numeric Retry-After header. The HTTP specification edited by Fielding, Nottingham and Reschke also permits a date form; this implementation did not parse that form. If a numeric header requested forty seconds, the final max could choose forty even though the computed-delay cap was thirty. That is a concrete reason not to describe the cap as a universal upper bound.

A budget calculation was not a guaranteed deadline

The historical verification material included an 80-second calculation: five configured ten-second request timeouts plus thirty seconds of nominal waits. Allowing the full positive jitter on those waits changes that illustration to 83 seconds before considering a longer server header.

The retained test asserted the nominal 80-second value, even though its function name still referred to a lower limit. Reading its assertion and the implementation establishes more than trusting its name. It does not establish a hard end-to-end stopwatch bound.

There was also a 120-second embedding timeout at the caller in embedder.py. Both layers used HTTPX. The HTTPX maintainers explain its connect, read, write and pool timeout phases; a configured timeout is not automatically a total wall-clock deadline for every activity in a retry sequence.

That qualification mattered operationally. More patience inside a dependency can help only while the caller is still prepared to wait. A longer provider-requested delay, repeated network activity or additional work can invalidate a simple comparison of default numbers. The six-hour Kubernetes Job limit, the caller’s HTTP settings and the provider client’s retry ladder controlled different parts of the path.

The lesson was to inspect how budgets compose, then observe the actual failure being recovered. A test of a nominal retry schedule does not prove that a remote overload of arbitrary length will be survived.

One document was a repeatable parser failure

Retries addressed temporary overload. They could not make an unsafe query become valid. The handover describes a code-bearing architecture-review document that repeatedly produced a RediSearch syntax error near startswith.

The document included a Python expression containing backticks. Those characters survived the existing sanitisation path and reached the full-text query builder. Re-running the same input therefore returned to the same deterministic parser failure. In ingestion terminology, a poison document is an input that repeatedly fails that processing path; it is not necessarily malicious or worthless content.

The repair added a narrow helper before Graphiti built the FalkorDB full-text query:

graphiti_client.py · _redisearch_safe_query_text · platform c111f0b3 · exact historical helper

_REDISEARCH_UNSAFE_QUERY_CHAR_RE = re.compile(r"[^A-Za-z0-9_ \t\n]")


def _redisearch_safe_query_text(query: str) -> str:
    """Replace characters that RediSearch fulltext syntax can interpret."""
    return _REDISEARCH_UNSAFE_QUERY_CHAR_RE.sub(" ", query)
Explain this code line by line
  • The regular expression identifies characters outside the allowed ASCII letters, digits, underscore and selected whitespace.
  • The helper accepts the query text to be passed into full-text search.
  • sub(" ", query) replaces each disallowed character with a space.
  • The change is applied to the search representation. This helper does not rewrite the stored source document.
  • This is a deliberately restrictive representation, with information loss. It is not a complete general-purpose query parser or Unicode search solution.

For the reported shape of input, a token view illustrates the effect:

Illustrative inputTokens after this helper and whitespace splitting
line.startswith(’```‘)line, startswith
alpha_beta 123alpha_beta, 123
A string made only of stripped punctuationNo tokens

These are new explanatory examples. Python’s regular-expression documentation describes the substitution operation. The important integration point was its placement: the FalkorDB branch called this helper before fulltext_query. The existing empty-query guard could then return an empty result rather than sending meaningless syntax onward. Other graph-provider branches still delegated to their existing implementation.

In a dark rural seed shed, the engineer prepares a sorted working sample while a sealed jar of the original material remains intact.

A constrained working representation can leave the original source intact. It can also discard useful detail; that trade-off needs to remain visible.

The cost of the broad character filter was real. Accented letters and non-Latin text could lose characters too. The patch addressed a bounded historical failure in a specific full-text path. It did not establish equal retrieval quality for every language or prove that every possible query shape was now safe. Nor would another retry budget have fixed the original parser error.

Follow the work through the right boundaries

The mechanism can be read as a sequence of boundaries rather than one generic healthy/unhealthy box. Completed documents advance the marker store; failed documents keep the invocation unsuccessful; a recognised successful scheduled child is what can advance the CronJob’s completion record.

Why a failed Job can retain useful progress

Pending recordCurrent versionProcess recordExtraction and searchSuccessSave content markerFailureKeep record pendingJob exitAny failed record: exit 1
Pending recordCurrent versionProcess recordExtraction and searchSuccessSave content markerFailureKeep record pendingJob exitAny failed record: exit 1
Focused view of pending records; unchanged completed versions are skipped before this path. Moving dots show direction, not recorded traffic. Controller recognition is an additional observation after process completion.

That distinction also prevents a misleading diagnosis of the alert itself. A missing controller success record could accurately describe the Job outcome while hiding the fact that many individual documents had already been processed. It was not necessary to call the alert false to explain that partial progress.

The useful operational questions became specific: did the deadline kill the run? Did an upstream response enter a retryable path? Did the same record fail with the same parser signature? Did its marker advance only after successful processing? Did the controller recognise a completion belonging to this schedule?

What the retained evidence actually closes

The July handover reports the deadline change applied and a verifier passing nine checks for the two application fixes. Those are historical reports. The retained source lets me independently inspect the retry arithmetic, query-helper placement, marker rules and exit policy today. New offline examples exercise those source mechanisms without calling the provider or running ingestion.

The midnight handover still left image publication and pin promotion open. A later GitOps commit on 17 July updated both the ingestion image and the retriever image to 4e22ceb8. That target included the earlier c111f0b3 hardening merge; the three relevant implementation files are unchanged between those revisions. This explains why the deployed-image request need not use the same short revision named in the first handover.

Retained evidenceWhat it establishesWhat it does not establish
Deadline GitOps diffRequested Job budget changed from two to six hoursIndependent replay of the reported cluster state
Application source and testsConcrete retry, filtering, marker and exit mechanismsA live provider or database run succeeding
Handover’s verifier resultA reported historical verification checkpointRecovered complete verifier logs or end-to-end acceptance
Later image-pin commitBoth relevant workloads were configured for the later image revisionIndependent observation of rollout health or the next scheduled completion

I have not recovered the later ordinary scheduled success as a separate observation in this episode’s evidence set. The narrative therefore ends at a documented repair and deployment configuration, with that operational acceptance still distinct. It does not turn a pin change, a source test or a green manual process into proof of the whole nightly path.

What I would carry into the next build

Start with the first boundary the evidence can identify, then repeat the diagnosis after changing it. A longer deadline can reveal a dependency problem. Better retries can reveal a deterministic input problem. The symptom staying similar does not mean the earlier repair had no value.

Keep partial progress and overall success visible at the same time. Per-document markers reduce repeated work, while a nonzero process exit can still honestly report an incomplete invocation. Inspect the persistence and crash assumptions rather than assuming the word checkpoint guarantees them.

Treat retry arithmetic as a model to check. Count attempts and intervening sleeps, include jitter, read server hints and compare caller settings. Test the exact source path you are relying on. For deterministic malformed queries, change the representation or failure policy instead of repeatedly waiting for the same input to improve.

The next records return to the broader problem of work that appeared active without a reliable continuation. After repairing one pipeline, the next question was how to leave enough evidence and a concrete next action for the work around it.

Glossary and primary references

CronJob

The Kubernetes controller that creates Jobs according to a schedule.

Primary reference

Job deadline

The active-time limit for the Job, separate from request timeouts and scheduling grace.

Primary reference

Backoff

Waiting between repeated attempts, often with increasing delays.

Primary reference

Jitter

A variation in retry timing that reduces synchronised repeat requests.

Primary reference

Retry-After

An HTTP response hint for when a later request should be attempted; the standard permits seconds or a date.

Primary reference

Content hash

A fingerprint calculated from the content; this implementation uses it to distinguish document versions.

Primary reference

Request timeout

A time setting applied to network operations; HTTPX distinguishes several phases.

Primary reference

Search representation

The text formed for the search operation. The shown helper changes this representation using substitution, leaving the source document intact.

Primary reference