Skip to content

Conversation

@mateoCuervo
Copy link
Contributor

@mateoCuervo mateoCuervo commented Oct 31, 2025

Checklist


Note

Introduces POST /computer/cursor to hide/show the cursor via unclutter, updates OpenAPI and generated client/server code, adds runtime dependency and docs for local testing.

  • API/Backend:
    • New endpoint POST /computer/cursor with SetCursorRequest { hidden: boolean } to hide/show the cursor.
    • Implements SetCursor in server/cmd/api/api/computer.go (kills existing unclutter, optionally starts new with DISPLAY, idle=0, large jitter).
    • Updates generated OAPI code: models, client methods, server handlers, routing, and response parsers; embeds updated swagger.
  • Images:
    • Adds unclutter to runtime packages in images/chromium-headful/Dockerfile.
    • Minor build script: logs image index/name in build-unikernel.sh.
  • Docs:
    • Adds images/README.md with local testing steps and example curl for the new endpoint.

Written by Cursor Bugbot for commit 51ef3a0. This will update automatically on new commits. Configure here.

@mesa-dot-dev
Copy link

mesa-dot-dev bot commented Oct 31, 2025

Mesa Description

Checklist

This PR introduces a new API endpoint to programmatically toggle the visibility of the cursor in the remote browser.

Summary of Changes

  • New API Endpoint: Added POST /computer/cursor to show or hide the cursor.
    • The implementation in server/cmd/api/api/computer.go uses the unclutter utility to manage cursor visibility.
    • OpenAPI specs and the generated Go client in server/lib/oapi/oapi.go have been updated accordingly.
  • Docker Image: The unclutter package is now installed in the chromium-headful Docker image to support this functionality.
  • Documentation & Tooling:
    • Added a README.md in images/chromium-headful/ with instructions for testing the new endpoint.
    • The unikernel build script was updated to print the image name during packaging for better visibility.

Description generated by Mesa. Update settings

// If hidden is true, start unclutter with the specified parameters
if body.Hidden {
unclutterCmd := exec.CommandContext(ctx, "unclutter", "-idle", "0", "-jitter", "9000000")
unclutterCmd.Env = append(os.Environ(), "DISPLAY=:1")
Copy link

Choose a reason for hiding this comment

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

Bug: Bug

The SetCursor function hard-codes the DISPLAY environment variable to :1 for the unclutter command. This is inconsistent with other functions in the file, such as TakeScreenshot, which dynamically resolve the display using s.resolveDisplayFromEnv(). This could cause unclutter to fail or target the wrong display if the system's display configuration is not :1.

Fix in Cursor Fix in Web

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of a0dca70...01c20fd

Analysis

  1. Root privilege usage for cursor management introduces potential security risks - the system is running unclutter with root privileges (UID/GID 0), which could become a security issue if input validation is insufficient or if the command execution isn't properly isolated.

  2. Platform dependency on Linux-specific unclutter utility creates a portability limitation that may affect cross-platform compatibility and could require alternative implementations for other operating systems.

  3. System call approach for cursor management introduces a shell command dependency instead of using more direct APIs, which could be fragile if the underlying utility changes behavior across versions.

  4. Process lifecycle management adds complexity - the solution needs to carefully track and clean up external processes, which introduces potential failure modes if processes aren't properly terminated.

Tip

Help

Configure your agents

Mesa Docs

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

4 files reviewed | 0 comments | Edit Agent Settings

return oapi.SetCursor500JSONResponse{InternalErrorJSONResponse: oapi.InternalErrorJSONResponse{
Message: "failed to start unclutter"},
}, nil
}
Copy link

Choose a reason for hiding this comment

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

Bug: Inconsistent Display Handling Causes Unclutter Failures

The SetCursor function hardcodes DISPLAY=:1 for unclutter, which is inconsistent with other display resolution methods and may cause cursor hiding to fail. The unclutter process is also started without being waited on, potentially creating zombie processes. Additionally, pkill's error handling broadly interprets exit code 1 as 'no processes found,' which could mask other failures.

Fix in Cursor Fix in Web

IdentityFile ~/.ssh/id_ed25519 # confirm this is same path
Port 22
```
- TODO Sayan did something on his side confirm with him this step
Copy link
Contributor Author

@mateoCuervo mateoCuervo Nov 5, 2025

Choose a reason for hiding this comment

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

@Sayan- can you enumerate the steps you did on your side. For docu completeness. Trying to reduce friction for future devs trying to test kernel-images locally

Copy link
Contributor

Choose a reason for hiding this comment

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

since this is public repo we should remove instructions for internal dev please!

Copy link
Contributor

Choose a reason for hiding this comment

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

still needs to be addressed!

Copy link
Contributor

@Sayan- Sayan- left a comment

Choose a reason for hiding this comment

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

overall looks good. I agree with bugbot + pending merge conflicts!

IdentityFile ~/.ssh/id_ed25519 # confirm this is same path
Port 22
```
- TODO Sayan did something on his side confirm with him this step
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is public repo we should remove instructions for internal dev please!

// If hidden is true, start unclutter with the specified parameters
if body.Hidden {
unclutterCmd := exec.CommandContext(ctx, "unclutter", "-idle", "0", "-jitter", "9000000")
unclutterCmd.Env = append(os.Environ(), "DISPLAY=:1")
Copy link
Contributor

Choose a reason for hiding this comment

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

@mateoCuervo mateoCuervo force-pushed the mateo/feat/toggle-cursor branch from bcf2f1c to 21100e0 Compare November 6, 2025 16:19
-H 'Authorization: Bearer <JWT-AUTH-TOKEN>' \
-H 'Content-Type: application/json' \
-d "{\"hidden\": true}"
``` No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Bug: Hide Internal Dev Instructions from Public Readme (Bugbot Rules)

The README contains internal development instructions including internal infrastructure details (IP address 3.91.184.17, hostnames, and internal endpoints). According to the PR discussion, "@Sayan-: since this is public repo we should remove instructions for internal dev please!", these internal instructions should not be in a public repository as they expose internal infrastructure information.

Fix in Cursor Fix in Web

Copy link
Contributor

Choose a reason for hiding this comment

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

== this should be removed!

@mateoCuervo mateoCuervo force-pushed the mateo/feat/toggle-cursor branch from 21100e0 to a6101c4 Compare November 6, 2025 16:20
Copy link
Contributor

@Sayan- Sayan- left a comment

Choose a reason for hiding this comment

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

api changes look great! please clean up the readme and we'll be good to go!

-H 'Authorization: Bearer <JWT-AUTH-TOKEN>' \
-H 'Content-Type: application/json' \
-d "{\"hidden\": true}"
``` No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

== this should be removed!

IdentityFile ~/.ssh/id_ed25519 # confirm this is same path
Port 22
```
- TODO Sayan did something on his side confirm with him this step
Copy link
Contributor

Choose a reason for hiding this comment

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

still needs to be addressed!

@mateoCuervo mateoCuervo merged commit 18771b2 into main Nov 6, 2025
8 of 9 checks passed
@mateoCuervo mateoCuervo deleted the mateo/feat/toggle-cursor branch November 6, 2025 20:01
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.

3 participants