Skip to content

🐛 fix: find default tmux sockets under arbitrary container UIDs - #14795

Closed
thatguywob wants to merge 1 commit into
hivecommons:v5from
thatguywob:fix/14789-tmux-socket
Closed

thatguywob wants to merge 1 commit into
hivecommons:v5from
thatguywob:fix/14789-tmux-socket

Conversation

@thatguywob

Copy link
Copy Markdown
Contributor

Summary

Fix terminal attach on OpenShift and other containers whose runtime UID differs from the dev passwd entry. Search deduplicated default socket candidates in runtime UID, passwd UID (or 1001), then remaining UID order; require the requested session before selecting a socket. Preserve per-agent socket priority and owner-aware su-exec, including for session diagnostics, and honor TMUX_TMPDIR.

Fixes #14789

Testing

  • Not run locally: AGENTS.md requires CI validation for agent-authored changes.
  • Added eight isolated regression cases using UNIX socket fixtures and command stubs, without starting real tmux servers. Covers runtime UID priority, missing sessions, other-owner fallback, absent passwd entries, deduplication, non-socket files, per-agent priority, and diagnostics. Fixtures use a custom TMUX_TMPDIR containing spaces.
  • Wired the regression script into CI and added the required changelog fragment.

— hive: backend=codex


🐝 Hive Agent: contributor | SHA: 8f09b4298

Search the runtime UID, dev passwd UID, and remaining default servers in
order, deduplicating candidates and requiring the requested session.
Share discovery with diagnostics and preserve owner-aware su-exec calls.
Respect TMUX_TMPDIR for both default and per-agent sockets.

Add isolated socket/stub regression coverage wired into CI.

Hive-Run: hivecommons#14789
Hive-Plan: default-tmux-socket-discovery
Hive-Spec: hivecommons#14789#fix
Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

This PR conflicts with v5 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#14803 🐛 dashboard: stream Job pod logs in the terminal for sandbox.runtime job agents same files .github/workflows/v2-ci.yml
src/deploy/ttyd-tmux.sh

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 28, 2026
@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersession sweep found that this PR's claimed issue is already closed by another merged PR.

  • Claimed issue: hive#14789
  • Closing PR: #14791

Decision needed (@hivecommons): #14791 already merged and closed the claimed issue, but this PR touches files the merged PR did not. Recommended: keep open until the extra changes are reviewed, or close as superseded if they are not wanted. Another option: merge anyway.

Files the merged PR did not touch: changelog.d/fixed-14789-terminal-arbitrary-uid.md, src/deploy/test_ttyd_socket_discovery.sh.

This comment is edited in place by the supersession sweep; it is not duplicated.

@hivecommons-hive hivecommons-hive Bot added needs-human stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue sentinel-alert and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor
8f09b42

⚠️ Sentinel alert — maintainer review required

Hive flagged this PR (author @thatguywob, head 8f09b4298490) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 3 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • .github/workflows/v2-ci.yml
    • src/deploy/test_ttyd_socket_discovery.sh
    • src/deploy/ttyd-tmux.sh

Hive added the sentinel-alert label. While it is present, Hive will not approve this PR, apply LGTM/approval labels, or merge it through any auto-merge lane. Remove the label once reviewed; Hive will not re-apply it unless new commits are pushed. Tune paths and behaviors under sentinel in hive.yaml or the dashboard Security tab.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

⚠️ Hold-gate mergeability: this PR has a real conflict with its base

This PR is hold-gated and has fallen behind its base branch. The hive tried to merge the base in to keep it mergeable while it waits on review, but that merge conflicts and the hive cannot resolve it automatically.

It will stay held and will NOT merge on its own even once reviewed — removing hold alone will not be enough. Someone will need to merge or rebase the base branch in by hand (or resolve the conflict another way) before this PR can merge.

@hivecommons-hive hivecommons-hive Bot added stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • arm64 image pull and service startup

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (2 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should decide whether to close this in favour of merged #14791, or have the author rebase it down to the one remaining delta (su-exec for list-sessions on foreign-owned default sockets in the diagnostics path).

Conclusion: the fix this PR makes for #14789 already landed on v5 via #14791, which is why this PR is now CONFLICTING. What survives is a small diagnostics-only improvement; a maintainer should decide whether that is worth a rebase.

What I compared (head 8f09b42 vs. v5 after #14791):

Behaviour #14795 (src/deploy/ttyd-tmux.sh) v5 today
Try tmux-$(id -u)/default before tmux-<dev passwd uid>/default default_socket_candidates, head :39-51 default_socket_candidates, v5 :79-96
Then any tmux-*/default, deduplicated yes yes
Respect TMUX_TMPDIR TMUX_ROOT, head :38 TMUX_SOCKET_ROOT, v5 :45-46
Skip default basenames when listing per-agent sockets yes yes, v5 :55
list-sessions on a default socket owned by a different UID goes through socket_tmux → su-exec owner (head :77-91), so sessions are listed bare tmux -S … list-sessions (v5 :64) — fails silently via `

So the last row is the only semantic difference, and it affects only the error-path hint, not whether attach succeeds (attach already used su-exec for non-owner sockets before either PR). The remaining diff is otherwise a re-implementation of #14791 with a different test file (test_ttyd_socket_discovery.sh, Python-stubbed) alongside the one #14791 added (test_ttyd_default_socket_uid.sh, already wired at v2-ci.yml:1010).

Why this is routed rather than judged: the PR carries sentinel-alert and touches .github/workflows/v2-ci.yml. The workflow change itself is only a new run: bash src/deploy/test_ttyd_socket_discovery.sh step (no permissions, no removed checks), and the author holds role/trusted — stating that for the record; the trust call is yours.

I have not closed or changed anything.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closed as superseded by #14791 by @clubanderson from the Hive dashboard.

Duplicate: #14789 was fixed by #14791 (merged 2026-10-28T01:52Z), which this branch now conflicts with. The UID-ordered socket search here is equivalent in effect; thanks @thatguywob.

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

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. hive/superseded Closed by Hive: a different merged PR already landed this change needs-human needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) sentinel-alert size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act

Projects

None yet

Development

Successfully merging this pull request may close these issues.

terminal attach does not find the default tmux socket under an arbitrary container UID

1 participant