Skip to content

Rebuild CREW page on ListTemplate with in-body defaults editor#219

Open
jess-cat wants to merge 5 commits into
mainfrom
crew-page-rework
Open

Rebuild CREW page on ListTemplate with in-body defaults editor#219
jess-cat wants to merge 5 commits into
mainfrom
crew-page-rework

Conversation

@jess-cat

Copy link
Copy Markdown
Collaborator

Summary

Rebuilds the CREW page (/crew, /settings/crew) onto the shared ListTemplate with an in-body defaults editor, plus the surrounding extraction/DS work.

What changed

  • CREW page → shared ListTemplate: agents-only rows, a DEFAULTS summary card in the action column, and an in-body EditDefaultsPanel that replaces the roster (with a ← AGENTS back link + ✕). Every summary row clicks through to its editor section (model/fallback/reasoning → defaults, PERMISSIONS → overrides, GLOBAL INSTRUCTIONS → context); one unified SAVE persists behavior + approval + context together.
  • Shared ContextSectionsEditor extracted from AgentEditor's CONTEXT tab (file tabs, section name + content editor, per-section delete w/ confirm). AgentEditor now consumes it via an actions slot.
  • AgentToolsPanel restructured: DEFAULT PERMISSIONS section title + description, TOOL APPROVAL and OVERRIDES as field labels (matching the create-agent form rhythm), ADD OVERRIDE link, context-aware default copy, shared agentToolApprovalOptions.
  • ListTemplate gained opt-in scrollBody (bounded scroll chain so the list body scrolls while the action column stays anchored), plus listContent / actionExtra / leading slots.
  • Mobile: compact DEFAULTS disclosure with auto-collapse on open, 44px tap targets, responsive reflow at 1024/480, no horizontal overflow.
  • a11y / DS: restored ListRow focus ring (removed a stray !important override), Segmented ariaLabel, IconButton edit glyph, tokenized ContextSectionsEditor colors.

Testing

  • tsc clean · production build succeeds · 280/280 tests pass
  • Pre-PR design-system-parity and mobile-support audits completed; findings addressed (Drawer removed, focus ring, tap targets, tokenization, class-namespace cleanup).
  • Live-verified in the DS catalog at desktop + mobile widths.

Known non-issue

ChatTranscript.test.ts fails at import (DOMPurify addHook under vitest) — pre-existing on main, unrelated to this branch.

- CREW (/crew, /settings/crew) rebuilt onto the shared ListTemplate: agents-only
  rows, a DEFAULTS summary card, and an in-body EditDefaultsPanel that replaces
  the roster (with a "← AGENTS" back link + ✕)
- Extract shared ContextSectionsEditor from AgentEditor's CONTEXT tab (file tabs,
  section editor, per-section delete); AgentEditor now consumes it
- AgentToolsPanel: DEFAULT PERMISSIONS section title + description, TOOL APPROVAL
  and OVERRIDES as field labels, ADD OVERRIDE link, context-aware default copy,
  shared agentToolApprovalOptions
- ListTemplate: opt-in scrollBody (bounded scroll chain), listContent, actionExtra
  and leading slots
- Mobile: compact DEFAULTS disclosure with auto-collapse on open, 44px tap
  targets, responsive reflow at 1024/480
- a11y/DS: restore ListRow focus ring, Segmented ariaLabel, IconButton edit glyph,
  tokenized ContextSectionsEditor colors
@jess-cat

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60a42f20eb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

label="ADD OVERRIDE"
disabled={disabled}
onClick={() => onChange(addRule(policy))}
disabled={disabled || hasNewRow}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow multiple overrides before creating an agent

In the new-agent flow, this panel does not get an external baseline/save update before the user clicks CREATE, and newIndex is only cleared by removing the row or by an external policy reset. After the first ADD OVERRIDE, hasNewRow therefore stays true and this disables the only control for adding another rule, so users can no longer create an agent with multiple tool-approval overrides in one draft.

AGENTS.md reference: AGENTS.md:L11-L14

Useful? React with 👍 / 👎.

if (!initialTarget || !initialPath) {
return;
}
const locationKey = `${initialTarget}${initialPath}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Escape the NUL separator in source

This template literal embeds an actual NUL byte in the .tsx file. With this byte present, normal rg searches report FilesSurfaceSummary.tsx as binary and skip text matches unless --text is used, so future repo-wide searches and scripted edits can silently miss this component; use an escaped delimiter such as \u0000 instead.

Useful? React with 👍 / 👎.

- AgentToolsPanel: relax the ADD OVERRIDE guard so it's never disabled - adding
  an override collapses the current row to a read-only summary and opens a fresh
  one on top, so multiple overrides can be staged in a single draft (fixes the
  create-agent single-override cap). Still keeps one row expanded at a time.
- FilesSurfaceSummary: replace the raw NUL byte in the deep-link locationKey
  separator with an escaped backslash-u-0000 so tools do not treat the file as binary.
@jess-cat

Copy link
Copy Markdown
Collaborator Author

Addressed both findings in 1ed8d667:

  • P2 (multiple overrides): relaxed the ADD OVERRIDE guard — it no longer disables; adding an override collapses the current row to a read-only summary and opens a fresh one, so multiple overrides can be staged in one draft (fixes the create-agent cap). Verified live: 3 sequential adds → 7 rules, one row expanded at a time, button stays enabled.
  • P3 (NUL separator): replaced the raw NUL byte in the deep-link locationKey with an escaped \u0000 (same runtime value, plain-text source).

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ed8d66714

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

setModelIndex(initialModelIndex);
setFallbackIndex(initialFallbackIndex);
setReasoningIndex(initialReasoningIndex);
setApprovalPolicy(savedPolicy);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remount the approval control when resetting defaults

In the CREW defaults editor, if a user changes the TOOL APPROVAL default and then clicks RESET, this only restores approvalPolicy in state; AgentToolsPanel renders Segmented, which keeps its own selState after the first click and ignores later value prop changes. The draft becomes clean and SAVE is disabled, but the segmented control can still display the discarded permission, making the visible default approval state wrong until the user manually clicks another segment. Consider forcing the tools panel/segmented control to remount on reset or making Segmented fully controlled when value is supplied.

Useful? React with 👍 / 👎.

Segmented cached its local selState after the first click and ignored later
`value` prop changes, so a RESET in the CREW defaults editor restored the draft
(SAVE disabled) but left the TOOL APPROVAL segment displaying the discarded
selection. Reset selState whenever `props.value` changes so the control stays
controlled when the parent drives it; uncontrolled callers pass a static value
and are unaffected.
@jess-cat

Copy link
Copy Markdown
Collaborator Author

Addressed in 0633b87a: Segmented now re-syncs to value on change — reset the cached local selection whenever props.value changes, so RESET (and any parent-driven value change) is reflected in the control. Uncontrolled callers pass a static value and are unaffected. Verified segment clicks still update with no regression.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0633b87a68

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +907 to +911
return currentTabs.map((tab) => tab.id === linkedTab.id && tab.kind === "browser"
? { ...tab, path: linkedTab.path, commandInput: "", commandInputKey: tab.commandInputKey + 1, searchQuery: "" }
: tab);
});
setActiveTabId(linkedTab.id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear stale create drafts when applying file deep links

This route-driven navigation updates the browser tab directly, unlike the normal navigateBrowserTab path below that clears createState and delete feedback. If a user has CREATE NEW open with a filename/content and then follows a /files/<target>/<path> deep link or browser back/forward entry to another directory, the old create draft remains visible against the new tab's base path, so pressing CREATE can write that stale draft into the wrong directory. Clear the create/delete transient state when applying the deep link, or route this through the same navigation helper.

Useful? React with 👍 / 👎.

The deep-link effect repointed the active browser tab at a new target/directory
but, unlike navigateBrowserTab, left createState and deleteFeedback intact. An
open CREATE draft could then resolve against the newly-linked directory and write
into the wrong place. Clear both when applying a deep link, matching the normal
navigation path.
@jess-cat

Copy link
Copy Markdown
Collaborator Author

Addressed in 48bdd88c: the file deep-link effect now clears createState + deleteFeedback when it repoints the active tab, matching navigateBrowserTab. An open CREATE draft no longer survives a deep-link/back-forward navigation to resolve against the wrong directory.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48bdd88ce7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

rows={rows}
emptyObject="AGENTS"
connectLabel="NEW AGENT"
onConnect={onCreateAgent}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard the new-agent action while defaults are dirty

When the CREW page is rendered as /settings/crew, this onCreateAgent prop is openSettingsNewAgent, which calls navigateSettingsRoute directly instead of guardedSettingsNavigate. Because this change adds an in-body defaults editor while leaving the action bar mounted, a user can edit defaults/global instructions and then click NEW AGENT; that immediately unmounts the dirty editor and drops the draft without the unsaved-changes prompt. Route this action through the unsaved guard (or disable/hide it while the editor is dirty/open) for the settings-crew context.

Useful? React with 👍 / 👎.

In /settings/crew the action bar (incl. NEW AGENT) stays mounted alongside the
in-body defaults editor, but onCreateAgent called navigateSettingsRoute directly,
bypassing the unsaved-changes guard. Editing defaults/global instructions then
clicking NEW AGENT dropped the draft with no prompt. Route it through
guardedSettingsNavigate so a dirty editor prompts first. (The non-settings /crew
context already routes NEW AGENT through the guarded openShellSurface.)
@jess-cat

Copy link
Copy Markdown
Collaborator Author

Addressed in f0b6ece5: in /settings/crew, NEW AGENT now routes through guardedSettingsNavigate so a dirty in-body defaults editor prompts before it's unmounted. (The non-settings /crew path already routes NEW AGENT through the guarded openShellSurface, and the row-click path isn't reachable while the editor is open since it replaces the roster.)

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: f0b6ece555

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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