feat(ui): collapse pasted text in chat history#407
Conversation
Add a CodeNomad-specific hidden prompt syntax for user messages so long planning and instruction blocks can stay out of the main chat flow without changing the text sent to the model. User messages now strip `<codenomad:hide>` markers before prompt submission, render hidden sections inside collapsed details blocks in the message history, and persist that display-only structure across optimistic message replacement and full app reloads. Validation: - npx tsx --test "packages/ui/src/lib/hidden-prompt-sections.test.ts" "packages/ui/src/stores/message-prompt-display.test.ts" - npm run typecheck --workspace @codenomad/ui - npm run build --workspace @codenomad/ui
|
I want you to perform the gatekeeper checks for latest PR state check for regressions |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/25568593846 Artifacts expire in 7 days. |
|
Understood request: perform gatekeeper checks for the latest PR state, looking for regressions and better implementations. Assumption: this is a review-only pass, not a request to patch the branch. Gatekeeper result: changes requested. Findings:
Additional quality notes:
Verification performed:
Oversized touched files to keep on the refactor radar:
Recommendation: do not merge until the stale override cleanup is fixed and the persistence strategy is either narrowed to metadata/ranges or explicitly accepted as storing full prompt bodies in localStorage. -- |
Use segment-length metadata instead of persisting the full original prompt body in localStorage so hidden prompt sections keep their collapsed display state without creating an extra long-lived copy of the prompt text. This also clears the persisted metadata when revert pruning removes user messages, keeping the side store aligned with message deletion paths and avoiding stale hidden-section leftovers. Validation: - npx tsx --test "packages/ui/src/lib/hidden-prompt-sections.test.ts" "packages/ui/src/stores/message-prompt-display.test.ts" - npm run typecheck --workspace @codenomad/ui - npm run build --workspace @codenomad/ui
|
Same review again please |
|
Understood request: repeat the gatekeeper review for the latest PR state. Assumption: review-only pass, no branch changes requested. Gatekeeper result: no blocking findings found in the latest state. What changed since the prior review:
Review notes:
Residual risks / suggestions, non-blocking:
Verification performed:
Oversized touched files to keep on the refactor radar:
Recommendation: acceptable to merge once CI confirms typecheck/build in a dependency-complete environment. -- |
|
@pascalandr Thanks for working on this, but not sure we should do it. It might confuse users. |
I'm not sure how it can confuse users, what do you mean ? |
I see that your are using codenomad:hide which is very explicit. My take is
|
|
Oh I see but this is not the use case here : #266 (comment) |
|
If we can do something without sending additional stuff to LLM then it could used. Maybe if needed, a codeblock with language hidden would be a better way, that way model would understand the codeblock and we can treat this codeblock specially and hide it. TBH, I see this as low value vs high effort and maintenance and not very keen on it. It all adds up in the markdown rendering logic which is a heavy computation part already. |
ok I'll keep this in mind and will go on only if the trade-off is worthwhile enough |
Rescope the hidden prompt section work to the pasted-text history use case so long placeholder-backed pastes stay fully visible to the model while rendering as collapsed disclosures in user message history. This replaces the hidden-marker-specific metadata helper with prompt display metadata that resolves pasted placeholders at send time, preserves optimistic and persisted display metadata, and keeps the existing prompt attachment flow intact when users edit or remove placeholders before submission. The history renderer and localized disclosure label now reflect pasted text rather than hidden prompt syntax. Add focused regression coverage for prompt preparation, metadata persistence, and casing-edited pasted placeholders, and validate the change with targeted tests, UI typecheck, and UI production build.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26212242172 Artifacts expire in 7 days.
|
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26218379417 Artifacts expire in 7 days.
|
Keep placeholder-backed pasted text intact for message submission so the send path can generate collapsed history metadata instead of flattening the prompt too early in the composer. This introduces a prompt submission helper that separates the history entry from the actual submitted message, normalizes pasted text line endings for display metadata generation, and adds focused regression coverage for Windows CRLF hydration and message-mode placeholder handling. Validated with focused prompt submission tests plus UI typecheck and production build to reduce the risk of regressions while resuming the rescoped PR 407 behavior.
|
@CodeNomadBot check for regressions |
|
Understood request: gatekeeper review of the latest pasted-text-collapse implementation, specifically checking regressions, maintenance burden, computation cost, and better alternatives. Assumption: review-only pass, no branch changes requested. Gatekeeper result: changes requested. Findings:
Maintenance / implementation assessment:
Non-blocking notes:
Verification performed:
Oversized touched files to keep on the refactor radar:
Recommendation: do not merge until collapsed pasted blocks avoid initial Markdown rendering cost. After that, the implementation trade-off looks reasonable for this feature. -- |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26223556146 Artifacts expire in 7 days.
|
3 similar comments
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26223556146 Artifacts expire in 7 days.
|
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26223556146 Artifacts expire in 7 days.
|
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26223556146 Artifacts expire in 7 days.
|
Preserve collapsed pasted prompt sections after reopening sessions by storing prompt display metadata under stable session and message keys instead of ephemeral workspace instance ids. This also migrates legacy instance-scoped storage entries forward, adds focused persistence coverage for reopen and storage-key migration, and lazy-mounts pasted disclosure markdown so closed blocks avoid the expensive initial markdown and highlight render path. Validated with focused pasted-text tests plus UI typecheck and production build so the resumed PR 407 scope keeps the fixed placeholder-backed submission flow while improving reopen behavior and rendering cost.
|
@CodeNomadBot |
|
Understood request: repeat the CodeNomadBot gatekeeper review for the latest PR #407 state, focusing on regressions, maintenance burden, computation/render cost, and better implementation options. Assumption: review-only pass, no branch changes requested. Gatekeeper result: changes requested. Findings:
Resolved from prior review:
Maintenance / implementation assessment:
Verification performed:
Non-blocking notes:
Oversized touched files to keep on the refactor radar:
Recommendation: do not merge until the v3 prompt-display cleanup paths are corrected and covered by tests. -- |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26225545956 Artifacts expire in 7 days.
|
Update prompt display metadata cleanup to match the stable v3 session/message storage key model so clearing a session or instance removes the correct persisted pasted-collapse entries instead of relying on obsolete instance-scoped prefixes. This adds focused regression coverage for session-level and instance-level v3 cleanup behavior, keeps legacy key cleanup support in place, and passes the instance store's known session ids into broader cleanup so reopen persistence does not regress while stale metadata is removed correctly. Validated with focused pasted-text tests plus UI typecheck and production build to keep the rescoped PR 407 history-collapse behavior stable across reopen and cleanup paths.
|
@CodeNomadBot |
|
Understood request: repeat the CodeNomadBot gatekeeper review for the latest PR #407 state after the cleanup-semantics fix. Assumption: review-only pass, no branch changes requested. Gatekeeper result: no blocking findings. Findings:
Resolved from prior reviews:
Maintenance / implementation assessment:
Non-blocking notes:
Verification performed:
Oversized touched files to keep on the refactor radar:
Recommendation: acceptable to merge from this gatekeeper pass. -- |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26227365750 Artifacts expire in 7 days.
|
|
@CodeNomadBot |
|
Understood request: confirm whether the implementation trade-off is worthwhile for this feature. Assumption: this is an architecture/merge-readiness judgment only, not a request for new code changes. Yes, the trade-off is worthwhile for this feature in its current form. Why it is justified:
Costs accepted:
Why I would not push for a simpler alternative now:
Recommendation: keep this implementation. The added complexity is proportionate to the feature requirements now that lazy rendering and cleanup semantics are fixed. The only follow-up I would still suggest is a small naming cleanup later: rename -- |
|
@shantur I think this is ready to merge. I didn’t realize I needed this feature at first, but after using it, I really really like it. |
Summary
Fixes #266
Behavior
When a user submits a prompt containing an intact long pasted block from the existing pasted-text placeholder flow, the full pasted text is still sent to the model unchanged, but the chat history renders that pasted section as a collapsed expandable block.
This applies to the existing placeholder-backed long-paste flow only. If the pasted placeholder structure is broken before submission, the message renders in history as normal plain text with no collapse metadata.
Verification
npx tsx --test "packages/ui/src/components/prompt-input/submitPrompt.test.ts" "packages/ui/src/lib/prompt-display-metadata.test.ts" "packages/ui/src/stores/message-prompt-display.test.ts"npm run typecheck --workspace @codenomad/uinpm run build --workspace @codenomad/uinpm run build --workspace @codenomad/tauri-appLocal desktop verification
packages/tauri-app/target/release/codenomad-tauri.exepackages/tauri-app/target/release/bundle/nsis/CodeNomad_0.15.0_x64-setup.exe