Skip to content

feat(ai): ground project chats in their scope and the workspace view - #262

Closed
kinqsradio wants to merge 12 commits into
feat/web-rebuildfrom
feat/workspace-chat-context
Closed

kinqsradio wants to merge 12 commits into
feat/web-rebuildfrom
feat/workspace-chat-context

Conversation

@kinqsradio

Copy link
Copy Markdown
Member

See CONTRIBUTING before starting engineering work.

Refs #258. Stacked on #259: the base is feat/project-chat-dock. Retarget to feat/web-rebuild once #259 merges.

Change

  • Project scope reaches the model on every run. Since the runner refactor (34dd881b), scoped facts were checked at admission and then dropped, so "which project is selected?" had nothing to go on. contextFor now rereads the scope (agent/chat-context.ts) with the job owner's current access on every attempt and resume. A scope that was kept out or lost access stops the run before any provider call. The lead and specialist prompts name the selected project or task. Titles appear as escaped, one-line, bounded data.
  • Workspace view with each turn. chatRequest.view is optional and strict: {pane, path, query}, where the path is an /app/... pathname. The server derives any open task, page or project from the path. It drops that item unless the assistant may read it (visibility, kept out, team assistant setting), and takes titles from the database only. Under restrictive read rules only the screen is named. The view is a location hint and never changes the chat's scope.
  • Web dock: sends the working frame's pane, path and query at send time. The api-client now forwards view.
  • Navigation: dock links already go through the working route scope into WorkspaceController. No change.
  • Refresh: project reads now also refresh on review news, which is what approving a proposal announces. The approving tab already refreshes the planner store.
  • Approvals: unchanged. Applying a proposal stays people-only.
  • Finalization: a reviewed answer that only finalizes skips the scope reread, so an applied plan isn't reported as failed after its task is deleted. If the checker blocks that plan and it goes back to the model, the scope is checked again first.

Checks and limits

  • Run locally: npm run format:check, npm run typecheck (all workspaces), npm run build -w web, scripts/check-code-organization.py, scripts/check-project-docs.py.
  • Pure tests pass, 36/36: backend/tests/assistant-chat-context.unit.test.ts (new), web/tests/workspace-chat-guards.test.ts and backend/tests/web-workspace.unit.test.ts.
  • New DB tests, not run locally (no Postgres on this machine); CI runs them. They are in backend/tests/assistant-runs.test.ts and cover:
    • the provider sees the selected project and the checked view;
    • a foreign or kept-out project in the view never reaches the provider;
    • a waiting project chat makes no provider call after its project is kept out.
  • No browser or live provider check.
  • Threat model (design mode, quick) covered three risks: view → context leaks, resume after access loss, and prompt text → tools. The two leak and resume risks are checked by the new DB tests above.
  • An independent review found a restricted-rules title leak, a finalization regression and a blocked-plan recheck gap. All three are fixed here and confirmed by the reviewer.
  • Not in scope:
    • other tabs and devices still refresh the planner store by polling;
    • docs/architecture.md still describes the retired fixed graph;
    • citations from capability reads are still not shown.

AI usage

  • Tools: Claude Code (desktop app), Git, GitHub CLI, npm, Prettier, tsc, Node test runner.
  • Models: Claude Opus 5.5 at medium effort led: design, threat model, backend implementation and fixes. Opus 5.5 subagents at medium effort did the code trace and the independent review. A Claude Sonnet 5.5 subagent at medium effort implemented the web client slice.
  • Human role: asked for Wire workspace dock chat to project context, views, and workspace actions #258 to be resolved under the workspace rules. Review pending.
  • External sources: none copied.

Workspace

  • Used the outer Orbyn Engineering workspace with this target nested under repo/, and read the relevant project guides.

This contributor confirmation is not an automated claim that a host loaded policies.

🤖 Generated with Claude Code

luannn010 and others added 10 commits November 4, 2026 22:05
Format the PrepareReason union so CI passes. Read the projects list only
after the dock is first opened, skip the embedded Assistant's own projects
read, and let useProjectChat fall back to the Assistant links outside the
workspace dock instead of throwing.

Co-authored-by: Luan Nguyen <luannn010@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s load

Collapse on focus only for controls the panel hides, not frame bodies. Add a phone scrim and bottom sheet and reserve scroll space on desktop. Cap mounted chat sessions at 3 without dropping drafts or running chats. Read planner prefs, AI capabilities and agent settings once for all embedded chats.
…d share its reads

Collapse only for focus that follows a Tab, never for frame containers. Count an unconfirmed project draft as unsent. Share one assistant controls instance and refresh identity when the dock opens. Skip scroll reserve on short desktops and keep focus inside the phone sheet.
Rebuild a chat's scoped project or task facts at the start of every run
attempt, including resumes, using the job owner's current access. A scope
that lost access or was kept out of the assistant now stops the run before
any provider call; before, the facts were checked at admission and then
dropped, so the model never saw the selected project.

Name the selected scope in the lead and specialist prompts, and accept an
optional view (pane, app path, query) with each turn. The server derives
any selected task, page or project from the path, drops it unless the
person may show it to the assistant, and takes titles from the database.
Also reformat the runner call left over from the signature change.
…ff scope reads

Under restrictive read rules, name the open task or page by screen only, so
a denied space's title never reaches the model. A reviewed answer only
finalizes, so it no longer rereads the scope: an applied plan is not
reported as failed because its task was deleted or its project kept out.
Quote titles in the scope line as one bounded, escaped line, and make the
new run tests match their own chat's requests.
@kinqsradio
kinqsradio changed the base branch from feat/project-chat-dock to feat/web-rebuild November 6, 2026 08:50
…space-chat-context

# Conflicts:
#	web/src/app/workspace/ProjectChat.tsx
#	web/src/app/workspace/project-chat-policy.ts
#	web/src/screens/assistant/index.tsx
#	web/src/screens/assistant/useAssistant.ts
#	web/src/screens/projects/ProjectChatDock.tsx
#	web/tests/workspace-chat-guards.test.ts
…bad path

A finished job clears its run_state, so the view checkpoint is checked
while the run is waiting. Request validation answers 422 in this API.
@kinqsradio
kinqsradio deleted the branch feat/web-rebuild November 7, 2026 04:46
@kinqsradio kinqsradio closed this Nov 7, 2026
@kinqsradio
kinqsradio deleted the feat/workspace-chat-context branch November 7, 2026 04:46
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