Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] pueue edit does not save changes #580

Open
theutz opened this issue Nov 29, 2024 · 7 comments
Open

[Bug] pueue edit does not save changes #580

theutz opened this issue Nov 29, 2024 · 7 comments
Labels
o: MacOS A MacOS exclusive issue t: Bug

Comments

@theutz
Copy link

theutz commented Nov 29, 2024

Describe the bug

If i use pueue edit 1 to edit the command for task 1, my $EDITOR opens and is filled with the content of the command. But when I save and exit my editor, the command is unchanged.

Steps to reproduce

pueue add -s -- 'while tldr --update; do gum log -t layout -s done code $?; sleep 5; done'
pueue edit 1

In my editor, changed the sleep duration from 5 to 10, then

pueue status

Shows the changes have not been saved. Repeated invocations of the command confirm this, as well as the timestamps from within the command.

Debug logs (if relevant)

No response

Operating system

macOS Sequoia

Pueue version

v3.4.1

Additional context

I've installed pueue via cargo via mise. Not sure if that'd be relevant.

@Nukesor
Copy link
Owner

Nukesor commented Nov 29, 2024

Can you check/share the logs of both the daemon and the client?
You can get them by adding a -vvv after pueue and pueued

Since it's working for me, it's either something related to your setup or to MacOS

@Nukesor Nukesor added t: Bug o: MacOS A MacOS exclusive issue labels Dec 1, 2024
@Nukesor
Copy link
Owner

Nukesor commented Dec 3, 2024

Ping @theutz

@theutz
Copy link
Author

theutz commented Dec 3, 2024

Sorry about the delay! Here you go (with some minor redactions):

output from pueued
16:07:47 [INFO] Parsing config files
16:07:47 [INFO] Checking path: "/Users/*****/Library/Application Support/pueue/pueue.yml"
16:07:47 [INFO] Found config file at: "/Users/*****/Library/Application Support/pueue/pueue.yml"
16:07:47 [INFO] Restoring state
16:07:47 [DEBUG] (1) pueue::daemon::state_helper: State saved at: "/Users/*****/Library/Application Support/pueue/state.json"
16:07:47 [INFO] Using unix socket at: "/Users/*****/Library/Application Support/pueue/pueue_*****.socket"
16:07:58 [DEBUG] (5) pueue_lib::network::protocol: Received message: Status
16:07:58 [DEBUG] (5) pueue_lib::network::protocol: Sending message: StatusResponse(
    State {
        tasks: {},
        groups: {
            "borders": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "cron": Group {
                status: Running,
                parallel_tasks: 0,
            },
            "dark-notify": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "default": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "emacs": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "*****": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "qutebrowser": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "sketchybar": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "skhd": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "yabai": Group {
                status: Running,
                parallel_tasks: 1,
            },
        },
    },
)
16:08:09 [DEBUG] (3) pueue_lib::network::protocol: Received message: Add(
    Task {
        command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        path: "/Users/*****/code/*********/*****",
        envs: "hidden",
        start_immediately: false,
        stashed: true,
        group: "default",
        enqueue_at: None,
        dependencies: [],
        label: None,
        print_task_id: false,
    },
)
16:08:09 [INFO] Didn't find pueue alias file at "/Users/*****/Library/Application Support/pueue/pueue_aliases.yml".
16:08:09 [DEBUG] (3) pueue::daemon::state_helper: State saved at: "/Users/*****/Library/Application Support/pueue/state.json"
16:08:09 [DEBUG] (3) pueue_lib::network::protocol: Sending message: Success(
    "New task added (id 0).",
)
16:08:17 [DEBUG] (5) pueue_lib::network::protocol: Received message: EditRequest(
    0,
)
16:08:17 [DEBUG] (5) pueue_lib::network::protocol: Sending message: EditResponse(
    EditResponseMessage {
        task_id: 0,
        command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        path: "/Users/*****/code/*********/*****",
        label: None,
        priority: 0,
    },
)
16:08:21 [DEBUG] (5) pueue_lib::network::protocol: Received message: Edit(
    EditMessage {
        task_id: 0,
        command: Some(
            "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        ),
        path: None,
        label: None,
        delete_label: false,
        priority: None,
    },
)
16:08:21 [INFO] Didn't find pueue alias file at "/Users/*****/Library/Application Support/pueue/pueue_aliases.yml".
16:08:21 [DEBUG] (5) pueue::daemon::state_helper: State saved at: "/Users/*****/Library/Application Support/pueue/state.json"
16:08:21 [DEBUG] (5) pueue_lib::network::protocol: Sending message: Success(
    "Command has been updated",
)
16:08:32 [DEBUG] (5) pueue_lib::network::protocol: Received message: EditRequest(
    0,
)
16:08:32 [DEBUG] (5) pueue_lib::network::protocol: Sending message: EditResponse(
    EditResponseMessage {
        task_id: 0,
        command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        path: "/Users/*****/code/*********/*****",
        label: None,
        priority: 0,
    },
)
16:08:37 [DEBUG] (5) pueue_lib::network::protocol: Received message: Edit(
    EditMessage {
        task_id: 0,
        command: Some(
            "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        ),
        path: None,
        label: None,
        delete_label: false,
        priority: None,
    },
)
16:08:37 [INFO] Didn't find pueue alias file at "/Users/*****/Library/Application Support/pueue/pueue_aliases.yml".
16:08:37 [DEBUG] (5) pueue::daemon::state_helper: State saved at: "/Users/*****/Library/Application Support/pueue/state.json"
16:08:37 [DEBUG] (5) pueue_lib::network::protocol: Sending message: Success(
    "Command has been updated",
)
16:10:00 [DEBUG] (3) pueue_lib::network::protocol: Received message: Status
16:10:00 [DEBUG] (3) pueue_lib::network::protocol: Sending message: StatusResponse(
    State {
        tasks: {
            0: Task {
                id: 0,
                original_command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
                command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
                path: "/Users/*****/code/*********/*****",
                envs: "hidden",
                group: "default",
                dependencies: [],
                label: None,
                status: Stashed {
                    enqueue_at: None,
                },
                prev_status: Stashed {
                    enqueue_at: None,
                },
                start: None,
                end: None,
                priority: 0,
            },
        },
        groups: {
            "borders": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "cron": Group {
                status: Running,
                parallel_tasks: 0,
            },
            "dark-notify": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "default": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "emacs": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "*****": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "qutebrowser": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "sketchybar": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "skhd": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "yabai": Group {
                status: Running,
                parallel_tasks: 1,
            },
        },
    },
)
output from pueue
19:08:09 [INFO] Parsing config files
19:08:09 [INFO] Checking path: "/Users/*****/Library/Application Support/pueue/pueue.yml"
19:08:09 [INFO] Found config file at: "/Users/*****/Library/Application Support/pueue/pueue.yml"
19:08:09 [DEBUG] (1) pueue_lib::network::protocol: Sending message: Add(
    Task {
        command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        path: "/Users/*****/code/*********/*****",
        envs: "hidden",
        start_immediately: false,
        stashed: true,
        group: "default",
        enqueue_at: None,
        dependencies: [],
        label: None,
        print_task_id: false,
    },
)
19:08:09 [DEBUG] (1) pueue_lib::network::protocol: Received message: Success(
    "New task added (id 0).",
)
New task added (id 0).
19:08:32 [INFO] Parsing config files
19:08:32 [INFO] Checking path: "/Users/*****/Library/Application Support/pueue/pueue.yml"
19:08:32 [INFO] Found config file at: "/Users/*****/Library/Application Support/pueue/pueue.yml"
19:08:32 [DEBUG] (1) pueue_lib::network::protocol: Sending message: EditRequest(
    0,
)
19:08:32 [DEBUG] (1) pueue_lib::network::protocol: Received message: EditResponse(
    EditResponseMessage {
        task_id: 0,
        command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        path: "/Users/*****/code/*********/*****",
        label: None,
        priority: 0,
    },
)
19:08:32 [DEBUG] (1) handlebars::render: Rendering value: Path(Relative(([Named("pueue_command_string")], "pueue_command_string")))
19:08:37 [DEBUG] (1) pueue_lib::network::protocol: Sending message: Edit(
    EditMessage {
        task_id: 0,
        command: Some(
            "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
        ),
        path: None,
        label: None,
        delete_label: false,
        priority: None,
    },
)
19:08:37 [DEBUG] (1) pueue_lib::network::protocol: Received message: Success(
    "Command has been updated",
)
Command has been updated
19:10:00 [INFO] Parsing config files
19:10:00 [INFO] Checking path: "/Users/*****/Library/Application Support/pueue/pueue.yml"
19:10:00 [INFO] Found config file at: "/Users/*****/Library/Application Support/pueue/pueue.yml"
19:10:00 [DEBUG] (1) pueue_lib::network::protocol: Sending message: Status
19:10:00 [DEBUG] (1) pueue_lib::network::protocol: Received message: StatusResponse(
    State {
        tasks: {
            0: Task {
                id: 0,
                original_command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
                command: "while tldr --update; do gum log -t layout -s done code $?; sleep 5; done",
                path: "/Users/*****/code/*********/*****",
                envs: "hidden",
                group: "default",
                dependencies: [],
                label: None,
                status: Stashed {
                    enqueue_at: None,
                },
                prev_status: Stashed {
                    enqueue_at: None,
                },
                start: None,
                end: None,
                priority: 0,
            },
        },
        groups: {
            "borders": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "cron": Group {
                status: Running,
                parallel_tasks: 0,
            },
            "dark-notify": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "default": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "emacs": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "*****": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "qutebrowser": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "sketchybar": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "skhd": Group {
                status: Running,
                parallel_tasks: 1,
            },
            "yabai": Group {
                status: Running,
                parallel_tasks: 1,
            },
        },
    },
)
Group "default" (1 parallel): running
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 Id   Status    Command                                                                    Path                                       Start   End 
══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 0    Stashed   while tldr --update; do gum log -t layout -s done code $?; sleep 5; done   /Users/*****/code/*********/*****               
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@Nukesor
Copy link
Owner

Nukesor commented Dec 3, 2024

Interesting. So the issue is really the client. The communication between the daemon and the client looks exactly as expected.

And the client also doesn't seem to fail to read the data back from disk.
So feels a bit as if your editor doesn't save the changes to disk before existing. I'm not sure if I can do much more debugging from here 😅

At this point I would probably go ahead and add more logging and do some hand-on debugging.

@theutz
Copy link
Author

theutz commented Dec 3, 2024

Yeah, that makes sense. And you're right, if I run EDITOR=nano pueue edit 0, the changes are shown.

Oddly enough, when I run it with EDITOR=vim or EDITOR="nvim --clean", which provides a clean vim config, the problem persists. Very weird.

Thanks for the help, though!

@Nukesor
Copy link
Owner

Nukesor commented Dec 3, 2024

Curious. I'm using vim myself for editing so that really shouldn't be an issue with vim...

Oh. Can you try to save with vim and inspect the file afterwards without exiting vim?

@theutz
Copy link
Author

theutz commented Dec 3, 2024

Excellent idea. And, interestingly enough, the changes do show up in the temporary file if I inspect it directly, yeah. So, the plot thickens... :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
o: MacOS A MacOS exclusive issue t: Bug
Projects
None yet
Development

No branches or pull requests

2 participants