<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lorry Zhang</title>
    <description>The latest articles on DEV Community by Lorry Zhang (@lorry_zhang_6c8c50ea513c3).</description>
    <link>https://dev.to/lorry_zhang_6c8c50ea513c3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4229547%2Fa8a6951a-e943-4eec-ac4a-44d25e0efbba.png</url>
      <title>DEV Community: Lorry Zhang</title>
      <link>https://dev.to/lorry_zhang_6c8c50ea513c3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lorry_zhang_6c8c50ea513c3"/>
    <language>en</language>
    <item>
      <title>A Checkout Click Is Not a Payment: Investigating with Codex and Event Data</title>
      <dc:creator>Lorry Zhang</dc:creator>
      <pubDate>Sun, 08 Nov 2026 12:40:34 +0000</pubDate>
      <link>https://dev.to/lorry_zhang_6c8c50ea513c3/a-checkout-click-is-not-a-payment-investigating-with-codex-and-event-data-4930</link>
      <guid>https://dev.to/lorry_zhang_6c8c50ea513c3/a-checkout-click-is-not-a-payment-investigating-with-codex-and-event-data-4930</guid>
      <description>&lt;p&gt;Suppose you ask Codex to inspect your checkout code. It finds a failure branch that might swallow an error. Then you ask: "Did the payment at 16:20 on November 5 go through?" Now you need a record of that attempt. The code shows what &lt;em&gt;might&lt;/em&gt; happen after a click; it cannot tell you whether a request was sent or what the provider returned.&lt;/p&gt;

&lt;p&gt;Pasting logs or a CSV into the chat works once in a while. With several engineers handing off the investigation, somebody must keep checking which extract covered which hours, in which time zone, and whether the backend logs were included. A queryable event record gives Codex a more reliable place to start.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a frontend event to a Codex query
&lt;/h2&gt;

&lt;p&gt;Reporting and retrieval take separate paths:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend click --trusted backend reports with write token--&amp;gt; External data store
Codex         --calls an MCP query tool-------&amp;gt; Authorized records
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The frontend passes the click to a trusted business backend, which submits it with a write token. The data service validates and acknowledges the event before asynchronous loading; a scoped read credential in Codex's MCP connection retrieves it later. The connection cannot collect a payment outcome the application never reported. The &lt;a href="https://developers.openai.com/codex/mcp" rel="noopener noreferrer"&gt;Codex MCP documentation&lt;/a&gt; covers the connection itself.&lt;/p&gt;

&lt;p&gt;An existing event platform can serve the same purpose if it exposes properly scoped queries. A separate reporting layer is more useful when small apps and scripts produce scattered events and you do not want to grant an agent arbitrary SQL access to production systems. The next Codex session can query the record again instead of relying on a chat summary.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the click record actually says
&lt;/h2&gt;

&lt;p&gt;The event below is invented; it is not a customer transaction. At 16:20 Singapore time on November 5, 2026, a frontend observes a pay-button click. A trusted business backend submits the event under an active, authorized &lt;code&gt;default_behavior_events&lt;/code&gt; v1 schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"default_behavior_events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"report_source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-05T08:20:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"scene_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"checkout"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"trace_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"trace-example-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"action_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"click"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"button"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"pay"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The business backend holds the write token; the browser never embeds a long-lived credential. The trusted MCP connection environment holds a separate read token. In this example, we use &lt;code&gt;report_source=fe&lt;/code&gt; for a frontend-origin click even though the backend submits it; agree on that convention with whoever collects and reports events. Server-side credentials determine the tenant and project, regardless of client-supplied event fields. A &lt;code&gt;trace_id&lt;/code&gt; can connect frontend and backend records only if the request really carries it through. The click observation alone does not prove a subsequent payment request reached the backend endpoint that handles payment.&lt;/p&gt;

&lt;p&gt;To answer "did the payment succeed?" the services that own later steps must report them: the backend receiving the request, the gateway responding, and the order state changing. A frontend cannot report a gateway outcome it never saw. A provider transaction ID might have to be verified in a separate authorized system; card details and payment secrets do not belong in this behavior event. These observations form a trail only when each reporting service knows what it actually observed.&lt;/p&gt;

&lt;p&gt;Give a checkout attempt its own &lt;code&gt;trace_id&lt;/code&gt;, distinct from a user's session ID. Two quick clicks might produce two frontend events and one backend request. Or the backend might receive two requests while an idempotency rule ensures only one order is charged. Counting clicks answers neither "how many requests reached the backend?" nor "how many charges occurred?" Those questions need evidence from the relevant stages and the final business state.&lt;/p&gt;

&lt;p&gt;The ingestion API responds with HTTP &lt;code&gt;202&lt;/code&gt;, &lt;code&gt;event_id&lt;/code&gt;, and &lt;code&gt;server_time&lt;/code&gt; once the message is acknowledged. The record still needs to load into queryable storage. Suppose the receipt's &lt;code&gt;server_time&lt;/code&gt; is &lt;code&gt;2026-11-05T08:20:02Z&lt;/code&gt;, two seconds after &lt;code&gt;client_time&lt;/code&gt;. Save those returned values and query a server-time window after ingestion. If the clocks differ by hours, check device time and late reporting before interpreting the business event.&lt;/p&gt;

&lt;p&gt;The awkward case is a trusted backend that loses its connection after reporting and never sees the &lt;code&gt;202&lt;/code&gt;. That does not prove the event was rejected. A second send cannot be presumed idempotent, either. Check whether the backend retained a request identifier and whether the service received the event; otherwise mark its status unknown. Event-reporting retries and payment idempotency are separate concerns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query the attempt
&lt;/h2&gt;

&lt;p&gt;With a read-only MCP connection configured, you might ask Codex:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Find events for &lt;code&gt;trace-example-001&lt;/code&gt; from 08:00 to 09:00 UTC on November 5, 2026. Check which fields I can query first. If you only find a frontend click, tell me where to look for the payment result; don't call an empty result a failed payment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Call &lt;code&gt;list_schemas -&amp;gt; describe_schema -&amp;gt; query_schema&lt;/code&gt; to confirm the readable schema and fields before filtering on &lt;code&gt;trace_id&lt;/code&gt;. The query arguments could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"default_behavior_events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"start_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-05T08:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"end_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-05T09:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"filters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"trace_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"trace-example-001"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"limit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check whether the tool call succeeded before interpreting the record count. A tool error needs investigation; an empty result may need a different time window. If only the frontend click appears, Codex can cite its ID and time, then inspect the code paths that should follow. The payment outcome might not have been reported, might still be loading, might be outside this window, or might live elsewhere. Even a backend event with the same &lt;code&gt;trace_id&lt;/code&gt; has to be read for what it actually reports.&lt;/p&gt;

&lt;p&gt;A backend record saying "sent a request to the gateway" still leaves two gaps: the gateway's response and the persisted order state. A callback may arrive after the customer closes the page, so the frontend trail may naturally stop there. An agent should name the missing step and the identifier needed to check it with the owning service. That is more useful than guessing "payment timeout" from a frontend trace.&lt;/p&gt;

&lt;p&gt;For example: "This query found a frontend click at 08:20 UTC, but no payment outcome. Check whether the request reached the backend with this &lt;code&gt;trace_id&lt;/code&gt;, then look for the backend and gateway results." This is an investigation path, not a real payment verdict.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run one test event through the whole path
&lt;/h2&gt;

&lt;p&gt;In a test project, report an event with a known &lt;code&gt;trace_id&lt;/code&gt; and keep the ID and server time from the &lt;code&gt;202&lt;/code&gt; receipt. Wait for the read credential to retrieve it by ID, then confirm another project's read credential gets no match. That small exercise checks authorization, time boundaries, and ingestion delay.&lt;/p&gt;

&lt;p&gt;Protect the connection itself: do not paste read tokens into public frontend code, sample repositories, or ordinary agent prompts. If the available endpoint does not yet offer trustworthy encrypted transport or controlled network access, arrange that before demonstrating the workflow with real data. A query example in an article is not a credential-delivery plan.&lt;/p&gt;

&lt;p&gt;Detail queries have time and result bounds. The current production default is 31 days at most and 100 rows per page; &lt;code&gt;limit&lt;/code&gt; also caps the total requested by a query. The example asks for 20 rows. If exactly 20 return, narrow the time range or increase that total within your policy; if a &lt;code&gt;next_cursor&lt;/code&gt; appears, continue with the same filters. Each page consumes a read call. Finding one event is useful, but it is not a payment-funnel report.&lt;/p&gt;

&lt;p&gt;Project website: &lt;a href="https://d2ggep2t73r4ny.cloudfront.net/" rel="noopener noreferrer"&gt;https://d2ggep2t73r4ny.cloudfront.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Technical and business discussion: &lt;a href="mailto:lorry@antlertec.com"&gt;lorry@antlertec.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>debugging</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>A Job Started. How Would an Agent Know It Finished?</title>
      <dc:creator>Lorry Zhang</dc:creator>
      <pubDate>Sun, 08 Nov 2026 12:39:37 +0000</pubDate>
      <link>https://dev.to/lorry_zhang_6c8c50ea513c3/a-job-started-how-would-an-agent-know-it-finished-52lb</link>
      <guid>https://dev.to/lorry_zhang_6c8c50ea513c3/a-job-started-how-would-an-agent-know-it-finished-52lb</guid>
      <description>&lt;p&gt;Suppose an agent inspects the code of your daily data-quality job. It sees the branch that writes a successful result. In a new session tomorrow you ask, "Did yesterday's batch check finish?" That branch says what the job &lt;em&gt;should&lt;/em&gt; do, not whether yesterday's run ever reached it.&lt;/p&gt;

&lt;p&gt;You could export the logs each time. Or the job could report events to a store the agent can query within its permissions. Those records persist outside the chat and can be checked again next week. This article uses an invented job; none of the events or conversations below are a real incident.&lt;/p&gt;

&lt;p&gt;The point is to retain what the runner reported, not what the agent thought would happen yesterday. A chat summary could have been written before the job even started. Even a fresh summary cannot prove that a particular batch completed. A durable event trail gives the next session something original to check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give reporting and querying separate credentials
&lt;/h2&gt;

&lt;p&gt;In a schema-first event system, the paths look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Controlled job runner --write token--&amp;gt; Schema validation --&amp;gt; Queue acknowledgment --&amp;gt; Async storage
                                                                                 |
Agent --read token--&amp;gt; Schema discovery --&amp;gt; Bounded record query &amp;lt;---------------+
                       |
                       +--&amp;gt; Analyze retrieved evidence --&amp;gt; Person
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The runner submits events with a write token. The service validates schema, ownership, and permissions before asynchronous storage. The agent discovers readable fields and queries details with a separate read token. Server-side credentials determine tenant and project scope; the event body cannot choose them.&lt;/p&gt;

&lt;p&gt;The two paths fail differently. If a connection drops after sending, the writer should reconcile whether the event was accepted before retrying. A query-tool error means "I cannot confirm the result," not "the job never ran."&lt;/p&gt;

&lt;p&gt;They need different health checks, too. On the write side, look for acknowledgments and sends whose outcome is still unknown. On the read side, check whether an acknowledged event becomes visible after an acceptable delay. Both paths can be healthy while the job itself fails. Conversely, a failed job does not mean the event pipeline is broken. Separating those conditions keeps an incident investigation from starting in the wrong system.&lt;/p&gt;

&lt;p&gt;An existing platform can provide the store if it offers suitably scoped queries. A runbook tells the agent how the job is meant to behave; the event tells it what the runner reported. Both are useful during an investigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Record a start and an end
&lt;/h2&gt;

&lt;p&gt;Call the job &lt;code&gt;daily-quality-check&lt;/code&gt;. Its &lt;code&gt;target_id&lt;/code&gt; finds runs over time; a fresh &lt;code&gt;trace_id&lt;/code&gt; for each execution pairs the start and end. At 16:20 Singapore time on November 5, 2026, a controlled backend runner submits this invented &lt;strong&gt;run-started&lt;/strong&gt; event:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"default_behavior_events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"report_source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"be"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-05T16:20:00+08:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"scene_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"agent_workflow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"action_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"run_started"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"workflow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"daily-quality-check"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"trace_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"run-demo-20261105-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"extra_params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"batch_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"batch-demo-42"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;target_id&lt;/code&gt; and &lt;code&gt;trace_id&lt;/code&gt; are exact-match filters. The &lt;code&gt;batch_id&lt;/code&gt; in &lt;code&gt;extra_params&lt;/code&gt; returns with the record, but you cannot filter directly on that nested key. If finding runs by batch becomes a routine question, the platform team must define, activate, and authorize a schema with a queryable batch field. Adding a JSON key alone does not create a new query capability. The server generates &lt;code&gt;event_id&lt;/code&gt; and &lt;code&gt;server_time&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Nor does one &lt;code&gt;trace_id&lt;/code&gt; guarantee exactly one start event. If the runner sends &lt;code&gt;run_started&lt;/code&gt; and loses the response, a retry may create a second event with the same &lt;code&gt;trace_id&lt;/code&gt; and a different server-generated &lt;code&gt;event_id&lt;/code&gt;. Treat them as possible duplicate reports, not automatically as two runs. Conversely, two different &lt;code&gt;trace_id&lt;/code&gt; values for the same job name should be investigated as separate executions before anyone merges their outcomes.&lt;/p&gt;

&lt;p&gt;Agree on what &lt;code&gt;run_completed&lt;/code&gt; means. Did the process reach its last line, or did its output pass a quality check? If both matter, report separate outcomes or keep independent acceptance evidence. Otherwise the agent may mistake a technically completed run for a delivered result.&lt;/p&gt;

&lt;p&gt;When the run ends, the runner reports &lt;code&gt;run_completed&lt;/code&gt; or &lt;code&gt;run_failed&lt;/code&gt; with the same &lt;code&gt;trace_id&lt;/code&gt;. Until then, the answer has a gap; even an end event only records the runner's stated outcome.&lt;/p&gt;

&lt;p&gt;For a long-running job, you might also define progress events or a separate timeout alarm. That helps distinguish "still working" from "runner disappeared." Without such evidence, those two states look identical when the end event is absent. The agent cannot invent a heartbeat. A business acceptance check still needs its own result rather than borrowing the runner's completion status.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens after &lt;code&gt;202&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;HTTP &lt;code&gt;202&lt;/code&gt; means the message queue acknowledged the event. Keep the returned &lt;code&gt;event_id&lt;/code&gt; and &lt;code&gt;server_time&lt;/code&gt; so you can check it after asynchronous loading. An uncertain send followed by a blind retry can produce duplicate records.&lt;/p&gt;

&lt;p&gt;Do not conflate the clocks. &lt;code&gt;client_time&lt;/code&gt; is when the runner says the event occurred; &lt;code&gt;server_time&lt;/code&gt; is when the platform received it and is the time used to filter this query. A clock error or offline reporting can separate them by hours. To answer "what happened yesterday," first locate receipts by server time, then inspect event times; expand the window for late arrivals and watch the result count.&lt;/p&gt;

&lt;p&gt;Suppose a job ends at 23:59 Singapore time but the runner is offline until 00:05 the next day. A query for "events received yesterday" will miss that end event even though the job finished yesterday. The end of a query window is exclusive: an event received exactly at 00:00 belongs to the next window. Showing both the occurrence and receipt times in the analysis makes this discrepancy visible.&lt;/p&gt;

&lt;p&gt;An empty query immediately after &lt;code&gt;202&lt;/code&gt; calls for an ingestion check. Finding the start event still says nothing about completion. Build the query window around server time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to say when the end event is missing
&lt;/h2&gt;

&lt;p&gt;To compare the November 4 and 5 runs the next day, the agent calls &lt;code&gt;list_schemas -&amp;gt; describe_schema -&amp;gt; query_schema&lt;/code&gt;. The server-time window from November 4 at 00:00 through November 6 at 00:00 Singapore time (exclusive) is November 3 at 16:00 through November 5 at 16:00 UTC. The query arguments are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"default_behavior_events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"start_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-03T16:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"end_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-05T16:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"filters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"target_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"daily-quality-check"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"limit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This finds events &lt;strong&gt;received&lt;/strong&gt; during those two local dates. An event that happened on November 5 but was reported on November 6 needs a later server-time query.&lt;/p&gt;

&lt;p&gt;Filtering by &lt;code&gt;target_id=daily-quality-check&lt;/code&gt; finds candidate runs on both days. Once those records are back, pair starts and ends by &lt;code&gt;trace_id&lt;/code&gt;. For a busy job, a second exact-match query on one &lt;code&gt;trace_id&lt;/code&gt; can prevent unrelated runs from filling &lt;code&gt;limit=20&lt;/code&gt;. Knowing a run ID does not relax project authorization or the server-time window.&lt;/p&gt;

&lt;p&gt;Suppose both days' events have loaded and the query is not truncated. November 4 has a &lt;code&gt;run_started&lt;/code&gt; and a matching &lt;code&gt;run_completed&lt;/code&gt;. November 5 only has the &lt;code&gt;run_started&lt;/code&gt; shown above. The agent should give the returned event ID and time, then say: "Within this authorized query, I have not found an end event with the same &lt;code&gt;trace_id&lt;/code&gt;."&lt;/p&gt;

&lt;p&gt;Perhaps the job is still running; perhaps it finished but did not report. Neither possibility justifies calling it failed. If the query hits &lt;code&gt;limit=20&lt;/code&gt;, narrow the time range or raise the total within the policy. If &lt;code&gt;next_cursor&lt;/code&gt; appears, continue with the same filters.&lt;/p&gt;

&lt;p&gt;To investigate the gap, check whether the writer kept a receipt for the end event. If it did, wait for loading and query around that receipt's &lt;code&gt;server_time&lt;/code&gt;; if still absent, check the read token's project, schema authorization, and filters. If there was no receipt, return to the runner logs to see whether it ever reached the reporting step.&lt;/p&gt;

&lt;p&gt;Also distinguish a successful query with zero records from a query-tool error. An expired credential or an unavailable service tells us nothing about job status. A zero-result response only speaks for the time range, schema, and filters actually used. Include that scope and any returned event IDs in the agent's answer so another engineer can reproduce it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How far detail queries can go
&lt;/h2&gt;

&lt;p&gt;New events must match an active, authorized schema; the initial template is for behavior events. Ordinary users cannot create arbitrary tables, and the query tool does not execute free-form SQL. The current production defaults allow at most 31 days per window and 100 rows per page. Longer histories need multiple authorized windows; more records may require cursor pagination. Nested keys in &lt;code&gt;extra_params&lt;/code&gt; cannot be filtered directly, and this is not a task-checkpoint system.&lt;/p&gt;

&lt;p&gt;Report only necessary fields, leaving out secrets and unnecessary personal data. The agent reads the details it needs into its context even with a scoped credential; decide what it should be allowed to see.&lt;/p&gt;

&lt;p&gt;If the business question needs batch-level quality details, consider whether check names, counts, and error categories will suffice, with authorized staff inspecting raw samples in their original system. Putting unreviewed customer rows into &lt;code&gt;extra_params&lt;/code&gt; does not make them directly filterable; it does expose more data to the next agent query. Field design and access policy belong in the same review.&lt;/p&gt;

&lt;p&gt;Test this with a dedicated job: can you retrieve start and end with the same &lt;code&gt;trace_id&lt;/code&gt;? How long between &lt;code&gt;202&lt;/code&gt; and query visibility? If you delay the end event, will the agent say "not yet confirmed"? Keep the test data private and leave customer details out of public examples.&lt;/p&gt;

&lt;p&gt;Sometimes the most useful answer is: "Yesterday's run reported a start, but I cannot find its end status yet." It is incomplete, and more honest than inventing a completion from the code path.&lt;/p&gt;

&lt;p&gt;Project website: &lt;a href="https://d2ggep2t73r4ny.cloudfront.net/" rel="noopener noreferrer"&gt;https://d2ggep2t73r4ny.cloudfront.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Technical and business discussion: &lt;a href="mailto:lorry@antlertec.com"&gt;lorry@antlertec.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>architecture</category>
      <category>devops</category>
    </item>
    <item>
      <title>Two Weeks of Study Notes: What Can an Agent Actually Tell Me?</title>
      <dc:creator>Lorry Zhang</dc:creator>
      <pubDate>Fri, 06 Nov 2026 14:21:05 +0000</pubDate>
      <link>https://dev.to/lorry_zhang_6c8c50ea513c3/two-weeks-of-study-notes-what-can-an-agent-actually-tell-me-46gf</link>
      <guid>https://dev.to/lorry_zhang_6c8c50ea513c3/two-weeks-of-study-notes-what-can-an-agent-actually-tell-me-46gf</guid>
      <description>&lt;p&gt;On Sunday evening, you want to know how much of the past two weeks went into reading about programming and how much into practice. The arithmetic is easy enough. The minutes live in a timer app, the topics in your notes, and the reason one practice session stopped in a task comment.&lt;/p&gt;

&lt;p&gt;You can collect those entries, make a table, and hand it to an agent. Once is manageable; every Sunday it becomes its own task. A controlled script or business backend could submit a small, consistent record when each session ends; you retrieve those records at review time.&lt;/p&gt;

&lt;p&gt;A table pasted today answers today's question. Next week's sessions will not automatically enter that conversation, and a chat summary is not a substitute for the original entries. Someone still needs to connect the recording tool; existing note apps do not suddenly sync themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agree on what a session means
&lt;/h2&gt;

&lt;p&gt;Settle four things first: end time, topic, recorded minutes, and what "completed" or "interrupted" means. Does a break followed by more practice count as one session or two? Decide before collecting months of inconsistent entries. A controlled reporter submits each session to an external store; an authorized agent reads the details later. If a phone app collects the data, do not embed a long-lived write token in the app.&lt;/p&gt;

&lt;p&gt;These seven records are invented, not actual user data. Dates use Singapore time (Asia/Singapore). Minutes are self-reported, not a measure of attention or mastery.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Week&lt;/th&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;Topic&lt;/th&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Recorded outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Week 1&lt;/td&gt;
&lt;td&gt;October 20&lt;/td&gt;
&lt;td&gt;Reading&lt;/td&gt;
&lt;td&gt;30 minutes&lt;/td&gt;
&lt;td&gt;Completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 1&lt;/td&gt;
&lt;td&gt;October 22&lt;/td&gt;
&lt;td&gt;Reading&lt;/td&gt;
&lt;td&gt;25 minutes&lt;/td&gt;
&lt;td&gt;Completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 1&lt;/td&gt;
&lt;td&gt;October 24&lt;/td&gt;
&lt;td&gt;Coding practice&lt;/td&gt;
&lt;td&gt;20 minutes&lt;/td&gt;
&lt;td&gt;Interrupted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 2&lt;/td&gt;
&lt;td&gt;October 27&lt;/td&gt;
&lt;td&gt;Reading&lt;/td&gt;
&lt;td&gt;15 minutes&lt;/td&gt;
&lt;td&gt;Completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 2&lt;/td&gt;
&lt;td&gt;October 29&lt;/td&gt;
&lt;td&gt;Coding practice&lt;/td&gt;
&lt;td&gt;45 minutes&lt;/td&gt;
&lt;td&gt;Completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 2&lt;/td&gt;
&lt;td&gt;October 31&lt;/td&gt;
&lt;td&gt;Coding practice&lt;/td&gt;
&lt;td&gt;40 minutes&lt;/td&gt;
&lt;td&gt;Completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 2&lt;/td&gt;
&lt;td&gt;November 1&lt;/td&gt;
&lt;td&gt;Coding practice&lt;/td&gt;
&lt;td&gt;35 minutes&lt;/td&gt;
&lt;td&gt;Interrupted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The calendar weeks are October 19–25 and October 26–November 1, 2026. In an authorized behavior-event schema, &lt;code&gt;scene_type=learning&lt;/code&gt; and &lt;code&gt;action_type=study_session&lt;/code&gt; could identify these records. Put the topic in a queryable &lt;code&gt;target_id&lt;/code&gt;; store minutes and outcome in &lt;code&gt;extra_params&lt;/code&gt; to read after retrieval. The October 29 session, for example, has &lt;code&gt;target_id=coding&lt;/code&gt;, &lt;code&gt;minutes=45&lt;/code&gt;, and &lt;code&gt;outcome=completed&lt;/code&gt;. An actual report also needs the schema's required source and time fields and a valid write credential.&lt;/p&gt;

&lt;p&gt;Query by &lt;code&gt;scene_type&lt;/code&gt;, &lt;code&gt;action_type&lt;/code&gt;, and time, then read the returned minutes. Nested keys inside &lt;code&gt;extra_params&lt;/code&gt; cannot be used as direct filters, and the service does not automatically aggregate them. Adding up seven complete records is straightforward. Finding every session longer than two hours over six months would require multiple bounded queries and completeness checks, or a separately designed queryable field. Write and read permissions are separate; an accepted report may not be visible until asynchronous loading finishes.&lt;/p&gt;

&lt;p&gt;If your notes are spread across apps, choose a trusted script to translate them, and decide what should never be uploaded. The full text of a personal journal adds little to this particular reading-versus-practice question.&lt;/p&gt;

&lt;p&gt;Give each study session a stable &lt;code&gt;session_id&lt;/code&gt;; here it identifies a study session, not an agent chat. Suppose the phone loses its connection after handing the record to a controlled reporter, which then retries an uncertain submission. Two accepted reports get different server-generated &lt;code&gt;event_id&lt;/code&gt; values even though there was only one 45-minute practice session. When reading, flag records with the same &lt;code&gt;session_id&lt;/code&gt; and check the source before adding them up as 90 minutes. That is a convention for your reporter and analysis, not a promise that ingestion automatically deduplicates retries.&lt;/p&gt;

&lt;h2&gt;
  
  
  What seven records can answer
&lt;/h2&gt;

&lt;p&gt;Suppose all seven have loaded and the query has not hit its limit. You could ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Compare my study records from October 19–25 and October 26–November 1, 2026. Add up minutes by topic and show how much I recorded for reading and practice each week. Mark unrecorded days as unknown.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent can add the seven rows: Week 1 has 75 recorded minutes, 55 of reading and 20 of coding practice. Week 2 has 135, 15 of reading and 120 of practice. That is 60 more recorded minutes and a clear shift in the mix toward practice. Week 1 has two sessions marked completed and one interrupted; Week 2 has three completed and one interrupted. This is arithmetic over retrieved detail records, not a claim of server-side analytics.&lt;/p&gt;

&lt;p&gt;Those totals include the 20- and 35-minute interrupted practice sessions: time spent before the interruption still counts as study time. Ask instead for minutes of &lt;em&gt;completed&lt;/em&gt; coding practice and the answer changes to zero in Week 1 and 85 in Week 2 (45 plus 40). The records are identical; the definition of what to add has changed. That definition is worth stating in the question.&lt;/p&gt;

&lt;p&gt;A narrower follow-up is possible: "Was practice concentrated on the weekend in Week 2?" October 31 and November 1 contain 40 and 35 recorded minutes, respectively. That is 75 of the 120 practice minutes recorded that week. It says where the logged time falls; it does not prove you were more focused on weekends.&lt;/p&gt;

&lt;p&gt;The seven rows do not tell us the exact day the pattern changed or whether learning became more effective. An unrecorded day is unknown, not proof of no study. If a planned break was marked "interrupted" in Week 1 but only phone calls got that label in Week 2, even the interruption counts are not comparable.&lt;/p&gt;

&lt;p&gt;If the query returns five entries instead of seven, find the missing two before drawing a conclusion. The service filters by receipt time; sessions reported late may fall outside the chosen window. Queries have time and result limits, so a longer history needs multiple windows and, where applicable, pages with a completeness check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before tracking anything else
&lt;/h2&gt;

&lt;p&gt;Habits and spending raise similar questions, but renaming a study event does not create a ready-made finance feature. A spending record needs amounts, currencies, categories, and a rule for refunds. Count a transfer as spending and record it again at the receiving account, and a fast total is still wrong. Be particularly selective about reporting financial or health details, who may read them, and how long they remain available. Health records are no substitute for medical judgment.&lt;/p&gt;

&lt;p&gt;Start by noting the topic, minutes, and outcome at the end of each session for two weeks. At review time, check that the records were all retrieved before comparing them. If you still have to reconstruct half your studying from memory, fix the reporting habit or integration before connecting another source.&lt;/p&gt;

&lt;p&gt;Project website: &lt;a href="https://d2ggep2t73r4ny.cloudfront.net/" rel="noopener noreferrer"&gt;https://d2ggep2t73r4ny.cloudfront.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Technical and business discussion: &lt;a href="mailto:lorry@antlertec.com"&gt;lorry@antlertec.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>learning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>When the 2 a.m. Sync Fails, What Should an Agent Look Up?</title>
      <dc:creator>Lorry Zhang</dc:creator>
      <pubDate>Fri, 06 Nov 2026 14:19:52 +0000</pubDate>
      <link>https://dev.to/lorry_zhang_6c8c50ea513c3/when-the-2-am-sync-fails-what-should-an-agent-look-up-2d2j</link>
      <guid>https://dev.to/lorry_zhang_6c8c50ea513c3/when-the-2-am-sync-fails-what-should-an-agent-look-up-2d2j</guid>
      <description>&lt;p&gt;Imagine a sync job that starts at 2 a.m. and has produced nothing by morning. You give its code to an agent and ask, "Where did it get stuck?" It can find the timeout handler and retry settings. To find out how long this run lasted or how many times it retried, it needs a record from the run.&lt;/p&gt;

&lt;p&gt;Logs and dashboards probably contain some of those facts. Manually pulling them into a chat is fine once in a while. A nightly job benefits from a fixed reporting convention, though: by the time something fails, you should not have to hunt through old logs to learn how long the previous run took.&lt;/p&gt;

&lt;p&gt;The job can report a few key events as it runs, and an external system can retain them. When something goes wrong, the agent retrieves records by job ID and time. Those details do enter its analysis context, so decide which fields are safe to report and who can read them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Record the moments that matter
&lt;/h2&gt;

&lt;p&gt;Record the start and end of a run, its outcome, duration, and retry count. The job name &lt;code&gt;nightly-sync&lt;/code&gt; identifies a series of executions; a different &lt;code&gt;trace_id&lt;/code&gt; identifies each execution and connects its events. A scheduler restart should get a new ID. It should not be confused with an internal retry in the same run.&lt;/p&gt;

&lt;p&gt;Define where a duration starts. If the job is scheduled at 02:00, waits a minute for a worker, and finishes at 02:02, you can report two minutes since scheduling or one minute of execution. Both can be useful, but they cannot be compared as if they were the same metric. In this example, &lt;code&gt;duration_ms&lt;/code&gt; runs from actual execution start to the reported outcome and includes time spent waiting between internal retries.&lt;/p&gt;

&lt;p&gt;The path is short:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Job or app --report event--&amp;gt; Validate and store --retrieve on demand--&amp;gt; Agent --analyze--&amp;gt; Person
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An existing event platform may be enough. For small scripts and services scattered across systems, a shared reporting API is easier to govern than giving an agent direct read access to each production database. The agent gets a scoped read credential for the project.&lt;/p&gt;

&lt;p&gt;Keep full logs in their usual place; they may contain secrets, customer details, and irrelevant stack traces. Report the small set of facts the agent will need: job name, run ID, result, and duration. Missing outcome data cannot be reconstructed later from a clever prompt.&lt;/p&gt;

&lt;p&gt;Similarly, define &lt;code&gt;retry_count&lt;/code&gt; as attempts made within this execution. If the scheduler starts a new process after a failure, that is another run, not an additional internal retry of the first one. A batch ID may be worth retaining with the event, but one placed in &lt;code&gt;extra_params&lt;/code&gt; can only be read after retrieval. Frequent lookup by batch needs a planned queryable field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two nights, two outcomes
&lt;/h2&gt;

&lt;p&gt;Both runs below are invented, not a real incident. On failure, &lt;code&gt;nightly-sync&lt;/code&gt; submits an event under an active, authorized behavior-event schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"default_behavior_events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"report_source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"be"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"client_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-11-05T02:02:00+08:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"scene_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"scheduled_job"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"action_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"run_failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"job"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nightly-sync"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target_value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"trace_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"trace-job-demo-002"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"extra_params"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"duration_ms"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;120000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"retry_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the November 5 job starts at 2 a.m. Singapore time and reports failure 120 seconds later, so &lt;code&gt;client_time&lt;/code&gt; is 2:02 a.m. &lt;code&gt;target_id&lt;/code&gt; is queryable. The duration and retry count in &lt;code&gt;extra_params&lt;/code&gt; can be read after retrieving the record, but its nested keys cannot be used as ordinary query filters. The &lt;code&gt;trace_id&lt;/code&gt; can connect this run to other evidence; a comparison with yesterday first requires that both runs use the same job identity and reporting convention.&lt;/p&gt;

&lt;p&gt;The invented November 4 run also starts at 2 a.m. Singapore time. It reports &lt;code&gt;run_completed&lt;/code&gt; at 2:00:45 a.m., with &lt;code&gt;duration_ms=45000&lt;/code&gt; and &lt;code&gt;retry_count=0&lt;/code&gt;. These two reported durations differ by 75 seconds. They do not tell us whether the job has been slowing down all week, or which downstream service caused the timeout.&lt;/p&gt;

&lt;p&gt;Check the job version, input size, and definition of completion before calling this a slowdown. Processing a hundred thousand rows one night and a hundred the night before changes the comparison. The schema has an &lt;code&gt;app_version&lt;/code&gt; field if you need to track a job version. For input size, decide what is safe to report and whether it belongs in an extension attribute or a separately planned queryable field.&lt;/p&gt;

&lt;p&gt;HTTP &lt;code&gt;202&lt;/code&gt; acknowledges receipt by the message pipeline; the event may not yet be queryable. Save each response's event ID and &lt;code&gt;server_time&lt;/code&gt;, then check again after asynchronous loading. Assume both receipts are within November 3 at 16:00 through November 5 at 16:00 UTC, the server-time window corresponding to November 4 and 5 in Singapore. A late report could be received after that window and would need a separate query.&lt;/p&gt;

&lt;p&gt;If the reporting client disconnects before receiving the response, the state is less clear: the runner may have submitted the failure event without seeing the acknowledgment. Reconcile before retrying rather than declaring the platform missed it. Conversely, retrieving a &lt;code&gt;run_failed&lt;/code&gt; event only tells you what the runner reported; it does not prove that every expected output row is absent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compare the runs
&lt;/h2&gt;

&lt;p&gt;An engineer could ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Find &lt;code&gt;nightly-sync&lt;/code&gt; events from November 3, 2026, 16:00 to November 5, 2026, 16:00 UTC. Compare the November 4 and 5 runs in Singapore time. List each run ID, outcome, duration, and retry count, then inspect where the timeout could occur in the code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent uses its read credential to query by server time and &lt;code&gt;target_id&lt;/code&gt;, then compares the records with the code's timeout and retry paths. In Codex, a configured MCP tool can provide that query. The &lt;a href="https://developers.openai.com/codex/mcp" rel="noopener noreferrer"&gt;Codex documentation&lt;/a&gt; covers the connection.&lt;/p&gt;

&lt;p&gt;Assuming both events have loaded and the query has not reached its limit, the answer might be:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The November 5 run reported &lt;code&gt;run_failed&lt;/code&gt; with &lt;code&gt;timeout&lt;/code&gt; after 120 seconds and one internal retry. November 4 reported &lt;code&gt;run_completed&lt;/code&gt; after 45 seconds with no retry. That is a 75-second difference. We still do not know which dependency stalled; check the failed run's logs and downstream calls using its &lt;code&gt;trace_id&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The timeout branch in the code suggests where to look, but it does not prove this run passed through it. If the query is incomplete, the answer needs to say which records it actually saw.&lt;/p&gt;

&lt;p&gt;Use the failed run's &lt;code&gt;trace_id&lt;/code&gt; to find its execution logs. Did the internal retry occur before a connection was established, halfway through reading, or while writing the output? A slow dependency, a timeout threshold set too low, and queue time mistakenly included in execution time could all surface as &lt;code&gt;target_value=timeout&lt;/code&gt;. Timing for the corresponding downstream call is what would let you narrow the cause.&lt;/p&gt;

&lt;p&gt;Check &lt;code&gt;trace_id&lt;/code&gt; before comparing counts. A scheduler restart is a separate execution; mixing its duration and retries with the first run would corrupt the diagnosis. If a query fills its &lt;code&gt;limit&lt;/code&gt;, narrow the window or raise the total within the policy and follow a returned cursor for subsequent pages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the failure paths first
&lt;/h2&gt;

&lt;p&gt;In this example, &lt;code&gt;duration_ms&lt;/code&gt; and &lt;code&gt;retry_count&lt;/code&gt; live in &lt;code&gt;extra_params&lt;/code&gt;. You can inspect them after retrieval but cannot filter directly on those nested keys. A standing question such as "which jobs ran longer than two minutes?" needs a queryable field or another analytics path. Keep reporting and reading credentials separate, and keep secrets and unnecessary personal data out of the event. The current production defaults cap a page at 100 rows and a time window at 31 days. You can query several windows, but that alone does not turn detail records into a trustworthy aggregate trend.&lt;/p&gt;

&lt;p&gt;The meaning of &lt;code&gt;run_completed&lt;/code&gt; matters too. It should mean that this execution finished according to the runner's contract. If the business question is whether the synced data passed a completeness check, report that check separately. The 45-second success record alone cannot establish that every output row was correctly stored the night before.&lt;/p&gt;

&lt;p&gt;Use a dedicated job to report one success and one failure. Save both &lt;code&gt;202&lt;/code&gt; receipts, wait until the records are queryable, and ask the agent to compare them. Then delay one report and see whether it confuses "not visible yet" with "never ran." That small test says more about this workflow than a fluent incident summary.&lt;/p&gt;

&lt;p&gt;Project website: &lt;a href="https://d2ggep2t73r4ny.cloudfront.net/" rel="noopener noreferrer"&gt;https://d2ggep2t73r4ny.cloudfront.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Technical and business discussion: &lt;a href="mailto:lorry@antlertec.com"&gt;lorry@antlertec.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>automation</category>
      <category>debugging</category>
    </item>
  </channel>
</rss>
