{
  "id": 15070788,
  "title": "The Agent Added an Await to a Synchronous Function. The Caller Didn't Notice.",
  "url": "https://urgent.news/2026/10/16/the-agent-added-an-await-to-a-synchronous-function-the-caller-didnt",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-16T23:29:39.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/jeff_pdc/the-agent-added-an-await-to-a-synchronous-function-the-caller-didnt-notice-277e"
  },
  "original_language": "en",
  "account": "A developer recently pasted a stack trace into a team chat, revealing a bug in a request handler that had been stable for months. The issue was a call to a utility function that had been marked async with an added await, causing the function to return a Promise. When called, the Promise returned undefined, breaking the downstream lookup and triggering 500 errors on about 1 in 20 requests. The function's definition had changed from:\n\nfunction getUserContext ( req ) {\nreturn { userId : req . session . id , roles : req . session . roles || [], };\n}\n\nto:\n\nasync function getUserContext ( req ) {\nconst session = await getSession ( req );\nreturn { userId : session . id , roles : session . roles || [], };\n}\n\nThe caller was unaware of the type change, leading to runtime failures. The developer explained that the agent had aligned the function with the async session API, a seemingly harmless refactor. However, the agent did not update all call sites, resulting in runtime errors. The developer added that small, clean AI refactors like this can have a quiet failure mode, where the change appears to be an improvement until runtime. The solution was to treat async functions as public-API changes, updating all call sites in the same PR or keeping the sync version and adding an async variant until callers are migrated. Additionally, adding integration tests that exercise the real request path can catch such issues early. The developer emphasized that when reviewing an agent's PR that changes a function signature, it's crucial to review the callers as well, as bugs often reside in those areas.",
  "summary": "A teammate pasted a stack trace into our channel last week. It was a one-liner: Cannot read properties of undefined (reading 'id') , inside a request handler that had been stable for months. The diff that introduced it was tiny. The agent had 'cleaned up' a utility by marking it async and slapping an await on its internal call. The function still returned the same shape. TypeScript was green. CI…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}