Skip to content

Allow overriding project identifier for hook approvals #761

Closed

Description

@dohzya

Problem

The project identifier used in [projects."..."] for hook approvals is automatically derived from the remote URL. This works well for simple GitHub repos, but creates issues in several scenarios:

1. GitLab nested groups are truncated incorrectly

GitLab supports deeply nested group structures like team/domain/subdomain/project. The current parsing appears to truncate this, resulting in something like team/domain — which means multiple distinct repositories end up sharing the same project identifier.

This causes unexpected behavior: approving hooks for one project silently approves them for another unrelated project.

2. Reusing a repo for a different project

Sometimes a repository is repurposed for a new project (with its own branches). The hook approvals from the previous project shouldn't carry over automatically.

3. Moving a repo changes its identifier

If I move my local clone to a different directory or change the remote URL (e.g., switching from HTTPS to SSH, or migrating to a new GitLab instance), the project identifier changes and all approvals are lost.

4. Declaration order in config matters

With multiple projects, the ordering in ~/.config/worktrunk/config.toml becomes significant in ways that aren't obvious.

Proposed solution

Allow setting an explicit project identifier in the project config (.config/wt.toml):

[project]
id = "my-custom-project-id"

When present, this would override the auto-derived identifier for hook approvals.

Alternatives considered

  • Manually editing the user config to rename the [projects."..."] section — but this is fragile and likely to break when worktrunk re-derives the key.

Activity

  1. max-sixty commented on Jan 20, 2026

    @max-sixty
    Owner

    the glab bug is bad, sorry, I will fix. The glab PR detection was marked experimental, but it's important this part is very robust.


    on the proposal for project.id — I'd be a bit worried that it means that any project can claim to be a project that has an existing id? I realize it's not likely but — similarly to how the glab bug is bad — we should be really robust here

    are folks really changing remotes that often?

    we have wt hook approvals clear & wt hook approvals add so it's fairly quick to clear & add approvals...

  2. max-sixty commented on Jan 20, 2026

    @max-sixty
    Owner

    (glab nesting fixed in #768)

  3. dohzya commented on Jan 21, 2026

    @dohzya
    Author

    Ok, I'm starting to understand your approach. I tend to think in terms of a generic ~/ config combined with project-specific ./ configs, but yeah, local config files are definitely harder to manage with worktrees (been there 🙄).

    Personally, I like having fine-grained control over configuration while still having sensible defaults—hence my suggestion to allow customizing the id.

    But honestly, now that the GitLab id detection is fixed (tested it and it works great, thanks!) the rest is mostly a matter of taste, so I'm all good 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions