fix(substrate): make sandbox agents resume reliably - #2503
Conversation
Signed-off-by: sam123ben <samyak.rout@gmail.com>
77c7b05 to
d6888c2
Compare
Signed-off-by: sam123ben <samyak.rout@gmail.com>
Signed-off-by: sam123ben <samyak.rout@gmail.com>
|
Additional security and runtime validation in
Evidence:
|
|
@EItanya maintainer action requested: the current head |
|
CI diagnosis update: The two red jobs are a shared upstream previous-stable regression, not introduced by this PR.
All substrate-focused tests, unit/race validation, lint, builds, E2E, DCO, and adjacent-upgrade jobs remain green. A maintainer rerun or an upstream |
| // Persist owner-scoped session metadata before creating or resuming an actor. | ||
| // Failing closed keeps untracked sessions out of the shared sandbox runtime. | ||
| if err := t.ensureSessionRow(req.Context(), sessionID, userID); err != nil { | ||
| return nil, fmt.Errorf("ensure controller session row: %w", err) |
There was a problem hiding this comment.
this was best effort before, now a db write failure blocks the whole chat request. a short postgres hiccup now breaks every substrate agent, not just session listing. intended tradeoff?
| } | ||
| userID := strings.TrimSpace(req.Header.Get("X-User-Id")) | ||
| if userID == "" { | ||
| return nil, fmt.Errorf("request carries no user identity") |
There was a problem hiding this comment.
now hard requires X-User-Id on every request through this transport. are all callers of this roundtripper guaranteed to go through auth middleware first, including any internal or background caller?
What changed\n\n- resolve desired Secret stringData when building the Substrate ActorTemplate\n- explicitly cold-boot from durable data on resume\n- give the actor readiness probe a 30-second timeout\n- add regression coverage for all three compatibility requirements\n\n## Why\n\nA generated SandboxAgent could remain unready because a not-yet-persisted Secret only exposed stringData, resume omitted the required source, and the default readiness timeout was too short for the actor.\n\n## Validation\n\n- go test -race ./core/pkg/sandboxbackend/substrate\n- go vet ./core/pkg/sandboxbackend/substrate\n- go build ./core/pkg/sandboxbackend/substrate\n- gofmt check on changed Go files\n- isolated gVisor canary reached Accepted=True and Ready=True