WeKnora/internal/handler/session
VictorMaznyuk b94612a7ec
fix(agent): PUT no longer erases the avatar, and driver errors stay server-side (#3230)
* fix(agent): PUT no longer erases the avatar, and driver errors stay server-side

Two defects in the custom-agent API, both of which surface as a successful or
misleading response.

1. A config-only PUT wiped the avatar.

   UpdateAgentRequest.Avatar was a plain string, so "field omitted" and
   "explicit clear" were indistinguishable, and UpdateAgent assigned it
   unconditionally. Any caller that updated only the config — which is what
   an edit form or an SDK client does when it sends the config it changed —
   silently zeroed the avatar and still received 200.

   Avatar now travels as *string end to end: nil keeps the stored value, a
   pointer to "" is an explicit clear. The service takes it as a separate
   argument because *types.CustomAgent cannot express the difference.

2. Raw repository/driver errors reached the client.

   The fallback branches forwarded err.Error() verbatim, so a postgres
   message — for example "ERROR: value too long for type character
   varying(64) (SQLSTATE 22001)" — was returned in the API response. That
   leaks schema details and tells the caller nothing actionable. Each
   fallback now returns a fixed message naming the operation; the full error
   is still logged immediately above, so nothing is lost for diagnosis.

   The same oversized-avatar case is now rejected earlier, by ValidateAvatar,
   as a 400 that names the varchar(64) limit instead of a 500 produced by the
   database.

Typed sentinels and *errors.AppError keep their existing behaviour — only the
untyped fallbacks changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(agent): complete avatar preservation and regression coverage

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-14 20:50:15 +08:00
..
agent_stream_handler.go feat(sandbox): stream live shell and install command output 2026-09-12 10:16:39 +08:00
artifact_completion_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
artifact_download.go refactor(resource-access): unify scoped authorization and transfer recovery (#3097) 2026-09-08 15:36:33 +08:00
artifact_download_test.go refactor(resource-access): unify scoped authorization and transfer recovery (#3097) 2026-09-08 15:36:33 +08:00
artifact_reference.go feat(agent): preview skill artifacts and verify installs without running them (#2823) 2026-08-27 10:30:32 +08:00
artifact_reference_test.go feat(agent): preview skill artifacts and verify installs without running them (#2823) 2026-08-27 10:30:32 +08:00
attachment_processor.go feat(docparser): 引入 anydoc 引擎,在 Go 进程内解析 office 文档 2026-08-16 11:37:27 +08:00
browserskill.go feat(browser): connect local Chrome with task controls and display modes (#3180) 2026-09-11 17:59:27 +08:00
browserskill_test.go feat(browser): connect local Chrome with task controls and display modes (#3180) 2026-09-11 17:59:27 +08:00
command_output_test.go feat(sandbox): stream live shell and install command output 2026-09-12 10:16:39 +08:00
continue_stream_resource_urls_test.go feat(chat): append messages to a running agent turn (#3123) 2026-09-09 16:43:33 +08:00
handler.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
helpers.go fix(chat): align live timestamps with persisted created_at 2026-08-24 17:04:48 +08:00
helpers_test.go fix(chat): align live timestamps with persisted created_at 2026-08-24 17:04:48 +08:00
image_upload.go feat(storage): add multi-instance storage backends per workspace 2026-07-15 14:54:39 +08:00
qa.go feat(browser): connect local Chrome with task controls and display modes (#3180) 2026-09-11 17:59:27 +08:00
qa_attachment_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
quick_answer_timeline.go fix(chat): 持久化快速问答的检索步骤,刷新后不再丢失时间轴 2026-08-13 21:34:21 +08:00
quick_answer_timeline_test.go fix(chat): 持久化快速问答的检索步骤,刷新后不再丢失时间轴 2026-08-13 21:34:21 +08:00
resolve_agent_test.go fix(agent): PUT no longer erases the avatar, and driver errors stay server-side (#3230) 2026-09-14 20:50:15 +08:00
resource_urls.go fix(api): close the resource_urls=public gaps found in review 2026-08-05 14:42:51 +08:00
resource_urls_test.go fix(api): close the resource_urls=public gaps found in review 2026-08-05 14:42:51 +08:00
sandbox_desktop_rfb.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox_desktop_rfb_test.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox_desktop_ws.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox_desktop_ws_test.go feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox_terminal_bridge.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
sandbox_terminal_bridge_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
sandbox_terminal_idle_test.go feat(sandbox): unify the interactive PTY prompt and reconnect running sandboxes (#3128) 2026-09-09 18:17:10 +08:00
sandbox_terminal_ws.go feat(sandbox): unify the interactive PTY prompt and reconnect running sandboxes (#3128) 2026-09-09 18:17:10 +08:00
search_knowledge_resource_urls_test.go fix(api): address resource_urls review follow-ups 2026-08-05 14:42:51 +08:00
steer.go fix(chat): preserve steering continuity and composer focus 2026-09-09 20:15:23 +08:00
steer_delivery_test.go feat(chat): append messages to a running agent turn (#3123) 2026-09-09 16:43:33 +08:00
steer_live_run_test.go fix(chat): preserve steering continuity and composer focus 2026-09-09 20:15:23 +08:00
steer_wiring_test.go feat(chat): append messages to a running agent turn (#3123) 2026-09-09 16:43:33 +08:00
stream.go fix(api): close the resource_urls=public gaps found in review 2026-08-05 14:42:51 +08:00
stream_usage_test.go feat(agent): report and attribute per-turn LLM token usage 2026-08-24 10:36:19 +08:00
temporary_attachment_persist_test.go feat(attachments): implement normalization and limits for temporary attachment IDs 2026-07-16 17:41:27 +08:00
temporary_document.go refactor(resource-access): unify scoped authorization and transfer recovery (#3097) 2026-09-08 15:36:33 +08:00
title.go feat(session): implement strict owner scope for API-key sessions 2026-07-20 19:31:02 +08:00
types.go feat(browser): connect local Chrome with task controls and display modes (#3180) 2026-09-11 17:59:27 +08:00
wiki_fixer_scope.go refactor(resource-access): unify scoped authorization and transfer recovery (#3097) 2026-09-08 15:36:33 +08:00
wiki_fixer_scope_test.go fix(session): scope wiki fixer to shared KB tenant 2026-05-21 11:19:19 +08:00