Skip to content

Commit 3e9849b

Browse files
v0.6.75: scheduler claim-budget drain, helm chart hardening, mothership md polish
v0.6.75: scheduler claim-budget drain, helm chart hardening, mothership md polish
2 parents 6aeb981 + 05892f7 commit 3e9849b

54 files changed

Lines changed: 3296 additions & 1030 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/sim/app/api/schedules/execute/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export const dynamic = 'force-dynamic'
2121
export const maxDuration = 3600
2222

2323
const logger = createLogger('ScheduledExecuteAPI')
24-
const MAX_CRON_CLAIMS = 20
25-
const RESERVED_WORKFLOW_CLAIMS = 10
24+
const MAX_CRON_CLAIMS = 200
25+
const RESERVED_WORKFLOW_CLAIMS = 100
2626
const RESERVED_JOB_CLAIMS = MAX_CRON_CLAIMS - RESERVED_WORKFLOW_CLAIMS
2727
const STALE_SCHEDULE_CLAIM_MS = getMaxExecutionTimeout()
2828

apps/sim/app/chat/components/message/components/markdown-renderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const COMPONENTS = {
115115
),
116116

117117
blockquote: ({ children }: React.HTMLAttributes<HTMLQuoteElement>) => (
118-
<blockquote className='my-4 border-gray-300 border-l-4 py-1 pl-4 font-sans text-gray-700 italic dark:border-gray-600 dark:text-gray-300'>
118+
<blockquote className='my-4 break-words border-[var(--divider)] border-l-2 pl-4 font-sans text-[var(--text-primary)] italic [&>p]:my-2 [&>p:first-child]:mt-0 [&>p:last-child]:mb-0'>
119119
{children}
120120
</blockquote>
121121
),

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ function CalloutBlock({ type, children }: { type: string; children?: React.React
263263
const config = CALLOUT_CONFIG[type]
264264
if (!config) {
265265
return (
266-
<blockquote className='my-4 break-words border-[var(--border-1)] border-l-4 py-1 pl-4 text-[var(--text-tertiary)] italic'>
266+
<blockquote className='my-4 break-words border-[var(--divider)] border-l-2 pl-4 text-[var(--text-primary)] italic [&>p]:my-2 [&>p:first-child]:mt-0 [&>p:last-child]:mb-0'>
267267
{children}
268268
</blockquote>
269269
)
@@ -605,7 +605,7 @@ const STATIC_MARKDOWN_COMPONENTS = {
605605
return <CalloutBlock type={calloutType}>{children}</CalloutBlock>
606606
}
607607
return (
608-
<blockquote className='my-4 break-words border-[var(--border-1)] border-l-4 py-1 pl-4 text-[var(--text-tertiary)] italic'>
608+
<blockquote className='my-4 break-words border-[var(--divider)] border-l-2 pl-4 text-[var(--text-primary)] italic [&>p]:my-2 [&>p:first-child]:mt-0 [&>p:last-child]:mb-0'>
609609
{children}
610610
</blockquote>
611611
)

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,36 @@ const MARKDOWN_COMPONENTS = {
222222
</code>
223223
)
224224
},
225+
blockquote({ children }: { children?: React.ReactNode }) {
226+
return (
227+
<blockquote className='my-4 break-words border-[var(--divider)] border-l-2 pl-4 text-[var(--text-primary)] italic [&>p]:my-2 [&>p:first-child]:mt-0 [&>p:last-child]:mb-0'>
228+
{children}
229+
</blockquote>
230+
)
231+
},
225232
input({ type, checked }: { type?: string; checked?: boolean }) {
226233
if (type === 'checkbox') {
227234
return <Checkbox checked={checked || false} disabled size='sm' className='mt-1.5 shrink-0' />
228235
}
229236
return <input type={type} checked={checked} readOnly />
230237
},
238+
em({ children }: { children?: React.ReactNode }) {
239+
return <em className='text-[var(--text-primary)] italic'>{children}</em>
240+
},
241+
del({ children }: { children?: React.ReactNode }) {
242+
return <del className='text-[var(--text-tertiary)] line-through'>{children}</del>
243+
},
244+
img({ src, alt }: ComponentPropsWithoutRef<'img'>) {
245+
if (typeof src !== 'string' || !src) return null
246+
return (
247+
<img
248+
src={src}
249+
alt={alt ?? ''}
250+
loading='lazy'
251+
className='my-4 h-auto max-w-full rounded-lg border border-[var(--divider)]'
252+
/>
253+
)
254+
},
231255
}
232256

233257
interface ChatContentProps {

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ const NOTE_COMPONENTS = {
430430
<em className='break-words text-[var(--text-tertiary)]'>{children}</em>
431431
),
432432
blockquote: ({ children }: { children?: React.ReactNode }) => (
433-
<blockquote className='my-4 break-words border-[var(--border-1)] border-l-4 py-1 pl-4 text-[var(--text-tertiary)] italic'>
433+
<blockquote className='my-4 break-words border-[var(--divider)] border-l-2 pl-4 text-[var(--text-primary)] italic [&>p]:my-2 [&>p:first-child]:mt-0 [&>p:last-child]:mb-0'>
434434
{children}
435435
</blockquote>
436436
),
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
name: sim-helm
3+
description: Install, upgrade, and operate the Sim Helm chart on Kubernetes. Covers install path selection (inline / existingSecret / External Secrets Operator), required secret generation, the values.yaml mental model (env vs envDefaults vs Secret), and common failure triage. Invoke when a user asks about deploying Sim to a cluster, authoring a Sim values.yaml, debugging a Sim pod that won't start, upgrading a Sim release, or wiring Sim into a secret manager.
4+
license: Apache-2.0
5+
---
6+
7+
# Sim Helm Chart — Operations Skill
8+
9+
This skill helps an agent deploy and operate the **Sim** Helm chart at `helm/sim/` in the [simstudioai/sim](https://github.com/simstudioai/sim) repository. Use it when the user is installing, upgrading, troubleshooting, or authoring values for the Sim chart.
10+
11+
The skill is **diagnostic-first**: capture context, classify the situation, load only the references that apply, then act. Do not dump the README at the user. Do not invent values that are not in their current state.
12+
13+
---
14+
15+
## Workflow — follow in order
16+
17+
### 1. Capture context
18+
19+
Before recommending anything, ask (or infer from the conversation) all of these. **Never skip this step.** A wrong assumption here corrupts every downstream step.
20+
21+
| Question | Why it matters |
22+
|---|---|
23+
| Cluster: EKS / GKE / AKS / OpenShift / kind / other? | Storage class, ingress class, identity provider differ |
24+
| Secret strategy: inline `--set`, pre-existing K8s Secret, or External Secrets Operator (ESO)? | The chart has three distinct code paths |
25+
| Postgres: chart-bundled, or external (RDS / Cloud SQL / Azure DB)? | Different value blocks (`postgresql.*` vs `externalDatabase.*`) |
26+
| Public-facing? Ingress class? TLS? | `ingress.enabled`, `ingress.className`, cert-manager wiring |
27+
| HA? (target replicas) | Drives `autoscaling.enabled`, `app.replicaCount`, PDB activation |
28+
| Existing values.yaml the user is editing? | Always read it before proposing a diff — never write blind |
29+
30+
If the user has a `values.yaml`, read it. If they don't, ask before writing one.
31+
32+
### 2. Diagnose
33+
34+
Map the user's request to one of these categories and load the matching reference(s):
35+
36+
| Situation | Reference |
37+
|---|---|
38+
| User wants to install for the first time | `references/install-paths.md` then `references/secrets.md` |
39+
| User needs to generate the required secrets | `references/secrets.md` |
40+
| User asks "what does this value do" / wants to author values.yaml | `references/values-model.md` |
41+
| Pod won't start, error message, `CrashLoopBackOff`, image pull error, ingress not routing | `references/troubleshooting.md` |
42+
| User asks about ESO / Vault / AWS Secrets Manager / Azure Key Vault / GCP Secret Manager | `references/install-paths.md` (ESO section) |
43+
| User asks "is X production-ready" / autoscaling / network policy / security context | Read the README's "Production checklist" section directly — no separate reference |
44+
45+
Load **only** what the situation requires. Loading every reference burns tokens and produces vague answers.
46+
47+
### 3. Propose
48+
49+
When proposing values changes:
50+
51+
- Show the **minimal diff** against the user's current values.yaml. Don't rewrite the file.
52+
- Name the **risk** (e.g., "this puts the secret in `helm get values` output — fine for dev, not for prod").
53+
- Name the **rollback** (e.g., "if this breaks, `helm rollback sim 1` reverts").
54+
- Cite the canonical source (`helm/sim/values.yaml` line numbers, README section, or this skill's reference file).
55+
56+
### 4. Validate before applying
57+
58+
Always run these before telling the user to `helm install` / `helm upgrade`:
59+
60+
```bash
61+
# Schema + value validation
62+
helm lint helm/sim --values <user-values>.yaml
63+
64+
# Render full manifest set to catch template errors
65+
helm template sim helm/sim --values <user-values>.yaml > /tmp/render.yaml
66+
67+
# For upgrades, render against the live release first
68+
helm upgrade --dry-run sim helm/sim --values <user-values>.yaml
69+
```
70+
71+
If lint or template fails, fix the values — do not work around chart validation. The chart's `fail` statements exist to catch misconfigurations that would otherwise surface as `CrashLoopBackOff` at runtime.
72+
73+
### 5. Deliver
74+
75+
Every recommendation should include:
76+
77+
- The exact command(s) to run
78+
- A one-line summary of what will change
79+
- The success signal (e.g., "`kubectl rollout status deploy/sim-app` returns Ready")
80+
- The rollback command if something breaks
81+
82+
---
83+
84+
## Quick reference — the three secret modes
85+
86+
| Mode | When | Code path |
87+
|---|---|---|
88+
| **Inline (`--set`)** | Dev / kind / dry-run only. Values leak into `helm get values`. | `app.env.<KEY>: "..."` |
89+
| **Pre-existing Secret** | GitOps with Sealed Secrets / SOPS, or hand-managed Secrets. Chart references a Secret you create. | `app.secrets.existingSecret.enabled: true` + `.name` |
90+
| **External Secrets Operator (recommended for prod)** | Vault, AWS SM, Azure KV, GCP SM. Chart renders an `ExternalSecret` that ESO syncs. | `externalSecrets.enabled: true` + `secretStoreRef` + `remoteRefs.app.<KEY>` |
91+
92+
These modes are **mutually exclusive** for the app Secret. ESO takes precedence over inline. `existingSecret` takes precedence over inline. The chart **fails template rendering** when ESO is enabled and a required key (`BETTER_AUTH_SECRET`, `ENCRYPTION_KEY`, `INTERNAL_API_SECRET`, plus `CRON_SECRET` when cronjobs are enabled) is neither in `app.env` nor mapped in `remoteRefs.app` — see `references/install-paths.md`.
93+
94+
---
95+
96+
## Quick reference — the four required secrets
97+
98+
| Key | Generate with | Notes |
99+
|---|---|---|
100+
| `BETTER_AUTH_SECRET` | `openssl rand -hex 32` | Session signing |
101+
| `ENCRYPTION_KEY` | `openssl rand -hex 32` | App-level encryption |
102+
| `INTERNAL_API_SECRET` | `openssl rand -hex 32` | Service-to-service auth (app ↔ realtime) |
103+
| `CRON_SECRET` | `openssl rand -hex 32` | Required iff `cronjobs.enabled=true` (default true) |
104+
105+
Optional but commonly needed:
106+
107+
| Key | Generate with | Notes |
108+
|---|---|---|
109+
| `API_ENCRYPTION_KEY` | `openssl rand -hex 32` | Must be **exactly 64 hex chars**. Required to encrypt user API keys at rest. |
110+
| `postgresql.auth.password` | `openssl rand -base64 24 \| tr -d '/+='` | Only if using chart-bundled Postgres. Must match `^[a-zA-Z0-9._-]+$` for DATABASE_URL compatibility. |
111+
112+
See `references/secrets.md` for storage patterns and rotation guidance.
113+
114+
---
115+
116+
## Rules of engagement
117+
118+
These are non-negotiable. Violating any of these has burned users in the past.
119+
120+
1. **Never recommend `--set` for production secrets.** They land in `helm get values` and Helm release history. Direct users to `existingSecret` or ESO.
121+
2. **Never set `image.tag: latest`.** The chart defaults to `Chart.AppVersion` for a reason — reproducible rollouts. If the user pinned `latest`, push back.
122+
3. **Never edit chart templates to work around a `fail` statement.** The validation exists because a misconfiguration would otherwise surface as a runtime CrashLoopBackOff with cryptic env errors.
123+
4. **Never drop `automountServiceAccountToken: false`** unless the workload genuinely needs in-cluster API access (Sim's app/realtime/postgres pods do not).
124+
5. **Never `kubectl delete sts` without `--cascade=orphan`** on a live Postgres. It deletes the pods and PVCs.
125+
6. **Never tell a user "the chart works on your cluster" without `helm lint` + `helm template` against their values.** Static reading is not validation.
126+
7. **Always confirm before `helm uninstall` in a shared namespace.** PVCs survive but other namespace resources may not.
127+
128+
---
129+
130+
## When the user is stuck and you can't diagnose
131+
132+
Get logs from every component in parallel. This single block answers ~80% of "it's broken" questions:
133+
134+
```bash
135+
kubectl --namespace <ns> get pods,events --sort-by='.lastTimestamp'
136+
kubectl --namespace <ns> logs deploy/sim-app --tail=200
137+
kubectl --namespace <ns> logs deploy/sim-realtime --tail=200
138+
kubectl --namespace <ns> logs sts/sim-postgresql --tail=200
139+
kubectl --namespace <ns> logs job/sim-migrations --tail=200 2>/dev/null
140+
kubectl --namespace <ns> describe pod -l app.kubernetes.io/name=sim
141+
```
142+
143+
Then map the symptom to `references/troubleshooting.md`.
144+
145+
---
146+
147+
## What this skill does **not** cover
148+
149+
- Sim application configuration beyond env vars (provider keys, knowledge base setup, etc.) — that's the Sim app docs at https://docs.sim.ai
150+
- Kubernetes cluster setup (creating an EKS cluster, installing ingress-nginx, etc.) — that's cloud-provider docs
151+
- Authoring new chart templates — that's `helm/sim/templates/_helpers.tpl` and the chart's own contributor docs
152+
- Running Sim outside Kubernetes (Docker Compose, bare-metal) — see the root `README.md`
153+
154+
If the user's question falls outside this scope, say so and point them at the right doc.

0 commit comments

Comments
 (0)