[PR #975] [MERGED] Fix issue: Option to update username shown in conversations. #9764

Closed
opened 2026-02-16 18:14:08 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/975
Author: @opencode-agent[bot]
Created: 7/14/2025
Status: Merged
Merged: 7/14/2025
Merged by: @thdxr

Base: devHead: opencode/issue962-20250714_150114


📝 Commits (1)

  • 537954b Fix issue: Option to update username shown in conversations.

📊 Changes

3 files changed (+7 additions, -1 deletions)

View changed files

📝 opencode.json (+1 -0)
📝 packages/opencode/src/app/app.ts (+5 -1)
📝 packages/opencode/src/config/config.ts (+1 -0)

📄 Description

I've successfully implemented the feature to customize the username shown in conversations through the opencode.json configuration file. Here's what I did:

Changes Made:

  1. Updated Configuration Schema (packages/opencode/src/config/config.ts:125):

    • Added username: z.string().optional().describe("Custom username to display in conversations instead of system username") to the configuration schema
  2. Modified App Initialization (packages/opencode/src/app/app.ts:73-76):

    • Updated the provide function to load the configuration and use the custom username if set
    • Added fallback to os.userInfo().username if no custom username is configured
    • The code now reads: user: config.username || os.userInfo().username
  3. Added Test Configuration:

    • Updated the opencode.json file to include a test username field

How to Use:

Users can now add a username field to their opencode.json configuration file:

{
  "$schema": "https://opencode.ai/config.json",
  "username": "your-custom-username",
  "mcp": {
    // ... other config
  }
}

When this field is set, opencode will display the custom username instead of the system username in conversation messages. If the field is not set or is empty, it will fall back to using the system username as before.

The implementation is backward compatible and follows the existing configuration patterns in the codebase.

Closes #962

view session | view log


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/975 **Author:** [@opencode-agent[bot]](https://github.com/apps/opencode-agent) **Created:** 7/14/2025 **Status:** ✅ Merged **Merged:** 7/14/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `opencode/issue962-20250714_150114` --- ### 📝 Commits (1) - [`537954b`](https://github.com/anomalyco/opencode/commit/537954b30176725d5a6a0c008b3be8a050531914) Fix issue: Option to update username shown in conversations. ### 📊 Changes **3 files changed** (+7 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `opencode.json` (+1 -0) 📝 `packages/opencode/src/app/app.ts` (+5 -1) 📝 `packages/opencode/src/config/config.ts` (+1 -0) </details> ### 📄 Description I've successfully implemented the feature to customize the username shown in conversations through the opencode.json configuration file. Here's what I did: ## Changes Made: 1. **Updated Configuration Schema** (`packages/opencode/src/config/config.ts:125`): - Added `username: z.string().optional().describe("Custom username to display in conversations instead of system username")` to the configuration schema 2. **Modified App Initialization** (`packages/opencode/src/app/app.ts:73-76`): - Updated the `provide` function to load the configuration and use the custom username if set - Added fallback to `os.userInfo().username` if no custom username is configured - The code now reads: `user: config.username || os.userInfo().username` 3. **Added Test Configuration**: - Updated the `opencode.json` file to include a test username field ## How to Use: Users can now add a `username` field to their `opencode.json` configuration file: ```json { "$schema": "https://opencode.ai/config.json", "username": "your-custom-username", "mcp": { // ... other config } } ``` When this field is set, opencode will display the custom username instead of the system username in conversation messages. If the field is not set or is empty, it will fall back to using the system username as before. The implementation is backward compatible and follows the existing configuration patterns in the codebase. Closes #962 [view session](https://opencode.ai/s/fvMdcp4B) | [view log](/sst/opencode/actions/runs/16270347311) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:08 -05:00
yindo closed this issue 2026-02-16 18:14:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9764