Formula for siGit Code, a local coding agent powered by Onde Inference.
Document the credentials clobber trap and the smb CLI deploy path
The v1.1.0 deploy wiped the GitHub App credentials because they had been added with credentials:edit on the server: credentials.yml.enc is git-tracked and the hook's checkout -f replaces it. Both the release skill and the App runbook now say to edit locally and commit the .enc. Also replace the env presence-check advice with plain printenv, since the compound check produced a false positive, and document deploying via the smb CLI (key id_11).
Seto Elkahfi committed
Jul 6, 2026 at 07:27 UTC
6b1b166ffd3c2497eae8abc56f81676b639b8297
2 files changed
+44
-21
.agents/skills/release/SKILL.md
+29
-13
@@ -111,16 +111,23 @@ git diff origin/main --stat -- config/initializers/ # new boot-time requirement
111
ssh smb1-deploy 'sudo -u git bash -lc "printenv | grep -oE \"^SOME_NEW_VAR[A-Z_]*\""'
112
```
113
114
-Notes that save time:
114
+Notes that save time (each learned from a real incident):
115
116
- The `git` user's `~/.profile` is the env source; the post-receive hook
117
starts with `. ~/.profile`, so vars set there do reach `db:prepare`, Puma,
118
- and `bin/jobs`. Rails credentials are the alternative for multi-line
119
- secrets (private keys) — see the runbooks under `docs/`.
120
-- Beware shell false positives when checking remotely: `printenv | grep -c X`
121
- can match `SUDO_COMMAND` (your own command line), and `pgrep -f X` over ssh
122
- matches its own invocation. Anchor patterns (`^X=`) and exclude the
123
- grep/ssh process before trusting a count.
118
+ and `bin/jobs`.
119
+- **Rails credentials must be edited locally and committed, never on the
120
+ server.** `config/credentials.yml.enc` is git-tracked and the deploy does
121
+ `git checkout -f main` — a `credentials:edit` in the server work tree is
122
+ silently wiped by the next deploy (this deleted the GitHub App credentials
123
+ once). Edit with the local `config/master.key`, commit the `.enc`, and let
124
+ the deploy distribute it.
125
+- The only trustworthy remote presence check is `printenv VAR` in the login
126
+ shell: `ssh ... 'sudo -u git bash -lc "printenv GITHUB_WEBHOOK_SECRET
127
+ >/dev/null && echo present || echo absent"'`. Compound `[ -n "$VAR" ]`
128
+ checks through the ssh/sudo/bash quoting layers have produced false
129
+ "set" readings, `printenv | grep -c X` matches `SUDO_COMMAND` (your own
130
+ command line), and `pgrep -f X` over ssh matches its own invocation.
131
132
### Production database state
133
@@ -146,15 +153,24 @@ git push origin main
153
154
## 4. Deploy
155
156
+The operator deploys with the interactive `smb` CLI from the repo root on
157
+`main` — it logs in, detects the Rails app, and pushes with the right key
158
+(`~/.ssh/id_11@smbcloud`), ending in "Deployment complete":
159
+
160
```bash
150
-git push smbcloud main # the bare-repo post-receive hook does the rest
161
+smb
162
```
163
153
-Remember the hook's sharp edges (deployment skill has the full list): no
154
-`set -e`, migration output goes to the pushing terminal — **read the push
155
-output**, it is the only record of `db:prepare`'s success — and `bin/jobs
156
-start` stacks a new Solid Queue supervisor on every deploy unless the hook
157
-has been amended with a `pkill -f solid_queue || true` line first.
164
+A plain `git push smbcloud main` does the same thing but only if that key is
165
+what ssh offers; the `Host api-1.smbcloud.xyz` entry in `~/.ssh/config` is
166
+not configured, so without the smb CLI expect `Permission denied (publickey)`.
167
+
168
+Either way it lands on the bare-repo post-receive hook, which has sharp
169
+edges (deployment skill has the full list): no `set -e`, migration output
170
+goes to the pushing terminal — **read the push output**, it is the only
171
+record of `db:prepare`'s success — and `bin/jobs start` stacks a new Solid
172
+Queue supervisor on every deploy unless the hook has been amended with a
173
+`pkill -f solid_queue || true` line first.
174
175
## 5. Post-deploy verification
176
docs/github-app-reviews.md
+15
-8
@@ -44,9 +44,9 @@ secret (`bin/rails secret | head -c 48`), and **Generate a private key**
44
45
## Configuration
46
47
-Preferred in production: Rails credentials (`bin/rails credentials:edit`),
48
-because the private key is multi-line and prod env vars live in the `git`
49
-user's `~/.profile`, which is single-line only:
47
+Preferred in production: Rails credentials, because the private key is
48
+multi-line and prod env vars live in the `git` user's `~/.profile`, which is
49
+single-line only:
50
51
```yaml
52
github_app:
@@ -58,11 +58,18 @@ github_app:
58
-----END RSA PRIVATE KEY-----
59
```
60
61
-This block is already set in production credentials (verify without booting
62
-the app: `bin/rails runner 'c = Rails.application.credentials.github_app; puts
63
-c.app_id, c.webhook_secret.length'`). When pasting the key, indent every PEM
64
-line to match `private_key: |`; on the server `bin/rails credentials:edit`
65
-needs an editor that waits, e.g. `EDITOR=nano bin/rails credentials:edit`.
61
+**Edit credentials locally and commit — never on the server.**
62
+`config/credentials.yml.enc` is git-tracked, and the deploy hook's
63
+`git checkout -f main` overwrites the server copy, silently deleting any
64
+server-side edit on the next deploy (this happened: the App credentials were
65
+added on the server on 2026-07-05 and wiped by the v1.1.0 deploy the next
66
+day). Run `EDITOR=nano bin/rails credentials:edit` in a local checkout that
67
+has `config/master.key`, paste the block, commit the `.enc`, and deploy.
68
+
69
+When pasting the key, indent every PEM line to match `private_key: |`.
70
+Verify after deploy without booting the app:
71
+`bin/rails runner 'puts GithubAppService.configured?'` on the server — and
72
+expect `POST /github/webhooks` to return 401 (not 503) to an unsigned probe.
73
Note the `webhook_secret` here is separate from `stripe.webhook_secret`; they
74
share a key name but live under different top-level parents.
75