Skip to content

⚡ Bolt: Implement fast path for DirtyJson.parse_string#15

Open
thirdeyenation wants to merge 9 commits intomainfrom
bolt/dirty-json-fast-path-16801808902471274659
Open

⚡ Bolt: Implement fast path for DirtyJson.parse_string#15
thirdeyenation wants to merge 9 commits intomainfrom
bolt/dirty-json-fast-path-16801808902471274659

Conversation

@thirdeyenation
Copy link
Copy Markdown
Owner

💡 What: Updated DirtyJson.parse_string() in helpers/dirty_json.py to attempt json.loads(json_string) before initializing the DirtyJson parser.
🎯 Why: DirtyJson.parse_string is used across the codebase (e.g., in agent.py's response streaming and various memory plugins). The custom parser is significantly slower than the standard C-backed json.loads. This optimization ensures we only pay the performance cost of the dirty parser when standard parsing actually fails (JSONDecodeError).
📊 Impact: Expected to reduce parsing overhead by over ~90% for well-formed JSON structures (benchmark shows ~11.69x improvement).
🔬 Measurement: A test script with 10,000 iterations measuring both the old object instantiation/parsing behavior vs the new try/except wrapper demonstrated runtime dropping from ~0.43s to ~0.03s.


PR created automatically by Jules for task 16801808902471274659 started by @thirdeyenation

google-labs-jules bot and others added 9 commits March 29, 2026 08:38
Added explicit ARIA labels to the 'Pause Agent' and 'Nudge' buttons in the chat bottom actions bar to improve accessibility, especially for screen readers and on smaller screens where button text is visually hidden.

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>
…tom-actions-12367060039930692792

🎨 Palette: Add ARIA labels to chat bottom actions
#2)

* 🛡️ Sentinel: [CRITICAL] Fix simpleeval sandbox escape (CVE-2026-32640)

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>

* 🛡️ Sentinel: Address PR review feedback on simpleeval sandbox fix

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>

* 🛡️ Sentinel: Address PR review feedback on simpleeval sandbox fix

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>

* 🛡️ Sentinel: Address PR review feedback on simpleeval sandbox fix

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>

* 🛡️ Sentinel: Address PR review feedback on simpleeval sandbox fix

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
What: Added aria-label and title to the remove attachment <button> in webui/components/chat/attachments/inputPreview.html
Why: The remove button only contained a visual &times; character, meaning screen readers would not announce its purpose properly, nor did it have a hover tooltip for sighted users relying on pointers.
Before/After: N/A - Visually identical.
Accessibility: Screen readers will now announce the button as "Remove attachment" rather than reading "times" or ignoring it.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…rs/files.py (#3)

Extracted regex patterns out of `evaluate_text_conditions`, `process_includes`, `remove_code_fences` and `is_full_json_template` functions in `helpers/files.py` to the module level.
This prevents the regex engine from having to lookup or recompile the regular expressions on every single function call which runs frequently during prompt parsing.

This yields a measurable performance improvement when evaluating templates.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…omization (#5)

Adds a new plugin called 'Cosmetic Committee' that provides users with a dedicated team of specialized agents to assist in making aesthetic changes to the Agent Zero Web UI via chat.

Features:
- **Cosmo**: The user-facing agent who guides the user and offers 3 pre-built themes (Cyberpunk, Minimalist Light, Ocean Breeze).
- **Lead Designer**: Translates the user's intent into explicit, machine-readable CSS instructions.
- **CSS Specialist**: Writes the custom CSS.
- **QA Specialist**: Reviews the CSS for safety, quality, and contrast, preventing destructive UI changes before applying the code.
- **Real-time Updates**: Changes to the UI are broadcasted to the frontend Alpine.js store and applied instantly without requiring a page reload.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit introduces a significant performance optimization to `helpers.extract_tools.json_parse_dirty`.
Before this change, the function always used the custom `DirtyJson.parse_string` parser, which is robust
but computationally expensive for well-formed JSON.
Now, the function attempts to parse the extracted string using the highly-optimized `json.loads` from the
standard library first. It falls back to `DirtyJson.parse_string` only if a `JSONDecodeError` occurs.
This provides a "fast path" for the majority of LLM outputs, which are well-formed JSON, while preserving
the fault-tolerant behavior for edge cases.

A journal entry documenting this codebase-specific performance learning has been added to `.jules/bolt.md`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Added explicit `aria-label` attributes to the icon-only chat navigation buttons in `webui/components/chat/input/progress.html`. This ensures the buttons are fully accessible to screen readers, providing a more robust accessible name than relying on the `title` attribute alone.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This PR introduces a significant performance optimization to the `DirtyJson.parse_string` method. By attempting to parse the input with Python's highly optimized standard library `json.loads()` first, it achieves up to an 11.69x speedup for well-formed JSON strings, while gracefully falling back to the custom parsing logic for "dirty" strings.

This change aligns with existing codebase patterns and drastically speeds up places where `DirtyJson.parse_string()` is used throughout the app (like `agent.py` and memory plugins).

Benchmark Results (10,000 runs):
Old approach: 0.4347s
Optimized approach: 0.0372s
Improvement: 11.69x faster

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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