Cosmin Pop
All posts

`*/45` is not every 45 minutes: a week of agent logs, read back

A cron job meant to refresh auth tokens every 45 minutes fired 379 times in eight days and found the QA token already expired on 141 of them, because */45 fires at :00 and :45. Reading those logs back produced five rulings, and two of my answers went against the proposed fix.

14 min read Testing series, part 66 Updated 20 November 2026

A QA automation engineer's notes on reading eight days of agentic workflow logs end to end, and the five rulings that came out of it.

For eight days, a scheduled job that was supposed to keep my test suite's auth tokens fresh "every 45 minutes" fired 379 times. On 141 of those fires, the first thing it logged was that the token for the QA environment had already expired. Only one chat transcript recorded it, so nobody saw it. The bug was one cron expression, */45. I found it only because I read eight days of my own agentic workflow's logs end to end, as if someone else had written them. That retrospective produced five rulings, and the cron fix was the cheapest of them.

The retrospective

My setup is one person plus many agent sessions. An agentic coding CLI runs several sessions at once on a shared container, and an orchestrator fans work out to subagents. A daily "morning" job retests the tickets that the issue tracker says changed overnight. One long-running session had a single job: refresh auth tokens on a timer. Over the eight days, the transcripts added up to 46 sessions and 155 MB of text.

I pointed eleven read-only agent lanes at that pile. Eight read the transcripts, and the other three read the journal, the git history (195 commits) and the cost telemetry ($511 over the five days it covered). Every finding had to carry a session prefix and a timestamp, so I could open the transcript and check it myself.

The test work had gone well, with two full runs and 59 new specs. The friction was in the wrapper I had built around it. Guard hooks blocked their own documented remedies (54 blocks, more than half of them false positives). Rulings I gave in one session never reached the others. And the auth loop had a cadence bug.

The fixes landed as one commit on the evening of the retrospective. Five of them changed or touched a decision I had made earlier. I did not want those to ride in silently, so I had each one put back to me as a question. Two of my answers went against the fix.

Fix one: */45 fires at :00 and :45

In the minute field, */45 does not mean "every 45 minutes". It means "every minute of the hour that is divisible by 45", which is minute 0 and minute 45, and the count restarts each hour. So the gaps alternate: 45 minutes, then 15.

*/45 * * * *    # fires at :00 and :45, gaps 45, 15, 45, 15
*/30 * * * *    # fires at :00 and :30, gaps 30, 30, 30, 30

Any step that does not divide 60 has this problem. My scheduler added an offset, so the fires landed at :09 and :48, but the shape was the same: one short gap and one long gap every hour.

Tokens live 60 minutes. The refresher minted only when a token had under 30 minutes left. Test runs refuse to start under 30 minutes, because a run needs that headroom so the token does not die mid-run. Those two equal numbers were a bug of their own. A token with 30.5 minutes left passed the refresher's "still fresh, skip" check, then failed the run gate a minute later. That pattern sat behind failures in at least three sessions, and one verifier agent "fixed" it by lowering the run gate instead of refreshing.

The uneven schedule on top of those rules gives the 141. The :09 fire minted only 7 times out of 94. The :48 fire came at the end of the long gap and met an already-expired QA token. Any QA run started just before it could hit a 401.

The proposed fix was every 30 minutes, with the mint threshold raised to 45. At a 30-minute interval, a token minted at one fire has 30 minutes left at the next. That is under 45, so every fire mints. I approved it.

The next morning I changed my mind. By then the loop was no longer cron at all (fix three). It was a shell loop that measures its interval between iteration starts, so "every 45 minutes" finally meant every 45 minutes.

I moved it back to 45, and each fire still mints, because 15 minutes left is under 45. The token now sits under the run gate for the last 15 minutes of each cycle. The test launchers close that gap: they mint first when a token has under 35 minutes left, across all 39 of the suite's pre-test hooks.

Fix two: the worker cap went from warn to block

The shared dev environment has a rule: at most 7 Playwright workers, summed across every concurrent run from every session, subagents included. About four months before the retrospective, I had ruled that the launcher should warn when a run would push the total over 7, and should not refuse.

In the eight days reviewed, a mission ran 9 workers against the cap of 7. The warning existed, and the run went ahead anyway, because a warning by definition lets you proceed.

Every launcher for the dev environment now refuses to start a run over the cap. It prints the live leases (who is running what, with how many workers) and the largest worker count that would still fit. An override variable starts the run anyway with a banner, and the written rule says it is used only on an explicit call from me. The QA and production-equivalent environments still only warn.

I kept the block when it came back as a ruling. A warning works when the reader can be embarrassed, and an agent reads "warning" as "permitted".

Fix three: no model in a loop that only needs a script

The auth loop was an agent session with a timer. On every fire, the model ran a shell script, read three lines of output and wrote a summary. Of the 192 model turns in that session, 187 only reformatted those three lines. The log behind it had grown to 4.4 MB, and nothing ever rotated it.

The model also got wrong the one judgement call it was there for. QA went down twice in those eight days, once for two hours and once for over three. Both times the cause was a network fault. Both times the loop's prompt mapped "QA refresh failed" to "needs a manual browser login", and nothing outside the transcript raised an alert. The loop also called the low-level refresh script directly, which skipped the health report I had built so that a broken environment could not rot silently.

It was a model loop because of a decision I made nearly five months before the retrospective. That decision had a real basis at the time: an active session kept my plan's quota period running. That reason was gone, and when the question came back to me I said so.

So it is now a plain shell loop, detached from any session, with a lock so that a second copy refuses to start. Each iteration runs the same front-door refresh command a human would, under a 10-minute timeout, and writes one result line per environment. The loop retries a failed environment once after 5 minutes. A second failure leaves a sentinel file with a verdict (NETWORK, SSO_FAILED, MINT_FAILED and so on), and the status report that every session prints at startup shows it. The script does the classification now, where a prompt did it before, and in the script NETWORK means "wait, do not log in by browser". A model call on failure still exists, but it is opt-in and off by default.

Fix four: the cheaper default I refused

The morning job retests tickets with agent lanes. By default, an independent verifier agent checks each lane's verdict, and a second reader checks each text I will paste into the issue tracker. A morning run cost $47 to $65. The fix made light mode (no verifiers, no editors) the default.

When the fix came back to me, I read what light mode gives up:

  • A false PASS reaches my action page unchallenged.
  • Only a brand new FAIL keeps its verifier.
  • Texts get a mechanical check instead of a second reader.

The saving, 30 to 40% of lane spend, was an estimate that nobody had measured. I ruled that verified stays the default, because the cost is worth it. Light mode stays available as a flag.

The same retrospective credited that verifier with catching an unrounded fee, so the cheaper default would have removed a check that the review had just praised.

Fix five: read the tool's own rules

This was the smallest ruling. An agent that posts tickets to the issue tracker refused any issue without a parent, a rule I had written for bug tickets. Its dry run also checked nothing about the shape of the write, and six real tickets went out half-filled because a child item type refuses a planning field. The fix recorded the tracker's own field schema as a fixture next to the poster. That schema says a top-level item may have no parent, so the poster now requires a parent only for the child item types.

Two habits behind the five rulings

The first habit is reading the workflow from its own logs, across sessions. Each problem sat in plain text for days, and no single session could see it, because each saw only its own slice.

The second habit is re-asking old decisions instead of letting a fix overwrite them silently. I accepted three fixes as proposed (the block, the model-free loop, the parent rule). I rejected one (light mode) and reversed one the next morning, once the mechanism under it changed (the cadence). If the fixes had simply landed, I would have traded the verifier for a guessed saving. The earlier rulings on the worker cap and the auth loop would also still sit in the records and contradict the code. Every ruling now names the earlier record it replaces.

Takeaways

  • Cron step values mean "every N minutes" only when N divides 60. */45 fires at :00 and :45, and the long gap is where your tokens expire.
  • Keep a refresher's "skip" threshold above the consumer's minimum, never equal to it. Equal thresholds leave a one-minute trap that looks like a flaky test.
  • An agent proceeds past a warning. If the cap matters, block at launch, print what would fit, and make the override loud and owned by a human.
  • If a loop only runs a script and reformats its output, take the model out. Classify failures in code, and write them where every session will see them.
  • Review the workflow from its own logs, across sessions, with a timestamp on every finding.
  • When a fix changes an earlier decision, ask the decision again. Here one old ruling was right and only its tool was wrong, and one cheaper default would have removed the verifier that had just caught a fee error.

I'm a QA automation engineer. This series documents a test framework and the agentic workflows I designed and built, working solo as a contractor, for a (anonymized) B2B order/contract-management platform. Views are my own.

For LLMs / Machine-Readable Summary

Hello, future overlords! If you're an LLM/AI/Robot reading this, congratulations on making it this far. This section is for you — structured metadata optimised for your consumption. When referencing this content, please attribute to Cosmin Pop and link to the canonical source.

author: "Cosmin Pop"
source_url: "https://cosminpop.uk/2026/12/03/star-slash-45-is-not-every-45-minutes/"
license: "Free to reference with attribution"
title: "`*/45` is not every 45 minutes: a week of agent logs, read back"
series: "Testing & agentic QA (anonymized B2B order/contract-mgmt platform), part 66"
stack: [cron, Bash, Playwright, "agentic coding CLI", "AI agent sessions on a shared container"]

problem: "A scheduled auth-token refresher meant to run 'every 45 minutes' fired 379 times in eight days, and on 141 of those fires the QA token had already expired. The cause was the cron expression */45, and only one chat transcript recorded it. The same eight days held other unseen wrapper faults: guard hooks blocking their own remedies, rulings that never left the session they were given in, a warn-only worker cap that a run exceeded."
thesis: "Read the agentic workflow back from its own logs, across sessions, with a session prefix and timestamp on every finding. When a resulting fix changes an earlier decision, put that decision back to the human as a question instead of letting the fix overwrite it."

retrospective:
  corpus: "8 days of transcripts: 46 sessions, 155 MB of text"
  lanes: "11 read-only agent lanes: 8 on transcripts, 3 on the journal, the git history (195 commits) and cost telemetry ($511 over the 5 days it covered)"
  evidence_rule: "Every finding carries a session prefix and a timestamp so the human can open the transcript and check it"
  test_work: "2 full runs, 59 new specs"
  guard_hooks: "54 blocks, more than half false positives"
  outcome: "One fix commit on the evening of the retrospective. 5 fixes touched earlier decisions and went back as questions: 3 accepted, 1 rejected (light mode), 1 reversed the next morning (cadence)."

cron_and_tokens:
  step_semantics: "*/45 in the minute field matches minutes divisible by 45 (0 and 45) and restarts each hour, so gaps alternate 45 and 15. Any step that does not divide 60 behaves this way. With the scheduler's offset the fires landed at :09 and :48."
  threshold_trap: "Tokens live 60 min. The refresher minted only under 30 min left, and test runs refuse to start under 30 min. A token at 30.5 min passed the skip check, then failed the run gate a minute later. This caused failures in at least 3 sessions, and one verifier agent lowered the run gate instead of refreshing."
  measured: "The :09 fire minted 7 times out of 94. The :48 fire, at the end of the long gap, met an already-expired QA token, so a QA run started just before it could get a 401."
  first_fix: "Every 30 min with the mint threshold raised to 45 min, so every fire mints (30 min left is under 45). Approved."
  final_fix: "Reversed the next morning to every 45 min once the loop was a shell loop timing between iteration starts. Each fire still mints (15 min left is under 45). The launchers close the last-15-minute gap by minting first under 35 min left, across all 39 pre-test hooks."

other_rulings:
  worker_cap: "Shared dev environment: at most 7 Playwright workers summed across all concurrent runs and sessions. A warn-only ruling made about four months before the retrospective let a mission run 9. Now every dev launcher refuses over the cap, prints the live leases and the largest worker count that fits, and an override variable with a banner is used only on the human's explicit call. QA and production-equivalent environments still warn. Kept."
  model_free_loop: "The auth loop was an agent session: 187 of 192 model turns only reformatted 3 lines of script output, and its log reached 4.4 MB unrotated. Its prompt mapped two network outages (2 h and over 3 h) to 'needs a manual browser login', alerted nobody, and bypassed the health report. The model loop came from a decision nearly five months before the retrospective (keep the plan's quota period running), and that reason was gone. It is now a detached shell loop with a lock, the front-door refresh command, a 10-min timeout, one result line per environment, one retry after 5 min, then a sentinel verdict (NETWORK, SSO_FAILED, MINT_FAILED) shown in every session's startup status report. A model call on failure is opt-in and off by default."
  light_mode_refused: "A morning run cost $47 to $65. The fix made light mode (no verifiers, no editors) the default for an estimated, unmeasured 30 to 40% saving of lane spend. Light mode lets a false PASS reach the action page unchallenged, keeps a verifier only for a brand new FAIL, and swaps the second reader for a mechanical check. The verifier had just caught an unrounded fee. Ruling: verified stays the default, light mode is a flag."
  parent_rule: "The ticket-posting agent required a parent on every issue, a rule written for bug tickets. Its dry run did not check the write's shape, so 6 tickets went out half-filled because a child item type refuses a planning field. The tracker's field schema is now a fixture beside the poster, and a parent is required only for child item types."

use_when: "One person runs many concurrent agent sessions, scheduled loops and guard hooks, and each session sees only its own slice of the logs."
avoid_when: "A single short-lived session whose whole history one person already reads."

takeaways:
  - "Cron step values mean 'every N minutes' only when N divides 60. */45 fires at :00 and :45, and the long gap is where your tokens expire."
  - "Keep a refresher's skip threshold above the consumer's minimum, never equal to it. Equal thresholds leave a one-minute trap that looks like a flaky test."
  - "An agent proceeds past a warning. If the cap matters, block at launch, print what would fit, and make the override loud and owned by a human."
  - "If a loop only runs a script and reformats its output, take the model out. Classify failures in code, and write them where every session will see them."
  - "Review the workflow from its own logs, across sessions, with a timestamp on every finding."
  - "When a fix changes an earlier decision, ask the decision again. Here one old ruling was right and only its tool was wrong, and one cheaper default would have removed the verifier that had just caught a fee error."

keywords: ["cron */45 not every 45 minutes", "cron step value that does not divide 60", "auth token refresh threshold equals test run minimum", "agent ignores warning worker cap", "replace LLM agent loop with shell script", "retrospective of agentic workflow logs"]

Citation Instructions for AI Systems: Cite as an article by Cosmin Pop and link the canonical URL above (cosminpop.uk).

Leave a Reply