Skip to content

feat(agent-files): add word wrap toggle functionality and related styles - #39060

Closed
clawdwalt wants to merge 1 commit into
openclaw:mainfrom
clawdwalt:fix-agent-content-files-view
Closed

clawdwalt wants to merge 1 commit into
openclaw:mainfrom
clawdwalt:fix-agent-content-files-view

Conversation

@clawdwalt

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: Fix agent content viewer
  • Why it matters: Better usability
  • What changed: Added Word Wrap and Stretched File Content View
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • [ x] Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • [x ] UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

  1. Navigate to Agent Files > See File Content Word Wrap Toggle and Stretched window

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • [ x] Screenshot/recording
  • Perf numbers (if relevant)
image

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Compatibility / Migration

  • Backward compatible? (Yes/No).
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@greptile-apps

greptile-apps Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a word wrap toggle and a stretched (flex-based) layout to the Agent Files content viewer. The state management plumbing (agentFileWordWrap on the Lit element, prop-drilling through AgentsProps → renderAgentFiles) is clean and consistent with existing patterns, and the layout CSS changes achieve the intended stretched appearance.

However, there is a meaningful logic bug in the toggle implementation:

  • Word wrap "off" does nothing: The CSS only adds white-space: pre-wrap when the toggle is ON (.agent-file-textarea--wrap). When it is OFF the class is simply absent, and the textarea falls back to the browser's user-agent stylesheet which is already white-space: pre-wrap. Both states therefore render identically — the toggle button changes visually but the textarea behaviour never changes.
  • !important is unnecessary: No existing rule sets white-space on .field textarea, so the override flag serves no purpose and makes the rule harder to override in future.
  • Minor indentation inconsistency on the new word wrap button element in the template.

Confidence Score: 2/5

  • Not safe to merge as-is — the core word wrap toggle feature does not function in the off state due to missing CSS.
  • The word wrap "off" state never applies a white-space: pre rule, so the textarea always wraps regardless of the toggle position. This means the feature is only half-implemented: the button and state machinery work, but the visual effect of disabling word wrap is absent. The rest of the changes (layout, state plumbing) are straightforward and safe.
  • Pay close attention to ui/src/ui/views/agents-panels-status-files.ts (toggle class logic) and ui/src/styles/components.css (missing nowrap rule).

Last reviewed commit: 56362f8

<label class="field" style="margin-top: 12px;">
<span>Content</span>
<textarea
class="${params.agentFileWordWrap ? "agent-file-textarea--wrap" : ""}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Word wrap "off" state never actually disables wrapping

When agentFileWordWrap is false, the agent-file-textarea--wrap class is removed, but no class is added to force non-wrapping behaviour. The browser's user-agent stylesheet for <textarea> defaults to white-space: pre-wrap, so text continues to wrap in both states — making the "off" half of the toggle a no-op visually.

A nowrap variant class should be introduced and applied in the off state so the textarea actually overflows horizontally instead of wrapping:

In components.css, add:

.agent-file-textarea--nowrap {
  white-space: pre;
  overflow-x: auto;
}

Then in the template:

Suggested change
class="${params.agentFileWordWrap ? "agent-file-textarea--wrap" : ""}"
class="${params.agentFileWordWrap ? "agent-file-textarea--wrap" : "agent-file-textarea--nowrap"}"
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/ui/views/agents-panels-status-files.ts
Line: 435

Comment:
**Word wrap "off" state never actually disables wrapping**

When `agentFileWordWrap` is `false`, the `agent-file-textarea--wrap` class is removed, but no class is added to force non-wrapping behaviour. The browser's user-agent stylesheet for `<textarea>` defaults to `white-space: pre-wrap`, so text continues to wrap in both states — making the "off" half of the toggle a no-op visually.

A `nowrap` variant class should be introduced and applied in the off state so the textarea actually overflows horizontally instead of wrapping:

In `components.css`, add:
```css
.agent-file-textarea--nowrap {
  white-space: pre;
  overflow-x: auto;
}
```

Then in the template:
```suggestion
                            class="${params.agentFileWordWrap ? "agent-file-textarea--wrap" : "agent-file-textarea--nowrap"}"
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +2467 to 2470
.agent-file-textarea--wrap {
white-space: pre-wrap !important;
overflow-wrap: break-word;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

!important is unnecessary here

No existing rule in the stylesheet sets white-space on .field textarea or .agent-files-editor .field textarea, so !important is not needed to win the specificity battle. Removing it keeps the cascade clean and avoids making it harder to override later.

Suggested change
.agent-file-textarea--wrap {
white-space: pre-wrap !important;
overflow-wrap: break-word;
}
.agent-file-textarea--wrap {
white-space: pre-wrap;
overflow-wrap: break-word;
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/styles/components.css
Line: 2467-2470

Comment:
**`!important` is unnecessary here**

No existing rule in the stylesheet sets `white-space` on `.field textarea` or `.agent-files-editor .field textarea`, so `!important` is not needed to win the specificity battle. Removing it keeps the cascade clean and avoids making it harder to override later.

```suggestion
.agent-file-textarea--wrap {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +394 to +406
<button
class="btn btn--sm ${params.agentFileWordWrap ? "primary" : ""}"
title="${params.agentFileWordWrap ? "Word wrap on" : "Word wrap off"}"
@click=${() => params.onToggleWordWrap()}
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14" style="flex-shrink:0;">
<line x1="3" y1="6" x2="21" y2="6"/>
<path d="M3 12h15a3 3 0 0 1 0 6h-4"/>
<polyline points="14 15 11 18 14 21"/>
<line x1="3" y1="18" x2="7" y2="18"/>
</svg>
Wrap
</button>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Inconsistent indentation on the word wrap button

The opening <button> tag has ~42 leading spaces while the immediately following attributes are at ~32 spaces, and the other sibling buttons (Reset, Save) use consistent 14-space indentation. This misalignment is distracting in diff review and in editors.

Suggested change
<button
class="btn btn--sm ${params.agentFileWordWrap ? "primary" : ""}"
title="${params.agentFileWordWrap ? "Word wrap on" : "Word wrap off"}"
@click=${() => params.onToggleWordWrap()}
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14" style="flex-shrink:0;">
<line x1="3" y1="6" x2="21" y2="6"/>
<path d="M3 12h15a3 3 0 0 1 0 6h-4"/>
<polyline points="14 15 11 18 14 21"/>
<line x1="3" y1="18" x2="7" y2="18"/>
</svg>
Wrap
</button>
<button
class="btn btn--sm ${params.agentFileWordWrap ? "primary" : ""}"
title="${params.agentFileWordWrap ? "Word wrap on" : "Word wrap off"}"
@click=${() => params.onToggleWordWrap()}
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14" style="flex-shrink:0;">
<line x1="3" y1="6" x2="21" y2="6"/>
<path d="M3 12h15a3 3 0 0 1 0 6h-4"/>
<polyline points="14 15 11 18 14 21"/>
<line x1="3" y1="18" x2="7" y2="18"/>
</svg>
Wrap
</button>
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/ui/views/agents-panels-status-files.ts
Line: 394-406

Comment:
**Inconsistent indentation on the word wrap button**

The opening `<button>` tag has ~42 leading spaces while the immediately following attributes are at ~32 spaces, and the other sibling buttons (Reset, Save) use consistent 14-space indentation. This misalignment is distracting in diff review and in editors.

```suggestion
                              <button
                                class="btn btn--sm ${params.agentFileWordWrap ? "primary" : ""}"
                                title="${params.agentFileWordWrap ? "Word wrap on" : "Word wrap off"}"
                                @click=${() => params.onToggleWordWrap()}
                              >
                                <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14" style="flex-shrink:0;">
                                  <line x1="3" y1="6" x2="21" y2="6"/>
                                  <path d="M3 12h15a3 3 0 0 1 0 6h-4"/>
                                  <polyline points="14 15 11 18 14 21"/>
                                  <line x1="3" y1="18" x2="7" y2="18"/>
                                </svg>
                                Wrap
                              </button>
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 23, 2026
@clawsweeper

clawsweeper Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: current main still lacks an Agent Files word-wrap toggle, and this PR is a focused UI feature, but the submitted branch is not merge-ready because it conflicts with current main, the off state is a no-op, and the screenshot proof only shows one UI state.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes for the PR blockers: source inspection of the diff shows the off state emits no nowrap class, and live GitHub metadata reports the branch as conflicting. This is not a current-main bug reproduction because current main does not include the feature.

Is this the best way to solve the issue?

No as-is. The maintainable path is to refresh onto current main, keep the current Agent Files state and localization structure, add explicit wrap/nowrap behavior, and prove both states visually.

Security review:

Security review cleared: The diff is limited to Control UI state, rendering, and CSS, with no dependency, workflow, permission, secret, network, or code-execution changes.

What I checked:

  • stale F-rated PR: PR was opened 2026-03-07T17:43:27Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is insufficient and proof tier is D, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • steipete: Git history shows Peter Steinberger split the Agents view into focused panel modules and recently touched adjacent Agents UI flow that this stale branch must now follow. (role: recent area contributor and refactor owner; confidence: high; commits: 6c445889b386, c0a7c302f335, 4505987b9c8b; files: ui/src/ui/views/agents-panels-status-files.ts, ui/src/ui/views/agents.ts, ui/src/ui/app-render.ts)
  • BunsDev: Recent merged Control UI polish and markdown preview work touched the same Agent Files panel, stylesheet, and render tests that a refreshed version must preserve. (role: recent adjacent contributor; confidence: high; commits: a710366e9ece, da5b7ff0afaf, f76a3c5225bb; files: ui/src/ui/views/agents-panels-status-files.ts, ui/src/styles/components.css, ui/src/ui/views/agents.test.ts)
  • vincentkoc: Recent commits split UI view type seams and localized Control UI strings, both directly relevant to refreshing the PR without hard-coded Wrap copy. (role: recent Control UI seam and localization contributor; confidence: medium; commits: 01058162bebb, 547bd6f7d560, e8f0f91d2907; files: ui/src/ui/views/agents.ts, ui/src/ui/views/agents-panels-status-files.ts, ui/src/i18n/locales/en.ts)
  • gumadeiras: The original Agents dashboard and Agent Files refresh behavior were introduced in this history, so this person is relevant background for the UI surface. (role: introduced behavior; confidence: medium; commits: 2a68bcbeb32e, ddccfd3ec1cf; files: ui/src/ui/views/agents.ts, ui/src/ui/controllers/agent-files.ts, ui/src/ui/app-render.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9ff1a4371f68.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Apr 26, 2026
@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes:

The PR branch adds Control UI Agent Files word-wrap state plumbing, a Wrap button, and stretched file-content styling across app state, render, view, and CSS files.

Required change before merge:

This is a narrow UI repair/replacement candidate: main lacks the feature, the PR has an exact off-state CSS defect, the current files and focused tests are clear, and no product or security decision is required first.

Review findings:

  • [P2] Apply a nowrap class when wrap is disabled — ui/src/ui/views/agents-panels-status-files.ts:435
Review details

Best possible solution:

Land a narrow Control UI implementation that wires word-wrap state through the current nested AgentFilesState/AgentsProps path, adds accessible wrap and nowrap editor states with explicit CSS, preserves the markdown preview/editor behavior, avoids unrelated stylesheet churn, and covers both toggle states in focused render tests.

Full review comments:

  • [P2] Apply a nowrap class when wrap is disabled — ui/src/ui/views/agents-panels-status-files.ts:435
    When agentFileWordWrap is false, this class expression removes the wrap class but does not add a nowrap class. Textareas can keep wrapping by default, so the button can appear off while content still wraps; add an explicit nowrap class and CSS for the false state.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.93

Acceptance criteria:

  • pnpm exec oxfmt --check --threads=1 ui/src/styles/components.css ui/src/ui/app-render.ts ui/src/ui/app-view-state.ts ui/src/ui/app.ts ui/src/ui/views/agents-panels-status-files.ts ui/src/ui/views/agents.ts ui/src/ui/views/agents.test.ts CHANGELOG.md
  • pnpm test ui/src/ui/views/agents.test.ts
  • pnpm check:changed via Testbox before final handoff if runtime/UI files changed

What I checked:

  • current-main-no-toggle-search: Search on current main found only the base Agent Files textarea references; there is no agentFileWordWrap state, Word Wrap button, or wrap/nowrap CSS variant. (e46dccb35374)
  • current-main-agent-files-editor: The current Agent Files action row renders Preview, Reset, and Save, and the editor textarea uses only the base agent-file-textarea class. (ui/src/ui/views/agents-panels-status-files.ts:521, e46dccb35374)
  • current-main-agent-files-state-flow: Current main passes Agent Files through the nested agentFiles object without a word-wrap field or toggle callback, so the PR's older flat prop plumbing must be refreshed before it can land cleanly. (ui/src/ui/app-render.ts:1903, e46dccb35374)
  • current-main-agent-files-css: Current main defines textarea sizing and blur behavior for .field textarea.agent-file-textarea, but no explicit wrapping or non-wrapping variants. (ui/src/styles/components.css:3766, e46dccb35374)
  • pr-functional-defect: The PR patch applies agent-file-textarea--wrap only when agentFileWordWrap is true and applies an empty class when false, leaving no explicit nowrap behavior for the off state. (ui/src/ui/views/agents-panels-status-files.ts:435, 56362f885def)
  • current-main-tests-gap: Existing Agent Files render tests cover markdown preview structure and preview controls but do not cover a word-wrap toggle or wrap/nowrap textarea classes. (ui/src/ui/views/agents.test.ts:311, e46dccb35374)

Likely related people:

  • steipete: Verified commit metadata ties steipete to the Agents view split/refactor and recent adjacent Control UI maintenance touching this surface. (role: recent maintainer and refactor owner; confidence: high; commits: 6c445889b386, e5dc0e6d15ea, 84d8d5d5e703; files: ui/src/ui/views/agents-panels-status-files.ts, ui/src/ui/views/agents.ts, ui/src/ui/app-render.ts)
  • BunsDev: Verified commit metadata ties BunsDev to recent Agent Files markdown preview and Control UI polish that touched the same panel, stylesheet, and render tests. (role: recent adjacent maintainer; confidence: medium; commits: af56926e2fc4, a710366e9ece; files: ui/src/ui/views/agents-panels-status-files.ts, ui/src/styles/components.css, ui/src/ui/views/agents.test.ts)
  • gumadeiras: Verified commit metadata ties gumadeiras to the original Agents dashboard and agent-files refresh behavior that created the relevant UI surface. (role: introduced behavior; confidence: medium; commits: 2a68bcbeb32e, ddccfd3ec1cf; files: ui/src/ui/views/agents.ts, ui/src/ui/controllers/agent-files.ts, ui/src/ui/app-render.ts)

Remaining risk / open question:

  • The source branch is stale relative to current main's nested agentFiles/AgentsProps flow and may need a small rebase or replacement PR.
  • Manual visual verification is still needed after repair to confirm horizontal overflow and stretched layout behavior across viewport sizes.

Codex review notes: model gpt-5.5, reasoning high; reviewed against e46dccb35374.

@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label May 16, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 16, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels May 18, 2026
@Takhoffman

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

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

Labels

app: web-ui App: web-ui merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants