Skip to content

feat: coding workspaces - #116

Draft
murtaza-u wants to merge 26 commits into
mainfrom
feat/coding-workspace
Draft

feat: coding workspaces#116
murtaza-u wants to merge 26 commits into
mainfrom
feat/coding-workspace

Conversation

@murtaza-u

Copy link
Copy Markdown
Collaborator

We have a notion of a workspace. Each workspace is an isolation within a tenant. This PR extends the idea of a workspace to not just isolation but also features. When creating a workspace, a user will be able to choose the type of it. All existing workspaces will be called "General purpose" workspaces. With that said, this PR also introduces "Coding" workspaces.

- Add project, worktree, Git, terminal, review, and GitHub OAuth flows
- Add gateway APIs, database migrations, web UI, Helm configuration, and docs
Extend the general workspace with coding-specific workflows, reusing its chat
composer, session navigation, file editor, resize controls, and shadcn
components.

- Align project pages, workspace creation, and GitHub account settings with
  existing layouts. Keep dotted empty states and use restrained colors and
  icons.

- Replace native repository selection with searchable, paginated GitHub
  results. Paginate pull requests and issues instead of loading entire
  collections.

- Fix project routing, preserve agent and draft selection, and retain messages
  and attachments across provisioning, upload, and first-prompt failures.
  Allow OpenCode to generate thread titles.

- Rework the Code panel with shared tabs, searchable branches, collapsible
  file diffs, staging actions, and direct access to the shared editor. Protect
  unsaved edits and prevent branch switches with dirty checkouts.

- Fix initial diff rendering, multi-file patches, Unicode paths, renamed
  files, and binary-file handling. Share keyboard and pointer resize behavior
  with the files workspace.

- Match terminal fonts and themes to the app, correct sizing, preserve
  sessions across tab changes, and fix connection focus, close, and retry
  behavior.

- Generate meaningful conventional branch names from the first prompt in the
  background. Keep worktree directories stable, preserve existing and shared
  branches, and fall back to a temporary chore/ branch when naming fails.

- Generate commit messages from bounded staged diffs when the input is empty.
  Preserve custom messages, use the selected model without tools, and clean up
  temporary generation sessions on success or failure. Reject stale staged
  trees before committing and applying changes.

- Add generated suggestion and branch-rename APIs, expose OpenCode part
  discriminators and PTY types, and regenerate Go and TypeScript clients.
  Update the OpenCode configuration hash.

- Remove cached GitHub author identity fields through a migration and use the
  connected account identity at commit time. Drop unused Git commands,
  redundant context fields, and obsolete workspace notes; format affected code
  and migration metadata.

Validation: Go tests, TypeScript, targeted ESLint, the trusted Git test, and
production builds passed. Live checks covered projects, chat retries, diffs,
staging, editor saves, terminals, branch naming, generated and custom commits,
stale-tree races, failure cleanup, and shared worktrees. Test resources were
removed; no test commits were pushed.
- Combine code review, file browsing, and terminals in one workspace
- Add file search and managed terminal sessions
Preserve upstream project setup, draft sessions, GitHub pagination, generated
commit messages, and terminal rendering while integrating the sidebar.
Reuse the resize control and remove the obsolete review panel.

Let the generation context govern model request timeouts and abort temporary
OpenCode sessions before deletion, including after client cancellation.
Remove competing terminal tab indicators and repeated workspace headers. Preserve terminal names, neighbor selection and keyboard focus; consolidate branch controls, tighten embedded toolbars, and move commit and pull request forms into their working context.

Validated against the live sandbox: terminal creation, overflow, pointer and keyboard focus, reconnect, close and reload; file edits and save; stage/unstage, filtering and branch switching; retry states, panel resize and shortcuts; light/dark and mobile layouts. Typecheck, ESLint and production build pass.
Use consistent context typography, themed Lucide icons, shared priority badges and task progress. Replace manual diff selectors with shared Tabs and use tooltips for view controls. Connect the diff shadow root to the existing mono and UI font tokens. Forward Progress values to Radix for accessible determinate status.

Validated live staging and unstaging, keyboard tabs, split/unified and wrapped diffs, shared font resolution, and empty context. Checked populated context fixtures with long labels and all task states in light, dark and mobile layouts, including the accessible progress value. Typecheck, lint and production build pass. Sandbox fixtures removed.
Older filesystem images returned legacy diff fields without a revision. The
new gateway accepted those as an empty review and staging sent an invalid
empty revision. Reject incompatible responses with an actionable image update
message; verify current image review and staging after a real sandbox rollout.

Batch untracked paths through an isolated intent-to-add index. Preserve Git
patch bodies and parse only headers for reads; parse hunks for mutations.
This reduces 1,000-file review from 1,005 Git processes to seven without
changing the user's index. Preserve the single-file fast path.

Ten alternating before/after handler samples, two operations each:
goos: linux
goarch: amd64
pkg: github.com/accuknox/agentz/internal/gateway/filesystem
cpu: AMD EPYC-Genoa Processor
                                  │ /tmp/agentz-review-final-before.txt │  /tmp/agentz-review-final-after.txt  │
                                  │               sec/op                │    sec/op     vs base                │
GitReview/status_1000_untracked-8                          26.21m ± 12%   26.31m ± 13%        ~ (p=0.853 n=10)
GitReview/untracked_1-8                                    21.25m ± 10%   20.46m ± 11%        ~ (p=0.529 n=10)
GitReview/untracked_100-8                                 354.63m ±  9%   36.54m ± 18%  -89.70% (p=0.000 n=10)
GitReview/untracked_1000-8                                3475.8m ±  3%   113.4m ± 12%  -96.74% (p=0.000 n=10)
GitReview/tracked_1000-8                                   193.0m ± 15%   199.3m ± 20%        ~ (p=0.971 n=10)
GitReview/added_100k-8                                     144.4m ±  8%   101.2m ± 12%  -29.92% (p=0.000 n=10)
GitReview/replaced_100k-8                                  250.9m ± 10%   167.3m ± 12%  -33.32% (p=0.000 n=10)
GitReview/sparse_100k-8                                    54.46m ± 20%   59.40m ± 10%        ~ (p=0.315 n=10)
geomean                                                    150.4m         67.81m        -54.91%

100K replacement allocation: 142.84 MiB to 67.17 MiB per request.
Production browser median, 1,000 files, ten sequential samples per version:
4855.9 ms to 339.4 ms. Raw timings, limitations and commands are in the report.

Validation: Go tests and race detector for gateway/filesystem, go vet,
100K final-line browser reachability, actual index stage/unstage, stale hunk
rejection, stash restore/pop/conflict retention. The temporary checkout
changes and commits were removed and the original HEAD/stashes restored.
Remove the missing-revision guard and its dedicated regression test. The
reported mismatch came from an agent image that had not been updated and
does not require additional compatibility handling.

Remove the associated fix documentation while retaining the historical
benchmark conditions. Preserve Git review, staging, stash behavior and all
measured performance changes.

Validation: gateway coding.go matches its pre-guard version exactly;
performance, generated and frontend files are unchanged. Gateway and
filesystem Go tests pass.
Separate the commit subject from its optional extended description using
existing shadcn fields. Highlight subject text after character 50 without
wrapping or rejecting it. Hardwrap body text at 80 characters while typing,
pasting and accepting generated suggestions, preserving paragraph breaks.
Combine subject and body with a blank line and retain drafts on failure.

Give the mobile composer enough space and make its content scrollable on
short screens. Keep the existing combined message size limit.

Define the missing success color token so additions render green. Remove
the diff's normal-width font override to inherit the shared monospace
settings. Use simple hunk separators instead of unmodified-line bars.

Validation: TypeScript, targeted ESLint and production Next build passed.
Browser checks covered 50/51-character highlighting and horizontal scroll,
80/81-character wrapping, long-word/multiline paste, cursor replacement,
generated suggestion splitting, empty subject and combined length limits,
failed-commit draft retention, real subject-only and multiline commits,
light/dark themes, narrow/short viewports and 100K-line hunk navigation.
Saved commit text and rendered font settings were inspected. Test files
and commits were removed and the original sandbox HEAD/stashes restored.
Group header actions and constrain project settings and stash dialogs.
Avoid competing navigation refreshes, refresh Git status when opening a
panel, and distinguish failed reviews from empty comparisons with retry.
Notify chat-list subscribers when checkout deletion removes conversations.

Verified through the production UI and Kubernetes sandbox, including
project/workspace lifecycle, files, terminals, staging, stashes, error
recovery, narrow layouts, and 100K-line review. Record coverage and limits.
Replace project cards with a focused TanStack Table using AdminDataGrid.
Match the existing administration layout, workspace badge, primary create
button, borders, typography, row density, and horizontal scrolling.

Show truncated name, repository, and default branch columns alongside
shared relative timestamps. Use SVGL GitHub icons for light and dark
themes. Sort Name and Age locally, default to newest first, and identify
rows by project ID while retaining the complete-list endpoint.

Preserve row navigation, keyboard and modified-click opening, agent and
draft parameters, and removal of the new query parameter. Keep the shared
loading state and agent-dependent welcome message and create action.

Add row menus for settings and rename through the existing dialogs. Load
settings on demand, report fetch failures, stabilize the action callback,
and refresh the list after mutations. Preserve composer behavior and
checkout-based deletion restrictions. Remove unused card imports.

Include staged whitespace-only formatting of generated Zod schemas.

Validation: Bun typecheck, ESLint, formatting, and diff checks passed.
Browser checks covered MCP styling parity, both themes, narrow scrolling,
long text, empty lists with and without agents, sorting, row navigation,
and query preservation. Live checks covered creation, direct new=true
entry, settings retry, rename, deletion, cancellation, and draft retention.
Remove temporary browser fixtures, test projects, and the test session.
Remove the session context tab and its agent metrics and task view.
Clean up unused session context dependencies and UI imports.
Open a focused shell when the Terminal panel is activated. Refresh and
reuse running sessions, create only when needed, and guard repeated
activation and + clicks against duplicate creation. Closing the last tab
must not create a replacement.

Subscribe to generated, directory-scoped OpenCode PTY events and reconcile
sessions on stream reconnection, socket closure, and failed attachment.
Share cleanup between manual close and lifecycle events so exit/delete
races and stale list responses cannot restore tabs or remove another tab.
Dispose closed connections and emulators, select the next or previous tab,
and hide the empty terminal panel without closing another active tool.

Treat the reproduced HTTP 404 PtyNotFoundError as successful deletion.
Keep tabs on genuine deletion failures and offer an inline retry. Pass
Ctrl-D and exit through to the shell, preserve live sessions during
transport failures and tool switches, and cancel subscriptions and pending
UI work when the workspace changes. Failed creation waits for user retry.

Remove the Ctrl/Cmd-backtick shortcut, its tooltip, the introductory empty
state, and the persistent status/Clear/Reconnect footer. Keep tabs, close
buttons, and + with compact loading and contextual retry controls. Clarify
the worktree copy button tooltip.

Match the terminal scrollbar to the app's 6px width, rounded thumb, and
shared light/dark normal, hover, and drag colors. Configure xterm's width
through its overview ruler option so the fit addon reserves the same space.

Validation:
- Frontend typechecking, targeted ESLint, formatting, and diff checks pass.
- Browser checks against the existing sandbox cover creation, focus, reuse,
  shell input, Ctrl-D, exit, selection, closing, and background sessions.
- Reproduce the actual 404 close failure and verify repeated clicks,
  deletion races, stale responses, network loss, failed attachment,
  explicit retries, and creation failures without automatic retry loops.
- Verify directory/title scoping, missed-event reconciliation, workspace
  navigation during creation, and subscription/socket disposal.
- Check mobile and dark layouts, scrollbar colors, wheel scrolling, and
  thumb dragging. Close the temporary verification shells.
Remove the GitHub panel, PR creation dialog, issue and PR listings,
pagination, unused state, imports, and server actions. Replace the metadata
query with a focused remote branch head lookup that makes no PR or issue
requests.

Move Pull, Push, and Publish branch into Changes alongside Commit. Share
pending mutation state with staging, stashes, and branch switching to
prevent overlapping operations. Preserve dirty checkout, expected head,
fast-forward, ancestry, and exact remote lease checks.

Refresh local and remote status after sync operations, provide retry for
remote lookup failures, and refresh remote state when Changes reopens.
Limit polling to visible Changes and keep controls usable in compact,
expanded, and mobile layouts with stable accessible labels.

Keep GitHub authentication, connections, repository setup, commit identity,
and shared Git transport. Remove 242 net lines across three existing files
without adding files or dependencies or editing generated code.

Validation:
- Passed typecheck, lint, production build, and both coding tests.
- Live-tested staging, generated commit messages, commits, publishing,
  pushing, pulling, stashing, restoring, and branch switching.
- Verified duplicate-click prevention, failed requests and retry, hidden
  query behavior, stale heads, divergent history, and access denial.
- Checked Files, Terminal, panel shortcuts, dark mode, and 320/390px layouts.
- Removed temporary test checkouts, conversations, terminals, branches,
  refs, and authentication sessions.
- Persist checkout branches and session records safely
- Add skill deletion protection and webhook validation
- Improve Git conflict, stash, and remote branch handling
@murtaza-u murtaza-u self-assigned this Sep 13, 2026
Move branch, commit, and pull request prompts into embedded templates.
Parse templates once and render them beside their callers with typed
input data. Preserve validation, data limits, and input whitespace.

Remove the redundant agent instruction preamble and simplify instruction
file assembly so custom instructions stand on their own.

Replace untyped workflow request maps and manual JSON serialization with
generated request types and the typed async client method. Use a string
builder for prompt rendering and retain the existing tool permissions.

Validation: affected package tests, full Go build, and go vet passed.
The agent image lacked shell startup defaults, leaving the prompt and
ordinary ls output uncolored. Terminal themes also relied on xterm's
default ANSI palette instead of the app's light and dark colors.

Advertise COLORTERM=truecolor through the existing PTY creation API.
Keep OpenCode responsible for TERM and preserve color opt-out settings.

Share one typed xterm theme builder between startup and theme changes.
Map all 16 ANSI colors to app colors, set cursor and selection colors,
and use a 4.5 minimum contrast ratio. Preserve terminal sessions and
buffers when switching themes or reconnecting.

Package an interactive Bash profile in the existing Nix runtime. Use
Git's bundled prompt helper for a colored username@host:branch$ prompt
that updates with the repository and omits the branch outside Git.
Support linked worktrees and detached HEAD without custom Git parsing.
Initialize missing LS_COLORS and default ls to --color=auto while
preserving custom prompts, aliases, user login files, and NO_COLOR.
Leave noninteractive commands quiet and redirected output uncolored.

Keep changes in two existing files, remove duplicate theme setup, and
add no dependencies or generated-code edits. Shell defaults require
an updated agent image and a new terminal session.

Validation covered types, lint, formatting, Nix syntax, an agent image
build, and real OpenCode PTY color output. Browser checks covered ANSI,
indexed and RGB colors, resets, selection, theme changes, hidden tabs,
input, resizing, and reconnect replay. Shell checks covered overrides,
redirection, branch switches, worktrees, and detached HEAD.
Disable workflows, schedule/webhook triggers, dashboards, and persistent
memory in coding workspaces. Preserve general workspace behavior.

- Propagate immutable workspace types to Kubernetes and reject mismatched
  provisioning state.
- Block workflow and dashboard APIs for users, administrators, API keys,
  and service accounts. Keep workflow controllers inert in coding scopes.
- Reject memory enablement through agent APIs and admission. Disable
  memory and journal tools, context hooks, and workflow chat preferences.
- Remove workflow/dashboard tools, bundled skills, and workflow guidance
  from coding agents. Prevent environment overrides of workspace settings.
- Hide unavailable navigation, agent settings, and chat filters. Return
  not-found pages for direct workflow and dashboard URLs.
- Follow Next.js 16 conventions with generated PageProps, async parameters,
  Server Components, and Suspense around dynamic dashboard content.
- Remove redundant tool constants and payload-guessing helpers. Read
  session creation events through SDK types and simplify error calls.
- Document forbidden API responses and regenerate Go/TypeScript clients
  and Kubernetes CRDs from their source definitions.

Validation: Go tests and lint, TypeScript and ESLint, production Next.js
build, runtime checks, and browser checks for both workspace types passed.
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.

1 participant