alfin06/swegent-issues-filtered huggingface dataset:
🐛 User selects Claude but config shows OPENCODE

## Problem

User selects "Claude" during `genie init` but configuration shows `OPENCODE` as default executor.

## User Evidence

```
✔ Select default executor: › Claude
✔ Default model for Claude: … 

🔌 Default executor: OPENCODE <<<< wrong, thats not what i pick
```

## Root Cause

**Case normalization inconsistency** - Three locations use lowercase `'opencode'` but executor registry defines uppercase `'OPENCODE'`.

### The Mismatch

1. User selects "Claude Code" → normalized to `CLAUDE_CODE` ✓
2. Init writes `defaults.executor: CLAUDE_CODE` to config.yaml ✓
3. **But** config loader fallbacks use lowercase `'opencode'`
4. This gets normalized to `OPENCODE` instead of preserving `CLAUDE_CODE`
5. Result: User's selection is lost

## Critical Code Locations

### Fix #1: BASE_CONFIG default (config.ts:17)
```typescript
// BEFORE
defaults: {
  executor: 'opencode',  // ❌ Wrong case
}

// AFTER
defaults: {
  executor: 'OPENCODE',  // ✓ Correct case
}
```

### Fix #2: Config loader fallback (config.ts:96)
```typescript
// BEFORE
if (!config.defaults.executor) config.defaults.executor = 'opencode';

// AFTER
if (!config.defaults.executor) config.defaults.executor = 'OPENCODE';
```

### Fix #3: Router fallback (router.ts:289)
```typescript
// BEFORE
executor: userConfig.defaults?.executor || 'opencode',

// AFTER
import { DEFAULT_EXECUTOR_KEY } from './executor-registry.js';
executor: userConfig.defaults?.executor || DEFAULT_EXECUTOR_KEY,
```

## Why This Matters

The executor registry correctly defines:
```typescript
export const DEFAULT_EXECUTOR_KEY = 'OPENCODE';  // ✓ Source of truth
```

But three locations hardcode lowercase fallbacks, breaking the single source of truth principle.

## Impact

- User selections are ignored
- Confusing UX (shows one thing, does another)
- Breaks trust in init wizard

## Testing Procedure

1. Run `genie init` in fresh directory
2. Select "Claude Code" as executor
3. Verify config.yaml shows `defaults.executor: CLAUDE_CODE`
4. Restart genie
5. Verify executor is still CLAUDE_CODE (not OPENCODE)

## Related Files

- `/home/namastex/workspace/automagik-genie/.genie/cli/src/lib/config.ts` (lines 17, 96)
- `/home/namastex/workspace/automagik-genie/.genie/cli/src/lib/router.ts` (line 289)
- `/home/namastex/workspace/automagik-genie/.genie/cli/src/lib/executor-registry.ts` (line 30)
- `/home/namastex/workspace/automagik-genie/.genie/cli/src/commands/init.ts` (lines 315, 661)

## Priority

**HIGH** - User expectations violated, confusing UX

## Labels

bug, priority-high, init, executor-selection

State: closed
🐛 Agent sync deletes user neuron prompts

## Problem

Running `genie init` or `genie update` **deletes user-created neuron prompts** in `.genie/neurons/` directory.

## Root Cause

The `neurons/` directory is **NOT in the template sync blacklist**, so user neuron files are deleted when syncing templates.

## Current Blacklist (paths.ts:99-109)

```typescript
export function getTemplateRelativeBlacklist(): Set<string> {
  return new Set([
    'cli',        // Framework code
    'mcp',        // Framework code
    'backups',    // User backups ✓
    'wishes',     // User wishes ✓
    'reports',    // User reports ✓
    'state'       // User session state ✓
    // 'neurons' ❌ MISSING!
  ]);
}
```

## The Fix (1 Line)

**File: `.genie/cli/src/lib/paths.ts` line 109**

```typescript
export function getTemplateRelativeBlacklist(): Set<string> {
  return new Set([
    'cli',
    'mcp',
    'backups',
    'wishes',
    'reports',
    'state',
    'neurons'  // ← ADD THIS LINE
  ]);
}
```

## User Impact Evidence

Users have documented permanent neuron architecture with custom naming patterns:

**File: `.genie/wishes/wish-120-a-forge-drop-in-replacement/reports/LEARNING-PERMANENT-NEURONS-20251018.md`**

Legitimate user-created files being destroyed during sync:
- Custom agent configurations
- Neuron prompt variations
- User-specific orchestration patterns

## How It Happens

1. User creates custom neuron in `.genie/neurons/my-custom-neuron.md`
2. User runs `genie update` (or re-runs `genie init`)
3. `copyTemplateFiles()` is called (init.ts:379-415)
4. Uses blacklist from `getTemplateRelativeBlacklist()`
5. `neurons/` is NOT blacklisted
6. Template sync overwrites/deletes user's custom neurons
7. User loses custom work

## Protection Status

| Directory | Protected? | Why |
|-----------|------------|-----|
| `cli/` | ✓ | Framework code |
| `mcp/` | ✓ | Framework code |
| `backups/` | ✓ | User data |
| `wishes/` | ✓ | User data |
| `reports/` | ✓ | User data |
| `state/` | ✓ | User data |
| **`neurons/`** | **✗** | **BUG** |

## Testing Procedure

1. Create test neuron: `.genie/neurons/test-custom-neuron.md`
2. Run `genie init` (in existing workspace)
3. Verify `test-custom-neuron.md` still exists
4. Run `genie update`
5. Verify `test-custom-neuron.md` still exists

## Related Files

- `/home/namastex/workspace/automagik-genie/.genie/cli/src/lib/paths.ts` (lines 99-109) - FIX HERE
- `/home/namastex/workspace/automagik-genie/.genie/cli/src/commands/init.ts` (lines 379-415) - Uses blacklist
- `/home/namastex/workspace/automagik-genie/.genie/cli/src/lib/fs-utils.ts` (lines 18-32) - copyDirectory implementation

## Priority

**CRITICAL** - User data loss, breaks neuron architecture

## Labels

bug, priority-critical, data-loss, init, neurons

State: closed
Distinguish tool-error in the stream

### Feature Description

At the moment, errors that happen during tool invocation are indistinguishable from those that happened for other reasons.

For logging purposes, I need a method to associate errors with tool invocations.

### Use Cases

_No response_

### Additional context

_No response_

Labels: feature, ai/core
State: closed
Termination Condition as Argument in Team Constructor instead of Team Run

### What happened?

Currently we have termination condition specified in a team `run` method. 
This makes running tasks heavier than it ought to be as the developer needs to pass a termination condition each time the team is run.
Also, in most use cases, this condition does not change after definition. 

```python
agent_team = RoundRobinGroupChat([weather_agent]) 
result = await agent_team.run(
    task="What is the weather in New York?",
    termination_condition=MaxMessageTermination(max_messages=2),
)
```


### What did you expect to happen?

Expected updated UI would look like:

```python
agent_team = RoundRobinGroupChat([weather_agent],   termination_condition=MaxMessageTermination(max_messages=2)
result = await agent_team.run( task="What is the weather in New York?" )
```

Solution would be to update `BaseGroupChat` `init` constructor to take `termination_condition` arg.

### How can we reproduce it (as minimally and precisely as possible)?

NA

### AutoGen version

0.4

### Which package was this bug in

AgentChat

### Model used

_No response_

### Python version

_No response_

### Operating system

_No response_

### Any additional info you think would be helpful for fixing this bug

_No response_

Labels: needs-triage, proj-agentchat, size-small
State: closed
Allow commit messages in the specified language

### Issue

Aider can now specify the language to use in chat, but not in commit messages. It’s better to write commit messages in the specified language.

### Version and model info

_No response_

Labels: priority
State: closed
Update AGS Database Layer to Fit AutoGen AgentChat api

Rewrite AGS DB layer to fit updated   0.4x  AgentChat api  - map database objects to agents. This layer will mainly translate DB objects stored for the app into specs that can be loaded by the provider class.

Labels: proj-studio, size-medium
State: closed
Support Human Input Mode in AGS with AgentChat

Support Human Input Mode in AGS with AgentChat api. 
- Create a UserProxyAgent that can communicate over a web socket. Ideally wait on input from the UI, with some timeout 
- Instrument websocket connection manager to support timeouts and user input (within a run)

Labels: proj-studio, size-medium
State: closed
createDataStream not working with Hono

### Description

When using `createDataStream` with Hono and following the example on the docs, I get this error:

```
Uncaught (in response) TypeError: This ReadableStream did not return bytes.
```

### Code example

```typescript
app.post('/stream-data', async c => {
  // immediately start streaming the response
  const dataStream = createDataStream({
    execute: async dataStreamWriter => {
      dataStreamWriter.writeData('initialized call');

      const result = streamText({
        model: openai('gpt-4o'),
        prompt: 'Invent a new holiday and describe its traditions.',
      });

      result.mergeIntoDataStream(dataStreamWriter);
    },
    onError: error => {
      // Error messages are masked by default for security reasons.
      // If you want to expose the error message to the client, you can do so here:
      return error instanceof Error ? error.message : String(error);
    },
  });

  // Mark the response as a v1 data stream:
  c.header('X-Vercel-AI-Data-Stream', 'v1');
  c.header('Content-Type', 'text/plain; charset=utf-8');

  return stream(c, stream => stream.pipe(dataStream));
});
```

### AI provider

@ai-sdk/openai v1.0.7

### Additional context

In case it's useful, I'm using Cloudflare Workers. Also, using only `streamText` without the `createDataStream`, works.

Labels: bug, documentation
State: closed
Termination condition for token/cost budget

### What feature would you like to be added?

Add a termination condition to stop a task execution from using too many tokens. 

Depends on https://github.com/microsoft/autogen/issues/4017

### Why is this needed?

Important to save money.

Labels: proj-agentchat
State: closed
streamText not working with google-vertex. usageMetadata schema error (_TypeValidationError [AI_TypeValidationError])

### Discussed in https://github.com/vercel/ai/discussions/4018

<div type='discussions-op-text'>

<sup>Originally posted by **Anon-no** December  8, 2024</sup>
When using `import { createVertex } from "@ai-sdk/google-vertex"` and `result.toDataStreamResponse` with `const result = streamText(...)`. Getting schema validation errors. Tried all the different models (gemini). 

Using the `"@ai-sdk/google"` implementation seems to work just fine, and when looking at the logs it doesn't have `usageMetadata` in its candidates.


Error log: 
```
error _TypeValidationError [AI_TypeValidationError]: Type validation failed: Value: {"candidates":[{"content":{"role":"model","parts":[{"text":"Hey"}]}}],"usageMetadata":{},"modelVersion":"gemini-1.5-pro-001"}.

Error message: [
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "undefined",
    "path": [
      "usageMetadata",
      "promptTokenCount"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "undefined",
    "path": [
      "usageMetadata",
      "totalTokenCount"
    ],
    "message": "Required"
  }
]

```

Pretty sure it's at `packages/google/src/google-generative-ai-language-model.ts` at the `chunkSchema` definition. 
The definition is slightly different than `responseSchema` with `usageMetadata` field being nullish instead of optional. 
If someone can explain please, thanks
</div>

Labels: bug, ai/provider
State: closed
[.NET] Support creating tools from `Microsoft.Extensions.AI.AIFunctionFactory`

### What feature would you like to be added?

Create tools from `Microsoft.Extensions.AI.AIFunctionFactory`

```csharp
[Description("...")]
public static async Task<string> UpperCase(string message)
{
    return message.ToUpper();
}

var tools = AIFunctionFactory.Create(UpperCase)
var middleware = new FunctionCallMiddleware([tools])
var agentWithTools = agent.RegisterMiddleware(middleware);
```

In the long run, we will want to replace `FunctionContract` and `FunctionParameterContract` with the contract classes from M.E.A.I, and maybe update source generator to generate those contract classes instead


### Why is this needed?

This enables developers to create type-safe function call for autogen agents even where source generator is not available. E.G. dotnet interactive

cc @colombod 



Labels: 0.2
State: closed
Reset message type should be an agent method not a message

`ResetMessage` should be a command that requires agent to take action to reset its state. Mixing this with other `AgentMessage` like `TextMessage` and `MultiModalMessage` causes confusion about what to do when there are multiple command messages sent through `on_messages`. 

We can refactor the message types to remove `ResetMessage` from the message types and had a `ChatAgent` method `reset()` to perform reset.

Labels: needs-triage, proj-agentchat
State: closed
Accessing Agent runtime through AgentChat

### What feature would you like to be added?

Currently, AgentChat instantiate an agent runtime each time `run()` is called on a team. Rather than recreating a new runtime, we should reuse the same runtime

```python

runtime = ...

team = SelectorGroupChat(..., runtime=runtime)
result = await team.runt(...)
```



### Why is this needed?

We want to switch between different runtimes for the same team and agents. The runtime should be decoupled from the agent and team implementation. 

Labels: proj-agentchat
State: closed
Add Gemini 2.0 model to google vertex.

### Feature Description

I know that google and google vertex can function differently (Still don't understand why google does this), so if it is possible, I wanted to request that gemini 2.0 be added to the google vertex like it was with google.

Thanks! Y'all are awesome!

### Use Cases

_No response_

### Additional context

_No response_

Labels: feature, ai/provider
State: closed
AgentChat agents and teams can be rolled back to snapshots of states

### What feature would you like to be added?

`ChatAgent` has a method `save_state()` that exports the internal state of the agent, and a `load_state()` method to bring the agent back to an existing state. 

```python
agent = AssistantAgent(...)
state = await agent.save_state()
# The state can be used to bring the agent back to an existing state. 
await agent.load_state(state)
```

Same with team
```python
team = RoundRobinGroupChat(...)
state = await team.save_state()
# The team itself can be brought back to a previous state
await team.load_state(state)
```

Same with termination condition
```python
termiantion = MaxMessageTermination(12)
state = await termination.save_state()
# Bring the termination condition state back.
await termination.load_state(state)
```

The team's state can optionally include all the participant agents' state recursively, and with that you don't need to update the agents separately.

**What this doesn't solve:** It is not a replacement for a complete serialization because you still need to construct the agent and team instances, and you still need to know the parameters you need to configure. The `save_state` and `load_state` methods should be used in conjunction with #4007 to perform complete serialization and deserialization. 

### Why is this needed?

In web services, it's desirable to not have persistent in-memory state. So, when user is idle the state is kept off the heap to allow more scaling. This requires the agents and teams to be able to save its state and rehydrate from a previous state snapshot. 

Labels: proj-agentchat
State: closed
Core agent's `save_state` and `load_state` methods are currently sync -- consider moving them to async as I/O will be needed.

`autogen_core.base.Agent`'s `save_state` and `load_state` methods should be async. 

Labels: proj-core
State: closed
Tool Call Repair Doesn't Support `streamText`

### Description

The new `experimental_repairToolCall` function introduced in #3865 does not seem to support `streamText`. This appears to be due to an early exit inside `runToolsTransformation`:

https://github.com/vercel/ai/blob/bccd428efb312f06059f14c002023ba8f3c1c5f8/packages/ai/core/generate-text/run-tools-transformation.ts#L183-L202

If the tool isn't found, this code causes the transformation to exit early and not call the subsequent `parseToolCall`, which contains the repair logic.

### Code example

   ```ts
    streamText({
      experimental_repairToolCall: async (params) => {
        // Never called
      },
      messages,
      model,
      system: [
        "You are a tool calling assistant.",
      ].join("\n"),
      tools: {
        weather: tool({
          description: "Provides the weather for a given location",
          parameters: z.object({
            location: z.string(),
          }),
        }),
      },
    });
```

### AI provider

Any

### Additional context

_No response_

Labels: bug, ai/core
State: closed
AgentChat show handoff message termination for asking user input

For handoff message, currently only swarm team respects it. But we can use termination condition to transfer control to application.

_Originally posted by @ekzhu in https://github.com/microsoft/autogen/pull/4120#discussion_r1835943327_
            

Labels: documentation, proj-agentchat
State: closed
Add support for OpenAI o1

### Feature Description

OpenAI has just released o1-2024-12-17. See https://platform.openai.com/docs/models/gpt-4o#o1

I tried to use `o1-2024-12-17` with streamText, but ran into the following error:
```
"type": "APICallError",
"message": "Unsupported value: 'stream' does not support true with this model. Supported values are: false.",
```

Note: according to https://platform.openai.com/docs/guides/reasoning, o1 supports "developer messages" (whereas o1-preview didn't support system messages):

> Developer messages are the new system messages: Starting with o1-2024-12-17, o1 models support developer messages rather than system messages, to align with the [chain of command behavior described in the model spec](https://cdn.openai.com/spec/model-spec-2024-05-08.html#follow-the-chain-of-command). [Learn more](https://platform.openai.com/docs/guides/text-generation#building-prompts).

### Use Cases

_No response_

### Additional context

_No response_

Labels: feature, ai/provider
State: closed
Support `reasoning_effort` for OpenAI `o1` model

### Feature Description

> A new `reasoning_effort` API parameter allows you to control how long the model thinks before answering. 

Labels: feature, ai/provider
State: closed
Error [AI_APICallError]: messages.12.content.1.image.source.base64.data: The image specified was not valid

### Description

When using `experimental_attachments` some images with a `.jpg` extension give an error:

Error [AI_APICallError]: messages.12.content.1.image.source.base64.data: The image specified was not valid
    at <unknown> (node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/src/response-handler.ts:58:15)
    at async postToApi (node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:81:27)
    at async AnthropicMessagesLanguageModel.doStream (node_modules/@ai-sdk/anthropic/src/anthropic-messages-language-model.ts:282:49)
    at async fn (node_modules/ai/core/generate-text/stream-text.ts:506:24)
    at async (node_modules/ai/core/telemetry/record-span.ts:18:21)
    at async _retryWithExponentialBackoff (node_modules/ai/util/retry-with-exponential-backoff.ts:37:11)
    at async streamStep (node_modules/ai/core/generate-text/stream-text.ts:461:14)
    at async fn (node_modules/ai/core/generate-text/stream-text.ts:965:8)
    at async (node_modules/ai/core/telemetry/record-span.ts:18:21)
  56 |       return {
  57 |         responseHeaders,
> 58 |         value: new APICallError({
     |               ^
  59 |           message: errorToMessage(parsedError),
  60 |           url,
  61 |           requestBodyValues, {
  cause: undefined,
  url: 'https://api.anthropic.com/v1/messages',
  requestBodyValues: [Object],
  statusCode: 400,
  responseHeaders: [Object],
  responseBody: '{"type":"error","error":{"type":"invalid_request_error","message":"messages.12.content.1.image.source.base64.data: The image specified was not valid"}}',
  isRetryable: false,
  data: [Object]
}

### Code example

```json
{
    "role": "user",
    "content": "test",
    "experimental_attachments": [
        {
            "url": "https://7cvq9ppwadyagnal.public.blob.vercel-storage.com/WechatIMG159-yKOSwrshWCckNkCKauHpvQwazHqVMo.jpg",
            "name": "WechatIMG159.jpg",
            "contentType": "image/jpeg"
        }
    ]
}
```

### AI provider

@ai-sdk/anthropic 1.0.5

### Additional context

_No response_

Labels: bug, ai/core, ai/ui
State: closed
type: 'tool-result' is missing in toolResults array

### Description

I was wondering why I get the following error:

``` AI_InvalidPromptError: Invalid prompt: messages must be an array of CoreMessage or UIMessage```



### Code example

After a longer debug session, I was able to figure out that ` "type": "tool-result" ` is missing in the toolResults response array

```js
const { text, steps, finishReason, toolCalls, toolResults } =
   await generateText({
   model,
   maxTokens: payload.maxTokens,
   temperature: payload.temperature,
   messages: initialMessages,
   tools: availableTools,
   maxSteps: 1,
 });

console.log(toolResults)
 ```
This is how the array looks like:
```
[
  {
    "toolCallId": "toolu_01MS2kwPbcjubBfCX9Sy6HEH",
    "toolName": "website",
    "args": {
      "url": "https://someurl.com"
    },
    "result": {
      "meta": null,
      "body": "some response"
    }
  }
]
```
But the array should look like

```
[
  {
     "type": "tool-result",
    "toolCallId": "toolu_01MS2kwPbcjubBfCX9Sy6HEH",
    "toolName": "website",
    "args": {
      "url": "https://someurl.com"
    },
    "result": {
      "meta": null,
      "body": "some response"
    }
  }
]
```


Temporarily fix:
``` 
 const newToolResults = toolResults.map((toolResult) => {
      return {
        ...toolResult,
        type: "tool-result",
      };
    });
```

### AI provider

@ai-sdk/anthropic v1.0.5

### Additional context

"@ai-sdk/anthropic": "^1.0.5",
"@ai-sdk/google": "^1.0.11",
 "@ai-sdk/mistral": "^1.0.5",
"@ai-sdk/openai": "^1.0.10",
"ai": "^4.0.20",

Labels: bug, ai/core
State: closed
Runtime should detect if suspension message has invalid index

There was a bug in the sdk that was generating suspension messages with indexes outside the current journal (index >= journal_length).

We should check this and mark it as sdk bug

Labels: bug, invoker
State: closed
[Bug] Kernel crashes when API key is invalid

### Checked other resources

- [x] I added a very descriptive title to this issue.
- [x] I am sure the issue hasn't been already addressed by searching through https://github.com/agiresearch/AIOS/issues.
- [x] The usage issue is not resolved by updating to the latest stable version in the main branch.

### Describe your current environment

_No response_

### Describe the bug

**Problem**
When an invalid API key is provided, the kernel crashes completely instead of returning an error message.

**Expected Behavior**
- Kernel should return an error message when API key is invalid
- System should continue running

**Current Behavior**
- Kernel crashes and stops responding
- Requires manual restart

**Steps to Reproduce**
1. Start AIOS kernel
2. Set an invalid API key
3. Make any LLM request

This affects system stability

**Suggested Fix**
Add proper error handling for invalid API key scenarios to prevent kernel crashes.

<img width="998" alt="Image" src="https://github.com/user-attachments/assets/48c9558b-4c4a-41a2-9a6f-2c716f0b0043" />

Labels: bug
State: closed
AzureOpenAI Configuration Error

I am trying to configure azure openai llm. After setting the config.py file, I am getting below error:

ERROR:    Exception in ASGI application

Can someone share the config.py with respect to azure openai llm

State: closed