@gajae-code/agent-core 0.18.5 → 0.18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.18.6] - 2026-10-03
6
+
7
+ ### Fixed
8
+
9
+ - A run that fails with the generic `Agent run failed.` now logs its underlying cause (error name, message, `cause` chain, and a short stack) as a `warn` entry in the local gjc log, with credentials redacted. The transcript and SDK clients still receive only the generic message; previously the cause was discarded entirely, so these failures could not be diagnosed.
10
+
5
11
  ## [0.18.5] - 2026-09-30
6
12
 
7
13
  ## [0.18.4] - 2026-09-30
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/agent-core",
4
- "version": "0.18.5",
4
+ "version": "0.18.6",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo and Gajae Code Contributors",
@@ -32,9 +32,9 @@
32
32
  "fmt": "biome format --write ."
33
33
  },
34
34
  "dependencies": {
35
- "@gajae-code/ai": "0.18.5",
36
- "@gajae-code/natives": "0.18.5",
37
- "@gajae-code/utils": "0.18.5",
35
+ "@gajae-code/ai": "0.18.6",
36
+ "@gajae-code/natives": "0.18.6",
37
+ "@gajae-code/utils": "0.18.6",
38
38
  "@opentelemetry/api": "^1.9.0"
39
39
  },
40
40
  "devDependencies": {
package/src/agent.ts CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  CURSOR_COMPOSER_BASH_POLICY_RECOVERY_PROMPT,
28
28
  isCurrentComposerBashPolicyBlockedError,
29
29
  } from "@gajae-code/ai/providers/composer-discipline";
30
- import { extractHttpStatusFromError } from "@gajae-code/utils";
30
+ import { extractHttpStatusFromError, logger, redactCrashSecrets } from "@gajae-code/utils";
31
31
  import { agentLoop, agentLoopContinue, managedLocalErrorDiagnostic } from "./agent-loop";
32
32
  import type { AppendOnlyContextManager } from "./append-only-context";
33
33
  import type { AttemptRunHandle, AttemptScope } from "./attempt-scope";
@@ -166,6 +166,30 @@ function safeErrorStatus(error: unknown): number | undefined {
166
166
  }
167
167
  }
168
168
 
169
+ /**
170
+ * The user-facing failure is deliberately generic, so the underlying cause is
171
+ * otherwise lost. Record it in the local debug log with credentials redacted
172
+ * and the text bounded; this never reaches the transcript or SDK clients.
173
+ */
174
+ function describeRunFailureForLog(error: unknown): { cause: string; stack?: string } {
175
+ try {
176
+ const raw = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
177
+ const chain: string[] = [raw];
178
+ let cause = error instanceof Error ? error.cause : undefined;
179
+ for (let depth = 0; cause !== undefined && depth < 3; depth++) {
180
+ chain.push(`caused by ${cause instanceof Error ? `${cause.name}: ${cause.message}` : String(cause)}`);
181
+ cause = cause instanceof Error ? cause.cause : undefined;
182
+ }
183
+ const stack = error instanceof Error ? error.stack?.split("\n").slice(1, 9).join("\n") : undefined;
184
+ return {
185
+ cause: redactCrashSecrets(chain.join(" | ")).slice(0, 2000),
186
+ ...(stack ? { stack: redactCrashSecrets(stack) } : {}),
187
+ };
188
+ } catch {
189
+ return { cause: "<unreadable error>" };
190
+ }
191
+ }
192
+
169
193
  function providerFailureCode(error: unknown): string | undefined {
170
194
  const status = safeErrorStatus(error);
171
195
  if (status === undefined) return undefined;
@@ -2293,6 +2317,15 @@ export class Agent {
2293
2317
  : (managedLocalErrorDiagnostic(err)?.errorKind ?? providerCode);
2294
2318
  const sanitized = sanitizeAgentFailure(err, runtimeFailureCode);
2295
2319
  const errorName = safeErrorName(err);
2320
+ if (!abortController.signal.aborted) {
2321
+ logger.warn("Agent run failed", {
2322
+ provider: model.provider,
2323
+ model: model.id,
2324
+ code: sanitized.code,
2325
+ status: safeErrorStatus(err),
2326
+ ...describeRunFailureForLog(err),
2327
+ });
2328
+ }
2296
2329
 
2297
2330
  const errorMsg: AgentMessage = {
2298
2331
  role: "assistant",