nextlevelbuilder / nextlevelbuilder/goclaw

Workspace isolation inverts user/channel hierarchy — artifacts split across channels for the same user BUG?

Open
#1,073 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

agent:github-maintain architecture area:data-store bug maintain:triaged P2-medium question status:needs-triage
Dominant language
Go
Stars
3.6k
Forks
1.1k
Avg merge
3d 5h
Merged PRs (30d)
24

Description

Summary

The per-user workspace is scoped by channel first, then user. This means a user who interacts via multiple channels has their artifacts scattered across separate directories with no unified home. This is the opposite of isolation.

Observed behavior

Verified via POST /v1/chat/completions and WebSocket chat.send (tenant-scoped API key, predefined agent type):

tenants/{slug}/ws/{userID}/artifact.txt ← WebSocket session
tenants/{slug}/http/{userID}/artifact.txt ← HTTP session
tenants/{slug}/telegram/{userID}/artifact.txt ← Telegram

Same user, same agent, same tenant — three different filesystem homes.
This behavior appears to contradict multi-tenant isolation goals. Is it design-intent or bug?

Root cause

internal/store/pg/agents_context.go, GetOrCreateUserProfile:

effectiveWs = filepath.Join(effectiveWs, channel) // channel appended first
// then in loop_context.go, userID appended second via UserChatLayer

Expected behavior ?

User is the primary isolation boundary. Channel is a subdirectory under the user:

tenants/{slug}/{userID}/ws/
tenants/{slug}/{userID}/http/
tenants/{slug}/{userID}/telegram/

One-line fix:
// instead of:
effectiveWs = filepath.Join(effectiveWs, channel)
// should be:
effectiveWs = filepath.Join(effectiveWs, userID, channel)

(with corresponding removal of the UserChatLayer(userID) append downstream)

Impact

Any multi-channel deployment, a user's workspace context — files, artifacts, outputs — does not persist or accumulate across channels. Memory (DB-backed) is shared correctly; only the filesystem workspace is affected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read internal/store/pg/agents_context.go at GetOrCreateUserProfile and trace the downstream UserChatLayer(userID) path construction in loop_context.go. Reproduce the HTTP and WebSocket cases described in the issue, then verify that the same user's artifacts resolve under one tenant/user workspace with channel-specific subdirectories and no duplicate userID append.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.