Skip to content

Self-host: umask-safe upgrade/rollback; show SAM AI usage limit - #3012

Open
simple-agent-manager[bot] wants to merge 8 commits into
mainfrom
sam/self-host-hardening-two-58an37
Open

simple-agent-manager[bot] wants to merge 8 commits into
mainfrom
sam/self-host-hardening-two-58an37

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two self-host hardening fixes. Part 1 affects self-hosting only. Part 2 changes shared code, so hosted SAM also gets it: spending-limit refusals get a clearer label. Real provider overloads are unchanged, and tests prove it.

1. Upgrade and rollback no longer depend on the operator's umask (idea 01M89H1MQHJH432BFT2N43GHJJ). Self-hosting only.

  • On 2026-11-25 an upgrade run under umask 077 checked out 111 tracked files as 0600. The key agent (non-root) got EACCES, and the automatic rollback failed the same way.
  • scripts/selfhost/operator-files.ts:
    • useOperatorUmask() clears every umask bit stricter than 022 (077 → 022; a looser 002 is kept) at the start of upgrade.ts (including --rollback-from), deploy.ts, rebuild.ts and restore.ts. Child git, pnpm and docker steps inherit it.
    • checkoutWithTrackedModes() makes every tracked file world-readable (100755 files also world-executable) and every directory holding one traversable, after every checkout. It only adds bits, so a 0600 file becomes 0644 and a 0664 file is left alone. That covers the upgrade, both automatic rollback branches, manual rollback (upgrade-rollback.ts) and legacy adoption.
    • A file it cannot chmod is reported, not fatal, so the safety-net rollback never stops on it.
  • Private files keep explicit modes at their writers (secret-files.ts, backup-encryption.ts, backup-destination.ts). A test proves they stay 0600/0700 under umask 022 and 000.

2. A spending-limit 429 no longer shows "Provider overloaded · Recoverable" (idea 01M89JXTFHW4W3PQ65GTED6D0K).

  • VM agent (internal/acp/sam_usage_limit.go): when a 429 carries the SAM AI proxy's own refusal message (monthly spending limit or daily token budget), the reason is sam_ai_usage_limit_reached instead of provider_overloaded.
    • Only the adapter's terminal error message is read; wrapper metadata such as URLs and schemas is ignored.
    • ClassifyProviderLimit no longer parks this as a provider plan limit.
  • Shared classifier: a new structural code, "AI usage limit reached". It is not retryable and not diagnosable, and it is matched only from the exact callback code.
  • FailureCard: the "Recoverable" badge and the "send another message to retry" line now show only when the classification is retryable. This also hides them for model-unavailable and unsupported-loopback-auth, where retrying likewise cannot help.
  • Settings > Usage:
    • The subtitle and empty state no longer say "AI Gateway traffic only". Installs without a gateway meter locally.
    • The selected period button and the bars used bg-accent-emphasis, which is not a defined token, so the label was white on nothing. They now use bg-accent.
  • apps/api/tests/unit/routes/ai-proxy-usage-limit-markers.test.ts pins every proxy refusal builder to the Go markers, so wording drift fails CI.
  • The AI usage visual audit had a stale budget mock and was covered by the onboarding dialog. Both are fixed, and the spec leaves the quarantine.

Validation

  • pnpm lint (changed files), selfhost tsc, web/shared typecheck
  • pnpm test: selfhost suite 1327 passed (metadata-proxy.test.ts needs npm ci locally, as on main).
  • Self-host live suite (pnpm selfhost:live-test, real Docker) locally on this branch: 19/19 files, 289 tests (legacy-adoption 12/12 after its fake git learned the mode-repair calls in 01881c5).
  • Go internal/acp and internal/server pass. New shared, web and api tests pass.
  • Guard-deletion checks:
    • Removing the mode repair turns exactly the 7 mode tests red (3 runUpgrade paths, the real-git manual rollback, and 3 real-git checkout tests).
    • Removing useOperatorUmask() from restore.ts turns its entry-point test red (entry points are spawned under umask 077).
    • Removing the Go ClassifyPromptError check turns 6 SAM-limit cases red.
    • Removing the ClassifyProviderLimit guard turns the parking test red.
    • Removing the FailureCard gate turns the usage-limit card test red.
  • N/A for rule 47: no candidate selection changed.

Staging Verification (REQUIRED for all code changes — merge-blocking)

  • Staging deployment green: every deploy step passed. Only the GitHub-runner Health Check step failed (run 45682370388), the known Cloudflare challenge to runners; https://api.sammy.party/health answered 200 from the workspace.
  • Live app verified via Playwright: signed in with the staging smoke token
  • Existing workflows confirmed working
  • New feature/fix verified on staging (see below for what staging cannot reach)
  • Infrastructure verification completed: 2 fresh staging nodes running this branch's VM agent; the self-host box ran 4 real upgrades/rollbacks
  • Mobile and desktop verification notes added for UI changes

Staging Verification Evidence

Self-host box (app.vmtest.sam2.party), all PASS. Encrypted backup was taken first; the run is posted on the channel.

  1. Upgrade main → PR head with a normal umask. The upgrader on main still lacks the fix.
  2. In a umask 077 shell, upgrade the PR head → a test ref that rewrote key-agent/bundle-store.ts. The key agent was rebuilt and is healthy, health 200, and every tracked file is at its git mode.
  3. In a umask 077 shell, run the printed --rollback-from command, starting from the incident state (key-agent/*.ts 0600, directory 0700). It printed "restored git file modes on 13 tracked paths" and "manual rollback completed". The key agent is healthy and health is 200.
  4. With the final code, the modes broken again and the shell at umask 077, upgrade to main. It repaired 14 paths and is healthy.

The box is left on main 428f26206: sealed (gcp-kms), bundle head unchanged, replaceable, git clean, no pending journal. Its temporary SSH access is removed.

Live run finding, fixed here in cb9014856: the box user's umask is 002, and the first repair narrowed 12,581 files from 0664 to 0644. The repair now only adds bits.

Local self-host live suite (pnpm selfhost:live-test, real Docker): 19/19 files, 289 tests.

Spending-limit refusal through the real agent adapter: the opt-in TestLiveClaudeAdapterSAMUsageLimit ran the pinned claude-agent-acp 0.102.0 against a local server returning SAM's exact 429 bodies.

  • The adapter returned Internal error: API Error: Request rejected (429) · <SAM message> with errorKind: rate_limit.
  • All three SAM refusals classify as sam_ai_usage_limit_reached.
  • A provider 429 stays provider_overloaded.
  • That wire shape is now in the always-run unit table.

Staging (hosted):

  • The branch deployed, and two Claude Code chats on fresh nodes running this branch's VM agent completed normally. Hosted behaviour is unchanged for a normal turn; no false classification.
  • Settings > Usage shows "Model calls made through SAM only" and no "AI Gateway" text, at 1280 and 375.
  • Staging cannot produce a SAM spending-limit 429 for the smoke user. With a $0.01 personal cap and $0.059 already spent (exceeded: true), both chats still ran: that user's Claude uses its own connected credential, not the SAM proxy (spend did not move).
  • The refusal path is therefore covered by the real-adapter test above plus the Playwright check of the card in the real chat shell.
  • Cleanup: cap reset to none, both test chats closed, both nodes deleted, lease released.

UI Compliance Checklist (Required for UI changes)

  • Mobile-first layout verified
  • Accessibility checks completed: aria-pressed buttons kept. The badge text is not the only signal; the label carries it.
  • Shared UI components used or exception documented
  • Playwright visual audit run locally at 375x667 and 1280x800 (ai-usage-audit.spec.ts 30/30; new chat failure cases 4/4)
  • Desktop and mobile screenshots for every changed UI surface are posted and linked below
  • Screenshots reviewed; no visual issues

UI Screenshot Evidence

All screenshots below were taken with Playwright (local Vite preview with mocked API data, apps/web/tests/playwright/).

Surface: Settings > Usage period selector and subtitle

  • Desktop evidence: usage light desktop usage dark desktop
  • Mobile evidence: usage light mobile usage dark mobile
  • Mock/stress data used: ai-usage-audit.spec.ts: normal data, long model names, 15 models, 30 days, empty state, API error, and light and dark themes. Selected-button contrast is asserted by computed colours.
  • Screenshot quality review: Reviewed both themes at both viewports. The selected button is readable (green fill, white label), the subtitle wraps cleanly, and there is no overflow or clipping (assertNoOverflow including the clipped-overflow walk). No issues found.

Surface: Project chat failure card (AI usage limit vs provider overload)

  • Desktop evidence: limit desktop overload desktop
  • Mobile evidence: limit mobile overload mobile
  • Mock/stress data used: project-chat-recoverable-error-audit.spec.ts: an active conversation task with sam_ai_usage_limit_reached and, as a control, provider_overloaded, in the real chat shell.
  • Screenshot quality review: Reviewed at both viewports. The limit card reads "AI usage limit reached" with no Recoverable badge. The overload control still shows "Provider overloaded" and Recoverable. No overflow. No issues found.

End-to-End Verification (Required for multi-component changes)

  • Data flow traced (below)
  • Capability test: TestSAMUsageLimitPromptPathReportsTheLimitCode drives finishPromptWithError → broadcast/callback reason. The FailureCard and Playwright tests render that code in the real chat shell.
  • Assumptions verified against code
  • Live: real upgrade/rollback under umask 077 on the self-host box; real pinned Claude adapter against SAM's 429 bodies

Data Flow Trace

  1. The proxy refuses with a 429: ai-proxy-admission.ts / ai-proxy-passthrough-errors.ts, using monthlyCostCapMessage.
  2. The agent adapter turns it into an ACP RequestError.
  3. session_host_prompt.go:finishPromptAttemptWithError calls ClassifyPromptError, which returns sam_ai_usage_limit_reached (from sam_usage_limit.go).
  4. server.go:taskCallbackErrorMessage → task callback → tasks.error_message.
  5. FloatingHeader/FailureCard call classifyFailure, which returns sam-ai-usage-limit.

Untested Gaps

A live spending-limit 429 has not been run through a real VM to the chat card on a deployed installation. Staging's smoke user does not route Claude through the SAM proxy. The box would need the fake upstream enabled, a real node and an OTP sign-in. Each segment is covered instead:

  • the real adapter's error, classified (live adapter test);
  • the reason string passes through the task callback unchanged (no allowlist; taskCallbackErrorMessage);
  • the card in the real chat shell (Playwright, 375/1280).

Post-Mortem (Required for bug fix PRs)

What broke

  1. An upgrade under umask 077 left the key agent's sources 0600. Both the upgrade and its automatic rollback failed, and the shared box was down for about 10 minutes.
  2. A SAM spending-limit refusal was shown as a transient provider overload.

Root cause

  1. git checkout writes files using the process umask, and the upgrade inherited the operator shell's umask.
  2. The VM agent mapped every 429 / errorKind: rate_limit to provider_overloaded, without separating SAM's own limit.

Class of bug

  1. Ambient process state (umask) leaking into build inputs consumed by a different uid.
  2. One signal (HTTP 429) standing in for two conditions with different recovery actions (rule 72).

Why it wasn't caught

All checkout tests used fake runners or ran under a default umask. No 429 test fed SAM's own refusal body.

Process fix included in this PR

Real-git tests under umask 077, a pin test tying the proxy messages to the Go markers, and the usage audit taken off the quarantine.

Post-mortem file

tasks/active/2026-11-25-selfhost-umask-and-spending-limit-label.md

Specialist Review Evidence (Required for agent-authored PRs)

  • All local reviewers completed and findings addressed before merge
  • If any reviewer did NOT complete: needs-human-review label added and merge deferred to human (N/A: all completed)
Reviewer Status Outcome
task-completion-validator ADDRESSED 0 CRITICAL/HIGH. 4 MEDIUM fixed in 08a75f6: checklist ticked; directory modes repaired; real-git manual rollback test; behavioural entry-point test; legacy adoption explicit checkout helper + enumeration test
go-specialist ADDRESSED 0 CRITICAL/HIGH. 2 MEDIUM fixed in 08a75f6: typed 429 evidence required (rate_limit / Codex turn error / API Error: 429 prefix), standalone 429, new controls; LOW: SAM text never parked by the text path
security-auditor ADDRESSED 0 CRITICAL/HIGH/MEDIUM; forcing umask 022 widens no private file (all secret writers use explicit modes). LOW 1-3 fixed in 08a75f6: no chmod through a symlinked parent, per-path errors never abort a rollback, directories covered. LOW 4 (bucket mirror relies on 0700 ancestors) unchanged: defence in depth only
ui-ux-specialist ADDRESSED 0 CRITICAL/HIGH. Fixed: the two other bg-accent-emphasis uses; neutral "session still open" line for non-retryable failures; shorter subtitle and plainer explanation. Dark-theme accent contrast (3.3:1) is the existing design-system token, not this change

CodeRabbit Review Evidence (Required for agent-authored PRs)

  • CodeRabbit requested when the PR was marked ready for review
  • Waited about 15 minutes (or until a skip, rate-limit or quota reply)
  • Outcome recorded

CodeRabbit Notes

Requested at 19:09Z by adding the coderabbit-review label when the PR was marked ready. The trusted request workflow failed at once with HTTP 401: Bad credentials, so the wait ended. That is the same token failure reported on #3009, and no CodeRabbit review arrived.

Exceptions (If any)

  • Scope: none
  • Rationale:
  • Expiration:

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

External References

N/A: no external API changes. Node process.umask and git index modes (git ls-files --stage) are standard behaviour, verified by real-git tests.

Codebase Impact Analysis

scripts/selfhost (upgrade, rollback, deploy, rebuild, restore, legacy adoption), packages/vm-agent/internal/acp (prompt error classification), packages/shared (failure classification), apps/web (FailureCard, Settings > Usage), apps/api tests only.

Documentation & Specs

deploy/selfhost/README.md (umask note) and apps/www/src/content/docs/docs/reference/configuration.md (how a refused call is reported).

Constitution & Risk Check

Principle XI: the umask value is a named constant, and the limit markers are a curated table cross-referenced with the TS source and pinned by a test. Risk: the marker match depends on the proxy wording. The pin test fails CI if it drifts.

🤖 Generated with Claude Code

raphaeltm and others added 2 commits November 25, 2026 18:31
Operator entry points set umask 022 for their children, and every checkout
the upgrade, its rollbacks and legacy adoption make re-applies git's file
modes, so a umask 077 shell cannot leave the key agent's sources 0600.
Private writers keep explicit 0600/0700 modes (tested under umask 000).

Idea 01M89H1MQHJH432BFT2N43GHJJ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 429 from SAM's own AI proxy limit (monthly spending limit or daily token
budget) was reported by the VM agent as provider_overloaded, so the chat
showed "Provider overloaded · Recoverable". The VM agent now reports
sam_ai_usage_limit_reached when the refusal carries the proxy's limit
message, and does not park it as a provider plan limit. The failure card
labels it "AI usage limit reached", not retryable, and hides the
Recoverable badge for non-retryable failures. Real provider overloads are
unchanged (tested).

Settings > Usage: wording no longer claims AI Gateway traffic only, and
the selected period button and bars use the defined bg-accent token
(bg-accent-emphasis does not exist, so the label was invisible). The AI
usage visual audit's stale budget mock and onboarding overlay are fixed
and it leaves the quarantine.

Idea 01M89JXTFHW4W3PQ65GTED6D0K.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codspeed

codspeed Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing sam/self-host-hardening-two-58an37 (71f9042) with main (5b799a9)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

  2. No successful run was found on main (428f262) during the generation of this report, so 5b799a9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

raphaeltm and others added 2 commits November 25, 2026 19:05
…, tighter 429 evidence

- restoreTrackedModes also makes directories holding tracked files
  traversable, never follows a symlinked parent out of the repository,
  and reports (never throws) per-path errors so a rollback cannot stop.
- Entry points are proven by spawning them under umask 077; manual
  rollback is tested with real git under umask 077; legacy adoption
  uses an explicit checkout helper and an enumeration test covers all.
- The VM agent needs typed 429 evidence (Claude rate_limit, a Codex turn
  error, or an API Error: 429 prefix) plus a standalone 429; SAM limit
  text is never parked as a provider reset.
- FailureCard shows a neutral 'session still open' line for
  non-retryable failures; the last two bg-accent-emphasis uses are fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… calls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 25, 2026 19:09
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 25, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T20:07:53.847604Z 71f9042 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

… upgrader

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01881c5016

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +177 to +178
retryable: false,
diagnosable: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep usage-limit failures diagnosable

When a non-conversation task terminates after hitting this limit, setting diagnosable: false makes the failure look like a normal lifecycle ending rather than an actionable failure. apps/api/src/services/inbox/system-errors.ts consequently skips the system-error item and notification, while apps/web/src/lib/chat-session-utils.ts places the failed session in stopped instead of failed; users can therefore miss the task failure entirely. Keep this classification diagnosable while leaving retryable: false.

Useful? React with 👍 / 👎.

Comment on lines +81 to +82
_, codex := data["codexErrorInfo"].(string)
return data["errorKind"] == "rate_limit" || (codex && isSAMUsageLimitText(message)) || apiError429(message)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop retrying recognized SAM limit failures

For a recognized SAM 429, ClassifyProviderLimit now deliberately returns nil, but shouldRetryPromptError only suppresses retries when promptProviderLimit is non-nil. It then falls through to isTransientProviderPromptError, which matches the same rate_limit_error/429 text, so the default configuration still makes two doomed retries after 15 and 30 seconds before reporting this explicitly non-retryable limit. Wire this predicate into the retry guard so a detected SAM limit fails immediately.

Useful? React with 👍 / 👎.

raphaeltm and others added 2 commits November 25, 2026 19:34
Seen live on the box: its user's umask is 002, so tracked files were 0664 and
the exact-mode repair rewrote 12,581 of them to 0644. The repair now adds the
bits everyone needs (read; execute for 100755) and never removes any, so a
0600 file still becomes 0644 and a 0664 file is left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An opt-in test (SAM_LIVE_CLAUDE_ACP) runs claude-agent-acp 0.102.0 against a
local server answering with SAM's exact 429 bodies. All three refusals
classify as sam_ai_usage_limit_reached and a provider 429 stays
provider_overloaded. The adapter's real wire shape ('API Error: Request
rejected (429) · <message>', errorKind rate_limit) is now in the unit table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34d8a6ec82

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +90 to +91
Usage from model calls made through SAM will appear here. Calls with your own API keys
or subscriptions are not tracked here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Correct the claim that own-key calls are untracked

When a user or project API key is used through SAM's passthrough routes, attachUpstreamTokenUsageAccounting still records its token and provider usage, and GET /api/usage/ai merges those records into the totals. The page can therefore display requests made with the user's own key while this empty-state copy says such calls are not tracked; qualify this as calls made directly outside SAM instead.

Useful? React with 👍 / 👎.

- useOperatorUmask clears only the umask bits stricter than 022 (077 -> 022,
  002 stays 002) instead of setting a fixed mask.
- auth_failure.go names its provider prefixes once (hasProviderErrorPrefix).
- The live Claude adapter test moves its setup into a helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71f9042027

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

if (!stat || !(kind === 'file' ? stat.isFile() : stat.isDirectory())) return;
if (want(stat.mode & 0o777) === (stat.mode & 0o777)) return;
if (!inside(path)) throw new Error('outside the repository');
chmodSync(path, want(stat.mode & 0o777));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve special permission bits while repairing modes

When a tracked directory has the setgid bit, such as a shared operator checkout using mode 2700, this repair passes only the lower 0777 bits to chmodSync, so adding traversal access changes it to 0755 and silently removes setgid. Files created by later checkouts then stop inheriting the repository group and may become inaccessible to other operators, contradicting the helper's only-add guarantee; preserve the existing special bits when constructing the new mode.

Useful? React with 👍 / 👎.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions
github-actions Bot requested a deployment to staging November 25, 2026 20:12 Pending

This branch is pending to be deployed

1 pending deployment
staging — 71f90420 Pending Nov 25, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant