I REALLY wish there was a cleaner way to get this ...
# proj-agent
n
I REALLY wish there was a cleaner way to get this but.... it might be nice if OH stored a map of this someplace when it was collecting repos.. but ¯\_(ツ)_/¯
p
what are you trying to achieve? for multi-repo development toil, addressing what I think you're experiencing here, I built this: https://gitlab.com/deposition.cloud/apps/relay/cli alpha level, use at your own risk 😄
my thinking was "portable dotfiles for repos" so I can hand over "relay" to OpenHands, and viceversa
> a cleaner way?
Copy code
# This is a sample configuration file for developer experience (DX) checks
# and for users to reference. It does not require real credentials.
providers:
  example_gitlab:
    type: gitlab
    token_env: "DUMMY_TOKEN"
    url: "https://gitlab.com"
    patterns:
      - "gitlab-org/gitaly"
      - "example/group/project-two"
  example_github:
    type: github # NOTE: This provider is not yet implemented.
    token_env: "DUMMY_TOKEN"
    patterns:
      - "example-org/repo-*"
https://gitlab.com/deposition.cloud/apps/relay/cli/-/blob/main/examples/relay.yaml?ref_type=heads
n
Copy code
# ------------------------------------------------------------
# gitlab_project_id  – return the GitLab project ID.
#
#   Usage examples:
#
#   # 1️⃣ Use environment vars (no argument)
#   GITLAB_URL=https://gitlab.wolfspyre.io \
#   GITLAB_GROUP=mirrored_repos \
#   GITLAB_REPO=ansible-role-collectd \
#   gitlab_project_id
#
#   # 2️⃣ Pass the full project path as argument (host taken from repo)
#   gitlab_project_id "mirrored_repos/ansible-role-collectd"
#
#   # 3️⃣ Let it auto‑detect everything from .git/config
#   gitlab_project_id
#
#   Returns: numeric project ID (e.g. 79).  Errors are printed to stderr.
# ------------------------------------------------------------
gitlab_project_id() {
    # -----------------------------------------------------------------
    # 1️⃣ Token handling – optional, taken from env vars if present.
    # -----------------------------------------------------------------
    local token="${GITLAB_TOKEN:-${PRIVATE_TOKEN}}"

    # -----------------------------------------------------------------
    # 2️⃣ Determine the base GitLab URL (host + scheme).
    # -----------------------------------------------------------------
    #   * If GITLAB_URL is set, use it directly.
    #   * Otherwise, extract host from the remote URL of the repo.
    local base_url
    if [[ -n "$GITLAB_URL" ]]; then
        # Strip any trailing slash – we'll add our own later.
        base_url="${GITLAB_URL%/}"
    else
        # Get remote URL (prefer git config, fallback to .git/config)
        local remote=$(git config --get remote.origin.url 2>/dev/null ||
                      awk '/url =/ {print $3}' .git/config | head -n1)

        if [[ -z "$remote" ]]; then
            >&2 echo "Error: No remote URL found and GITLAB_URL not set."
            return 1
        fi

        # Strip credentials & protocol, keep only host part.
        base_url=$(printf '%s\n' "$remote" |
                   sed -E 's|^[^@]*@||; s|^[a-z]+://||' |
                   awk -F/ '{print $1}')
        base_url="https://${base_url}"
    fi

    # -----------------------------------------------------------------
    # 3️⃣ Determine the project path (group/subgroup/.../project).
    # -----------------------------------------------------------------
    local raw_path
    if [[ -n "$1" ]]; then               # argument supplied
        raw_path="$1"
    elif [[ -n "$GITLAB_GROUP" && -n "$GITLAB_REPO" ]]; then
        raw_path="${GITLAB_GROUP}/${GITLAB_REPO}"
    else
        # Derive from the remote URL (same logic as original one‑liner)
        local remote=$(git config --get remote.origin.url 2>/dev/null ||
                      awk '/url =/ {print $3}' .git/config | head -n1)

        # Strip credentials & protocol.
        remote=$(printf '%s\n' "$remote" |
                sed -E 's|^[^@]*@||; s|^[a-z]+://||')

        # Split host / path, drop trailing ".git", keep everything after host.
        raw_path=$(awk -F/ '
            {
                host=$1;
                path=substr($0,index($0,$2));
                sub(/\.git$/,"",path);
                print path;
            }' <<<"$remote")
    fi

    if [[ -z "$raw_path" ]]; then
        >&2 echo "Error: Could not determine project path."
        return 1
    fi

    # -----------------------------------------------------------------
    # 4️⃣ Encode slashes (%2F) – GitLab API expects this.
    # -----------------------------------------------------------------
    local encoded_path
    encoded_path=$(printf '%s' "$raw_path" | sed 's#/#%2F#g')

    # -----------------------------------------------------------------
    # 5️⃣ Build the full API URL.
    # -----------------------------------------------------------------
    local api_url="${base_url}/api/v4/projects/${encoded_path}"

    # -----------------------------------------------------------------
    # 6️⃣ Perform the request (with token if we have one).
    # -----------------------------------------------------------------
    local response
    if [[ -n "$token" ]]; then
        response=$(curl -sSf -H "PRIVATE-TOKEN:$token" "$api_url")
    else
        response=$(curl -sSf "$api_url")
    fi

    if [[ $? -ne 0 ]]; then
        >&2 echo "Error: HTTP request failed (check URL / token)."
        return 1
    fi

    # -----------------------------------------------------------------
    # 7️⃣ Extract the numeric ID (using jq if available, else a simple grep).
    # -----------------------------------------------------------------
    local id
    if command -v jq >/dev/null 2>&1; then
        id=$(printf '%s\n' "$response" | jq -r '.id')
    else
        id=$(printf '%s\n' "$response" |
            grep -o '"id":[0-9]*' | cut -d':' -f2)
    fi

    if [[ -z "$id" || "$id" == "null" ]]; then
        >&2 echo "Error: Could not extract project ID from response."
        return 1
    fi

    # -----------------------------------------------------------------
    # 8️⃣ Output the ID.
    # -----------------------------------------------------------------
    printf '%s\n' "$id"
}
closer
e
Was just going to ask a question about how folks are handling multi-repo tasks and saw this thread …. Would be interesting to improve OH in this direction.
n
its kinda a mess atm
I think to achieve it we need some metaprocessing .... not just 'agent do thing'
RE: what I'm attempting to achieve: if I have a (gitlab) project cloned, I want to have saved someplace 'what is the gitlab project id for this?' and ideally, I'd like some mechanism of caching ... durable values,.... like ... in gitlab, a groupid / projectid don't change (afaik?) it's LIKELY safe to store them as metadata associated with a host/group/subgroup/sub-subgroup/sub-sub-sub-group/project
p
I think that's correct, GitLab project and group ids remain the same when you move a project/group from a group to another but why do you need the IDs in the first place? Is that a human-agent need or a specific-to-your-project situation? in my use-case, I only needed the code repos be downloaded consistently across environments, so I default to the organization structure in gitlab, with the option to override locally, for the human; which appears to be a git provider-agnostic need (no IDs needed)
n
so it's a stepping-stone component ... I'm trying to glean the projectID such that I can have part of the setup script put the task_list inside a project-scoped private snippet
I've run into a few wobbles ... like A) the task_list gets lost B) cotext window gets super convoluted from procedures to accomplish $thing C) the effort taken to synchronize the task-list from the last session exceeds the benefit gleaned from having the task list in the first place
so... if I can make it easy to set the stage to 'run setup.sh which checks to see if $projectID has a task_list snippet, and if so, synchronizes task_list with the items... then I can have 'big-picture-planning' agent conversation, which updates the task_list snippet... and then focused -do the thing- agent chat which works on one bit of stuff....
I'm not 100% sure this is even a good idea tho 😉 so ... trying to see if it works or if it's one of those .... well.... I THOUGHT it might have worked well ....
but.... this does now work:
Copy code
root@sandbox:/openhands/code# cd /workspace/org_openhands_wpl_synthetic/
root@sandbox:/workspace/org_openhands_wpl_synthetic# divineGitlabProjectID
5171
which is kinda neat
p
you want two agents, one updating the task list keeping focused on the big picture, the other executing tasks?
n
well IDEALLY no.... IDEALLY I'd be able to stay in the same stream and have things work...
but the agent tends to lose its marbles on a semi-regular basis
so I end up having to pivot to a new conversation
p
what kind of guidance do you give it?
n
prolly somewhere between way too much and way too little
🙂
p
I did try a planner and doer at some point, but they were editing the same file; have since just move planning to manually Gemini (large context helps me)
n
there's stuff like 'push your code before filing an MR ... lint your code before you push your code.
it does neither... says 'ok jobs done' (uncomitted code sits in project in sandbox) 'MR has been pushed and ci passed'
p
so I use Gemini, which can empathise with OpenHands (it knows it's a bot; has analyzed its failure modes) to plan things for it
n
uh.... no.... did you lint and push your code? pushes without linting
JOBS DONE
uh.... no....
p
https://pre-commit.com/ for that, works neat
it tries to git commit, then realizes the tests don't pass; then it tries to delete tests 🤦
n
totes .... this is more an exemplar of the reasoning I thought that perhaps having two contexts one for 'lets plan our the work' and one for 'you are workiong on issue _ ..
while ALSO sharing the bigger picture 'here is where we are trying to go in the long run'
because otherwise there's a propensity to draw a straight line from A to Z completely overshooting M which was a prerequisite step. JOBS DONE
p
n
looks
p
YMMV (you probably have different design principles) https://gitlab.com/deposition.cloud/apps/agents/bigbang/-/blob/main/agents/sovereign-architect.md?ref_type=heads then I adapt this 9 invariants framework for whatever project I'm on; so it sticks to its ideals more
n
yer smart
thats slick
very logic
much awesome
(nice stuff, sir)
p
gpt-5 thanks you
n
that hussy
😛
p
I don't know, it refuses to accept some of my ideas though
so it can get annoying, lol
n
you started in on bigfoot again didnt you
I think a large portion of what's going on is context is getting blown
I think OH is feeding the model a LOT of repetitive stuff.
p
I find that with the sovereign system prompt it role reverses; instead of it justifying the actions, it refuses, which forces me to justify my actions; double edged sword I suppose
n
but I've not yet set up somethin to observe, because I'm trying to get to the point that things mostly work and I understand them.... so I can start mddling with stuff
and I've also started running into situations where there's lots of hung processes ... an I'm not quite sure whyt
I'm assuming it's somethin I've done
p
it's probably something everybody's done, and it merely learned from observing our collective behaviour
n
I mean the humg procs .... there's often a bunch of half-run processes that didn't term cleanly for whatever reason
p
get to the point that things mostly work
I can't visualize that without a goal maybe you can try this approach: https://en.wikipedia.org/wiki/Backcasting
n
which causes the runtime to choke a bit ... easy solution is to stop/start the runtime which kills micromanba and all the hung procs die
but that can make things weird coz context gets funny on restarts
so trying to fix my own problems before asking anyone else why I'm ledumb.
or at least narrow them down to a cause
it noworky
aint so helpful
p
so ideally you would have locally self-hosted OH do what/why exactly?
n
I want to be able to scope out work and have it accomplish said work for me.... and tell me when it needs help or guidance or additional information .... whic ... much of the pieces are there ... and it's starting to take shape... half of the problem is me figuraing out how to use it correctly.... and half of the problem is understanding where its strong and where its not
p
like a WBS?
or a PRD?
n
well ... figuring out what level of detail it needs from me .... sometimes I give it too much detail ... sometimes not enough ...
I'm assuming at least half of this is my fault
p
that's funny, I never thought of it that way I just start high level pie-in-the-sky, and go down until it starts doing something useful
but more often than not, it Gemini at least, is able to do some serious out of the box thinking, I didn't even envision
n
its also just .... I'm learning how to use the tools and how they work
yea I like the gemini models for conversational stuff ...
p
I understand the play/FAFO approach, I find it works better (as in, I get less frustrated) when I work on something that I co-define with the thing
n
right
that's why trying to leverage the task_list ... coz aligning the work collaboratively seems to bear fruit
so I was trying to lean into that
p
| out of the box thinking like, here - it figured out that some people won't like some activities because of the tag; completely missed that possibility myself (planning my trip, leaving Friday; so OpenHands and Gemini built up a website)
n
smart 🙂
p
I started off with OpenHands (gpt-5 Azure), but then gravitated to Gemini (again, context)
n
looks like yer gonna have a great time!
or at least ... has lots of potential for fun and adventure
excited for ya
p
can't wait 🙂, thx, bucket list kind of trip
n
nod you def deserve it.
p
I don't know how to reconcile the small step-by-step approach of SWE-agents with the huge Gemini context it might be that they're on different Pareto frontier regions, and don't mix
n
yea I dunno either ... but .... I'll continue bruising forehead til I succeed or give up
p
I guess we keep pushing both to the limit, see when cracks show up; Gemini failed at refactoring the 50+ activities; I bet OH would have failed earlier
n
either way, I'm learning stuff ...an making stuff...
so .... can't be THAT terrible
p
e.g.: a 50 item task list, lol
n
51) unfuck task list
😄 1