Skip to content

feat(sessions): support specifying session_id when creating session#1074

Merged
qin-ctx merged 2 commits intovolcengine:mainfrom
likzn:feat/add-session-id-to-create-session
Apr 3, 2026
Merged

feat(sessions): support specifying session_id when creating session#1074
qin-ctx merged 2 commits intovolcengine:mainfrom
likzn:feat/add-session-id-to-create-session

Conversation

@likzn
Copy link
Copy Markdown
Contributor

@likzn likzn commented Mar 29, 2026

Summary

Support specifying a custom session_id when creating a session. Previously, create_session() did not accept a session_id parameter. Now you can pass a specified ID to create a session, consistent with the behavior of get_session(session_id, auto_create=True).

Reference issue: #1065

Type of Change

  • New feature (feat)

Testing

  • Unit tests pass (pytest tests/api_test/sessions/test_create_session.py -v)
  • Manual testing completed (verified via API tests)

Related Issues

Checklist

  • Code follows project style guidelines
  • Tests added for new functionality
  • Documentation updated (if needed)
  • All tests pass

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 29, 2026

CLA assistant check
All committers have signed the CLA.

@likzn
Copy link
Copy Markdown
Contributor Author

likzn commented Mar 29, 2026

@qin-ctx hello,有空帮看眼

@qin-ctx
Copy link
Copy Markdown
Collaborator

qin-ctx commented Mar 30, 2026

@likzn 我在想要不要保留 create_session,因为我在 get_session 里已经实现了 auto_create 的逻辑。如果 create_session 仍然保留,那就需要严格检查该 sessio_id 是全新的,没有被使用。

@qin-ctx qin-ctx self-assigned this Mar 30, 2026
@likzn
Copy link
Copy Markdown
Contributor Author

likzn commented Mar 30, 2026

@likzn 我在想要不要保留 create_session,因为我在 get_session 里已经实现了 auto_create 的逻辑。如果 create_session 仍然保留,那就需要严格检查该 sessio_id 是全新的,没有被使用。

我理解为了向前兼容性是不是应该继续保留,理论上自定义id的方法放在create看起来更合适,晚点我补充下id的校验

Add AlreadyExistsError check in session_service.create() when a specific
session_id is provided, ensuring idempotent behavior and preventing
accidental overwrites of existing sessions.
@likzn
Copy link
Copy Markdown
Contributor Author

likzn commented Mar 30, 2026

id校验已加。 @qin-ctx

@qin-ctx qin-ctx merged commit c01c14e into volcengine:main Apr 3, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Docs]: 创建 session 文档有误,不支持传入 session_id

3 participants