Skip to content

Conversation

@MkDev11
Copy link
Contributor

@MkDev11 MkDev11 commented Jan 19, 2026

What problem does this PR solve?

When multiple users share the same agent simultaneously, there was no isolation mechanism. Historical memories and conversation state were being overwritten by subsequent requests because the canvas state was stored in the shared agent DSL.

The SDK's /agents/<agent_id>/completions endpoint already had session isolation, but the web UI's /completion endpoint in canvas_app.py did not.

Fixes #11697

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

Multiple users sharing the same agent were overwriting each other's
conversation history. Now each user gets their own session.

Fixes infiniflow#11697
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 19, 2026
@dosubot dosubot bot added the 🐞 bug Something isn't working, pull request that fix bug. label Jan 19, 2026
@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 19, 2026

@KevinHuSh please review the changes and let me know your feedback. thanks.

@KevinHuSh
Copy link
Collaborator

KevinHuSh commented Jan 20, 2026

Appreciations!
This API is called by front-end. There's corresponding front end alterations too, isn't it?
Plus, once the message is stored, it might be never retrieved again if this canvas is not used by team simultaneously.
That might waste DB a lot.

@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 20, 2026

@KevinHuSh Thanks for the review!

The frontend already supports session_id - I checked use-send-agent-message.ts and it already stores the session_id from responses and passes it back in subsequent requests. The wiring was there, just not being used because the backend wasn't returning session_id. So no frontend changes needed.

For DB waste: sessions are only created when users actually chat with the agent. We could add a cleanup job for old sessions in a follow-up PR if needed.

@MkDev11 MkDev11 closed this Jan 20, 2026
@MkDev11 MkDev11 reopened this Jan 20, 2026
@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 21, 2026

@ZhenhangTung can you review the PR and let me know your feedback? seems like Kevin is busy

@ZhenhangTung
Copy link
Contributor

@MkDev11 I’m a product manager, so I’m not able to review code directly :( Kevin will review it when he is available.

@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 21, 2026

@KevinHuSh Really sorry to bother you. Could you please review the PR again and help me merge it so that I can continue working on other issues?

@MkDev11 MkDev11 closed this Jan 21, 2026
@MkDev11 MkDev11 reopened this Jan 21, 2026
@JinHai-CN JinHai-CN requested a review from KevinHuSh January 21, 2026 10:50
@KevinHuSh
Copy link
Collaborator

No session_id. So, once stored in table 'API4Conversation' and never used. It makes no sense.
image

@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 22, 2026

@KevinHuSh Regarding session_id: null in the screenshot - that's the first request, which is expected. The frontend already handles session persistence:

  1. First request: session_id: null → backend creates session → returns session_id in response
  2. Frontend captures it via setSessionId(answerList[0]?.session_id) (line 448 in use-send-agent-message.ts)
  3. Subsequent requests include the stored session_id

The session gets reused on follow-up messages in the same conversation.

@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 27, 2026

@Magicbook1108 Can you please review this PR as well?

@MkDev11
Copy link
Contributor Author

MkDev11 commented Jan 28, 2026

@KevinHuSh Is it impossible to approve this PR yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Isolation mechanism for multiple users sharing the same agent?

3 participants