Skip to content

Restore changes reverted by accidental PR #566 merge (#564, #565, #568)#608

Merged
itomek merged 7 commits intomainfrom
tomas/restore-reverted-prs-564-565-568
Mar 23, 2026
Merged

Restore changes reverted by accidental PR #566 merge (#564, #565, #568)#608
itomek merged 7 commits intomainfrom
tomas/restore-reverted-prs-564-565-568

Conversation

@itomek
Copy link
Collaborator

@itomek itomek commented Mar 23, 2026

Summary

PR #566 was accidentally merged with stale conflict resolutions that reverted 3 previously-merged PRs. Follow-up PRs #593/#604/#605 partially restored functionality. This PR restores all remaining missing changes.

Root cause: During a git merge origin/main into the branch (commit f07b932), conflict resolution kept the branch's older file versions, discarding work from 3 PRs. The squash merge then propagated this to main.

Reverted PRs restored by this PR:

Preserved follow-up PR additions:

Test plan

  • python -m pytest tests/unit/chat/ui/ --tb=short — 497 passed
  • python util/lint.py --black --isort — all checks pass
  • npm run build in src/gaia/apps/webui/ — 1,845 modules, no TypeScript errors
  • Smoke test: gaia chat --ui — verify UI loads, settings modal shows custom model override, welcome screen has typing animation, chat streams correctly
  • Verify concurrent document uploads use per-file locking

🤖 Generated with Claude Code

@itomek itomek requested a review from kovtcharov-amd as a code owner March 23, 2026 13:14
@github-actions github-actions bot added agents Agent system changes tests Test changes electron Electron app changes labels Mar 23, 2026
PR #566 squash-merged a stale branch that had resolved merge conflicts by
keeping older file versions, reverting 3 previously-merged PRs from main:
- PR #564: TOCTOU upload locking security fix
- PR #565: Tool execution guardrails with confirmation popup
- PR #568: Agent UI overhaul (CSS design system, animations, UX polish)

Follow-up PRs #593/#604/#605 partially restored functionality. This PR
restores all remaining missing changes while preserving those follow-ups.

Changes:
- 24 files: clean restore from pre-revert commit (CSS, components, utils)
- Security: restore per-file asyncio.Lock upload guard (dependencies.py,
  documents.py, server.py)
- SSE handler: restore <think> block state machine, UUID-scoped confirms,
  timeout parameter, friendly error messages
- Frontend: restore AnimatedPresence, session hash badge, smooth streaming
  exit, custom model override UI, terminal typing animation, inference stats
- Backend: restore custom_model DB override, Lemonade stats fetching,
  friendlier user-facing error messages
- Tests: 497 passing, TypeScript build clean (1845 modules)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@itomek itomek force-pushed the tomas/restore-reverted-prs-564-565-568 branch from 144cf4d to f36f329 Compare March 23, 2026 13:27
itomek and others added 3 commits March 23, 2026 09:47
- Fix DANGEROUS_SHELL_OPERATORS regex to catch trailing > and < edge cases
- Add _BLOCKED_PS_FLAGS set blocking -EncodedCommand, -File, -ExecutionPolicy, etc.
- Add rehype-sanitize alongside rehypeRaw in MessageBubble to prevent XSS
- Unify permission_request handler in ChatView with ALWAYS_ALLOW check and confirm_id
- Fix unbound session_id in _chat_helpers except block (moved before try)
- Add tests/unit/test_shell_guardrails.py with 39 unit tests for shell guardrails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ragment filter

- PermissionPrompt: add 'Always allow this tool' checkbox with remember state
  so users can suppress future prompts for trusted tools
- sse_handler: apply _TOOL_CALL_JSON_SUB_RE and _THOUGHT_JSON_SUB_RE in
  print_final_answer to strip embedded JSON artifacts from final responses
- sse_handler: fix _TOOL_CALL_JSON_SUB_RE to handle 2 levels of nested braces
  in tool_args (was leaving }}} fragments when args had nested dicts)
- sse_handler: skip flushing end-of-stream buffer content that is only
  whitespace and closing braces (JSON fragment artifacts)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s format

The model outputs {"thought": "...", "goal": "...", "tool": "...", "tool_args": {...}}
but _TOOL_CALL_JSON_RE only matched JSON starting directly with "tool", causing
the full JSON to be emitted as visible text with a trailing } artifact.

- Extend _TOOL_CALL_JSON_RE with leading .* to match optional thought/goal/plan
  fields before "tool" (common Qwen3 output format)
- Add _json_filtered flag: set True when any JSON block is suppressed, so
  subsequent bare } tokens (structural remnants) are also suppressed
- Strip thought/tool-call JSON from "before" text in think-block state machine
  to prevent pre-<think> JSON from appearing as response content

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
itomek and others added 3 commits March 23, 2026 12:30
The } streaming artifact is a pre-existing issue (present on main).
Two prior commits attempted to fix it by extending _TOOL_CALL_JSON_RE
with a greedy .* prefix and adding a _json_filtered state flag, but
these changes broke answer display (empty responses, suppressed content).

Reverting sse_handler.py to the working state from commit 9190980.
The } artifact will be addressed in a separate PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… size

- sse_handler: use time.monotonic() instead of time.time() for confirm
  timeout deadline (immune to NTP/DST clock jumps)
- shell_tools: remove git config from SAFE_GIT_COMMANDS (allows writes
  to .gitconfig without --get flag)
- documents: increase _copy_fd_to_temp block size from 8KB to 64KB
  (reduces syscall overhead for large uploads)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@itomek itomek added this pull request to the merge queue Mar 23, 2026
Merged via the queue into main with commit b7a97e6 Mar 23, 2026
27 of 29 checks passed
@itomek itomek deleted the tomas/restore-reverted-prs-564-565-568 branch March 23, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent system changes electron Electron app changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants