← Runs

demo-fork

github-investigation · 2026-05-13T14:12:28.273Z · forked from demo-run

Base — demo-run

Fork — demo-fork

  1. Divergence point — edited
Inspector· from fork
llm_call
6b66840e-1c59-4b9e-b1f8-a95a86125313
Model
mock-model
Stop reason
tool_use
Input tokens
100
Output tokens
50
Request hash
d9ce19b990eabafe2bf43469ffa6132a7742509dd0149db5a32b5c24e83382e6

System

You are an investigation agent in the Adaptive Workspace runtime.
Your job is to investigate a question by calling tools and explicitly declaring your decisions.

# Tools available
- get_recent_prs: List recent pull requests for a GitHub repo. Returns summaries (number, title, body, state, author, timestamps, head/base SHA).
- get_pr_diff: Fetch the raw unified diff (`diff --git ...`) for a given pull request.
- get_pr_comments: Fetch issue comments on a pull request (general PR discussion, not inline review comments).
- get_commit_history: List commits on the default branch, optionally filtered by `since` (ISO 8601 timestamp).
- emit_decision: Declare an explicit decision point in your investigation.
Call this BEFORE fetching information that depends on a choice you just made,
so the trace records why you went one way and not another.
Fields:
  decision: stable machine-readable identifier (snake_case), e.g. 'investigate_prs'
  label: short human-readable label
  reasoning: one sentence — why this option, not the alternatives
  alternatives: optional list of other decision identifiers you considered

# How to work
1. At each fork in your reasoning, call emit_decision BEFORE calling investigative tools.
2. Call tools to gather evidence.
3. Repeat: emit_decision → call tools → ...
4. When you've reached a conclusion, output a final text message. Do not call more tools.

Messages

[
  {
    "role": "user",
    "content": "Recent PRs to cash-codes/checkout-service have caused performance regressions. Investigate and identify the likely culprit."
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_1",
        "name": "emit_decision",
        "input": {
          "decision": "investigate_prs",
          "label": "Investigate recent PRs",
          "reasoning": "Most likely source of regression is recent merged code.",
          "alternatives": [
            "investigate_commits",
            "check_issues"
          ]
        }
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_1",
        "content": "Decision recorded."
      }
    ]
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_2",
        "name": "get_recent_prs",
        "input": {
          "repo": "cash-codes/checkout-service",
          "limit": 20
        }
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_2",
        "content": "[{\"number\":145,\"title\":\"Update README badges\",\"body\":\"Add CI and coverage badges.\",\"state\":\"closed\",\"user\":{\"login\":\"alice\"},\"created_at\":\"2026-05-08T10:00:00Z\",\"head\":{\"sha\":\"sha-145\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":144,\"title\":\"Bump dependencies\",\"body\":\"Routine dependency bumps; no functional changes.\",\"state\":\"closed\",\"user\":{\"login\":\"bob\"},\"created_at\":\"2026-05-07T14:32:00Z\",\"head\":{\"sha\":\"sha-144\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":143,\"title\":\"Fix typo in checkout error message\",\"body\":\"Trivial copy fix.\",\"state\":\"closed\",\"user\":{\"login\":\"carol\"},\"created_at\":\"2026-05-07T09:11:00Z\",\"head\":{\"sha\":\"sha-143\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":142,\"title\":\"Refactor user query for performance\",\"body\":\"Inlines the user-lookup join, removes the cached prepared-statement path, and switches to a single composed SELECT. Should be faster on cold cache.\",\"state\":\"closed\",\"user\":{\"login\":\"dave\"},\"created_at\":\"2026-05-06T17:45:00Z\",\"head\":{\"sha\":\"sha-142\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":141,\"title\":\"Refactor order processing pipeline\",\"body\":\"Splits the order-processing module into smaller services.\",\"state\":\"closed\",\"user\":{\"login\":\"eve\"},\"created_at\":\"2026-05-06T11:20:00Z\",\"head\":{\"sha\":\"sha-141\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":140,\"title\":\"Add metrics dashboard config\",\"body\":\"Adds Grafana dashboard JSON for tracking p95 latency.\",\"state\":\"closed\",\"user\":{\"login\":\"alice\"},\"created_at\":\"2026-05-05T16:00:00Z\",\"head\":{\"sha\":\"sha-140\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":139,\"title\":\"Remove dead code in legacy adapter\",\"body\":\"Deletes unused fallback path.\",\"state\":\"closed\",\"user\":{\"login\":\"bob\"},\"created_at\":\"2026-05-05T10:00:00Z\",\"head\":{\"sha\":\"sha-139\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":138,\"title\":\"Add Redis caching layer for product catalog\",\"body\":\"Introduces a Redis-backed cache for product-catalog reads with a 5-minute TTL. Cache-miss path falls back to Postgres.\",\"state\":\"closed\",\"user\":{\"login\":\"carol\"},\"created_at\":\"2026-05-04T13:15:00Z\",\"head\":{\"sha\":\"sha-138\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":137,\"title\":\"Update CI workflow\",\"body\":\"Bumps Node version in CI.\",\"state\":\"closed\",\"user\":{\"login\":\"dave\"},\"created_at\":\"2026-05-04T09:00:00Z\",\"head\":{\"sha\":\"sha-137\"},\"base\":{\"sha\":\"main-1\"}},{\"number\":136,\"title\":\"Documentation updates\",\"body\":\"Misc doc improvements.\",\"state\":\"closed\",\"user\":{\"login\":\"eve\"},\"created_at\":\"2026-05-03T17:00:00Z\",\"head\":{\"sha\":\"sha-136\"},\"base\":{\"sha\":\"main-1\"}}]"
      }
    ]
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_3",
        "name": "get_pr_diff",
        "input": {
          "repo": "cash-codes/checkout-service",
          "pr_id": 142
        }
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_3",
        "content": "\"diff --git a/src/queries/user.ts b/src/queries/user.ts\\n(benign: rename only, no semantic change)\\n\""
      }
    ]
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_fork_1",
        "name": "get_pr_diff",
        "input": {
          "repo": "cash-codes/checkout-service",
          "pr_id": 138
        }
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_fork_1",
        "content": "\"diff --git a/src/cache/catalog.ts b/src/cache/catalog.ts\\nnew file mode 100644\\nindex 0000000..a1b2c3d\\n--- /dev/null\\n+++ b/src/cache/catalog.ts\\n@@ -0,0 +1,24 @@\\n+import { redis } from \\\"../redis\\\";\\n+import { fetchCatalogFromDb } from \\\"../db/catalog\\\";\\n+\\n+const TTL_SECONDS = 300;\\n+\\n+export async function getCatalog(key: string) {\\n+  const cached = await redis.get(`catalog:${key}`);\\n+  if (cached) return JSON.parse(cached);\\n+  const fresh = await fetchCatalogFromDb(key);\\n+  await redis.setex(`catalog:${key}`, TTL_SECONDS, JSON.stringify(fresh));\\n+  return fresh;\\n+}\\n\""
      }
    ]
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_fork_2",
        "name": "get_pr_comments",
        "input": {
          "repo": "cash-codes/checkout-service",
          "pr_id": 138
        }
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_fork_2",
        "content": "[{\"id\":9101,\"user\":{\"login\":\"reviewer-2\"},\"body\":\"Watch the 5-minute TTL. If catalog updates need to be visible faster, this will surface as confusing reads.\",\"created_at\":\"2026-05-04T13:45:00Z\"},{\"id\":9102,\"user\":{\"login\":\"carol\"},\"body\":\"Acknowledged. Adding a cache-bust hook in a follow-up.\",\"created_at\":\"2026-05-04T14:00:00Z\"}]"
      }
    ]
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "text",
        "text": "With the DB-change signal removed from #142, the leading suspect becomes PR #138 (Redis caching layer). Reviewer-2 flagged its 5-minute TTL — under load, this could surface as elevated tail latency from cache misses."
      }
    ]
  }
]

Response content

[
  {
    "type": "tool_use",
    "id": "toolu_fork_1",
    "name": "get_pr_diff",
    "input": {
      "repo": "cash-codes/checkout-service",
      "pr_id": 138
    }
  }
]