Skip to content

feat(chat): add attachments and improve agent conversations#343

Merged
xxx7xxxx merged 4 commits into
OpenCSGs:mainfrom
xxx7xxxx:dev
Jul 14, 2026
Merged

feat(chat): add attachments and improve agent conversations#343
xxx7xxxx merged 4 commits into
OpenCSGs:mainfrom
xxx7xxxx:dev

Conversation

@xxx7xxxx

Copy link
Copy Markdown
Collaborator

Summary

  • add content-addressed chat attachments across message APIs, durable storage, agent workspace delivery, and historical recovery
  • harden Codex turn recovery and refine composer, attachment, copy, and thread interactions

Screenshots

image image 20260714-170519 image

}

func attachmentDownloadURL(object attachmentObject) string {
downloadURL := "/api/v1/attachments/" + url.PathEscape(object.ID)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this URL compatible with the application base path instead of making it origin-rooted?

In production Sandbox deployments, the Web UI and API are served under a prefix such as https://ai.space.opencsg.com/v1/sandboxes/csgship-xxxxxx. With the leading / here, the browser resolves the attachment URL to:

https://ai.space.opencsg.com/api/v1/attachments/...

instead of the expected:

https://ai.space.opencsg.com/v1/sandboxes/csgship-xxxxxx/api/v1/attachments/...

Unlike regular API requests, download_url and preview_url are assigned directly to <a href> and <img src>, so the frontend’s resolveRequestPath() normalization is bypassed. Attachment previews and downloads will therefore fail in production Sandbox deployments.

Please either return a deployment-relative URL, resolve this field against the application base path in the frontend, or otherwise include the configured prefix. A subpath deployment test would also help prevent regressions.

if strings.TrimSpace(agentID) == "" {
return append([]im.MessageAttachment(nil), attachments...)
}
workspaceRoot, err := h.svc.WorkspaceRoot(agentID)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we hide local_workspace_dir for the Manager in the UI (and ideally reject it in the backend)? The Manager is automatically managed, and persistManagerAgent resets its RuntimeOptions to nil, so exposing this setting is misleading and non-durable. If it is set through the current update path, Codex can run in a different directory from the WorkspaceRoot used here, which would make these materialized attachments unavailable to it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed both comments. Attachment URLs now respect the application base path for sandbox deployments. The Manager no longer exposes runtime workspace options, and backend updates to those managed options are rejected, while Codex workers retain the setting.

@RussellLuo

Copy link
Copy Markdown
Collaborator

LGTM

@xxx7xxxx xxx7xxxx merged commit 779d128 into OpenCSGs:main Jul 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants