carlos / platform Public

copy: RFS-6-C66 to C69, Plan 6's copy gaps (rootfs plan 6)

Paul approved four strings unchanged in his copy review on 2026-10-31.

- C66: appsSetUsage's first line lists [--interactive on|off]. It
  supersedes the first line of zdd.apps-set.usage and GAP-2; both
  records now hold the new text and say so (superseded_by, note).
- C67: carlos apps set --interactive on a 404 with no JSON error names
  both causes, as the swap door does (Task 4 report, concern 3). A 404
  carrying the console's words keeps them.
- C68: an import's abort while an interactive session is open
  (provision.ErrInteractiveOpen) answers 409, beside the open-run case.
  Before, it fell through to the 502 transition failure.
- C69: carlos logs gives a reason for interactive.EndReplaced instead of
  the bare code.

Test-first for C67, C68 and C69. The deck gains the four rows (C66 as a
fragment of the usage literal), its note and counts; rootfsCopyIDs and
rootfsCopyBuilt gain all four. Census: overlay rootfs-apps-6 re-proposed
with every claim carried over unchanged; only the `.` and internal/host
envelopes re-pinned, seal unchanged (87f29ffd).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev ecb0f086b36c56a077ae31b17f77546a0f441485 parent 3ec25d3
11 files changed, +94 −12
  • approved_rootfs_copy_test.go +7 −0
  • apps_swap.go +10 −2
  • apps_swap_test.go +24 −0
  • docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json +1 −1
  • docs/superpowers/plans/2026-10-21-instance-policy-copy.json +1 −1
  • docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md +8 −2
  • internal/console/apiinstanceimport.go +5 −2
  • internal/console/apiinstanceimport_test.go +30 −0
  • internal/host/interactive.go +5 −2
  • internal/host/interactive_test.go +1 −0
  • internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv +2 −2

Intent

Human

<task-notification> <task-id>ac1fb0d18c20162f3</task-id> <tool-use-id>toolu_012yXzB2caUvw46s4RyAgi2A</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/ac1fb0d18c20162f3.output</output-file> <status>completed</status> <summary>Agent "#471 Task 10: live on dev" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Step 3 passed on both checks. Step 4 is stopped: `cable` can't boot without a store grant, so I never opened its socket or timed delete-to-close. Times are UTC. **Step 3, handshake (passed).** At 12:29:19, shop's `/cable` returned `101` with `Sec-Websocket-Protocol: actioncable-v1-json` and `X-Carlos-Version: v4`. The welcome frame came at once, then pings at 12:29:21.978, 24.979 and 27.979, 3.00 s apart. curl stopped at its 10 s limit (exit 28). **Step 3, page check (passed).** I used a Python client, `ws.py`, built only on the standard library. - 12:30:00.781: GET `/` showed counts 4/4; it kept the session cookie and read the form token. - 12:30:00.886: `101`, welcome, subscribe to PingsChannel; confirmed at .907. - 12:30:01.083: POST `/pings` returned 302 (redirect not followed). - 12:30:01.631: `{"id":5,"done":5,"total":5}` arrived on the same socket, 0.55 s after the POST. - A fresh GET `/` showed 5/5. The real browser check is still Paul's to do. **Step 4, revocation (stopped).** - 12:30:35 created `cable` on fleet/r10r, 12:30:44 set SECRET_KEY_BASE from `skb`, 12:30:48 shipped the same tar as v1, 12:31:26 promoted it. - I also ran `instances enable` and `instances create --host cable.bab.dev.oncarlos.com` at 12:31:40. The app had no instance until then, and the plan names that one. - On box-1 the release succeeded at 12:32:34. Its first try at 12:32:12 failed with "Missing secret_key_base", though the secret was set at 12:30:44. - At 12:32:56 web failed to start with `Aws::Errors::MissingRegionError`: the sample's file storage needs the `CARLOS_STORE_*` values, and `cable` has no store. It then kept restarting. - Per the brief I created no store. To stop the restart loop I ran `carlos apps delete --account bab cable` at 12:38:48. Box-1 dropped the route at 12:38:52 (4 s) and the config at 12:38:55. No cable unit is running, though an empty systemd slice is still listed. `cable` sits in the Trash until 2026-11-30. **Decision for you:** to finish Step 4, `cable` needs either a store grant or placeholder `CARLOS_STORE_*` env values (as `ship --check` uses). Then `carlos apps restore cable` and create the instance again, or use a new name. Each option goes beyond the brief, so it needs a ruling. I posted the second reply on #471. Nothing is left running, the S3 prefix is empty, and the local tar is deleted. On box-1, `/root/t471` and the image `localhost/shop:471` remain for Paul's teardown call, and shop still serves v4. The log, transcripts and client are in `/home/paulca/.cache/tmp/claude-1001/t471-live/` (`log.md`, `handshake2.txt`, `page-check.txt`, `ws.py`).</result> <usage><subagent_tokens>122344</subagent_tokens><tool_uses>23</tool_uses><duration_ms>622923</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b3a9q1py7</task-id> <tool-use-id>toolu_01HkzVMZyGZZVsovvBXhSRaF</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/b3a9q1py7.output</output-file> <status>completed</status> <summary>Background command "Wait for the copy review result" completed (exit code 0)</summary> </task-notification>

Human

done

Human

What's its status?

Human

Nearly there?

Human

Cool. Are we doing something particularly slow again like running too many tests locally or waiting for stuff that could be quick if we e.g. smoke-tested locally?

Human

OK, sounds good. Do that. Can you co-ordinate with other in-flight agents that might be doing the same?

Attributed to this commit: 27.8 g CO₂e (3,616,046 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on rootfs-apps-6-interactive, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/approved_rootfs_copy_test.go b/approved_rootfs_copy_test.go
index bcd626046..17cf2f88c 100644
--- a/approved_rootfs_copy_test.go
+++ b/approved_rootfs_copy_test.go
@@ -141,6 +141,8 @@ var rootfsCopyIDs = []string{
"RFS-6-C61", "RFS-6-C62", "RFS-6-C63", "RFS-6-C64",
// Added by the Plan 6 preflight (PF-11), approved by Paul 2026-10-30
"RFS-6-C65",
+ // Plan 6's copy gaps, approved by Paul 2026-10-31
+ "RFS-6-C66", "RFS-6-C67", "RFS-6-C68", "RFS-6-C69",
}
// rootfsCopyStruck is every id the deck marks struck, pinned, so a row can
@@ -265,6 +267,11 @@ var rootfsCopyBuilt = []string{
// Plan 6 Task 12: the box's session lines in carlos logs
// (internal/host/interactive.go)
"RFS-6-C48", "RFS-6-C49", "RFS-6-C50", "RFS-6-C51", "RFS-6-C52", "RFS-6-C53", "RFS-6-C54", "RFS-6-C55", "RFS-6-C56", "RFS-6-C57",
+ // Plan 6's copy gaps (approved 2026-10-31): the apps set usage line and
+ // its 404 (apps_swap.go), the import abort while a session is open
+ // (internal/console/apiinstanceimport.go) and a replaced session's
+ // reason (internal/host/interactive.go)
+ "RFS-6-C66", "RFS-6-C67", "RFS-6-C68", "RFS-6-C69",
}
func mustParseRootfsRecord(t *testing.T) []copyRow {
diff --git a/apps_swap.go b/apps_swap.go
index 96dda0700..4d5deb514 100644
--- a/apps_swap.go
+++ b/apps_swap.go
@@ -19,7 +19,7 @@ import (
"github.com/carlosframework/platform/internal/updatewords"
)
-const appsSetUsage = `usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]
+const appsSetUsage = `usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--interactive on|off] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]
--swap overlap|hold how a running instance takes a new build. overlap
starts the new build beside the old one and switches
@@ -63,6 +63,9 @@ const (
appsSetInteractiveOn = "%s: interactive sessions are on. any member can open a terminal on its instances with carlos run -it"
appsSetInteractiveOff = "%s: interactive sessions are off"
appsSetInteractiveMismatch = "apps set: the change did not stick (the console stored interactive %s). run it again"
+ // RFS-6-C67: a 404 with no JSON error, as appsSetOldConsole, but the
+ // console may predate only the interactive door, not apps set.
+ appsSetInteractiveNotFound = "not found: either %s is not an app in this account, or this console predates --interactive (update the console, then run this again)"
)
// apiInteractiveSetting is the interactive door's body and its echo.
@@ -243,13 +246,18 @@ func (s *apiSession) setSwapPolicy(ctx context.Context, a apiAcct, app string, r
// setInteractive is the interactive half of `carlos apps set`. The console
// refuses with its own words (a member turning it on, RFS-6-C38), and they
-// are returned as they came.
+// are returned as they came. A 404 with no JSON error is both "not your
+// app" and "a console from before this door" (RFS-6-C67), as for the swap
+// door.
func (s *apiSession) setInteractive(ctx context.Context, a apiAcct, app string, on bool) (bool, error) {
status, body, err := s.putJSON(ctx, apiPath(a, app, "/interactive"), apiInteractiveSetting{Interactive: on})
if err != nil {
return false, err
}
if status != http.StatusOK {
+ if status == http.StatusNotFound && !hasJSONError(body) {
+ return false, fmt.Errorf(appsSetInteractiveNotFound, app)
+ }
return false, apiErrorFromBody(status, body)
}
var out apiInteractiveSetting
diff --git a/apps_swap_test.go b/apps_swap_test.go
index 010a55921..1501cf893 100644
--- a/apps_swap_test.go
+++ b/apps_swap_test.go
@@ -113,6 +113,30 @@ func TestAPISessionSetSwapPolicyOldConsole(t *testing.T) {
}
}
+// A 404 with no JSON error from the interactive door is both "not your app"
+// and "a console from before --interactive" (RFS-6-C67, the Task 4 report's
+// concern 3); a 404 that carries the console's words keeps them.
+func TestAPISessionSetInteractiveNotFound(t *testing.T) {
+ ts := httptest.NewServer(http.NotFoundHandler())
+ defer ts.Close()
+ _, err := newTestSession(ts.URL).setInteractive(context.Background(), apiAcct{Seg: "bab"}, "shop", true)
+ want := "not found: either shop is not an app in this account, or this console predates --interactive (update the console, then run this again)"
+ if err == nil || err.Error() != want {
+ t.Fatalf("err = %v, want %q", err, want)
+ }
+
+ worded := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusNotFound)
+ io.WriteString(w, `{"error":"the console's own words"}`)
+ }))
+ defer worded.Close()
+ _, err = newTestSession(worded.URL).setInteractive(context.Background(), apiAcct{Seg: "bab"}, "shop", true)
+ if err == nil || !strings.Contains(err.Error(), "the console's own words") || strings.Contains(err.Error(), "predates") {
+ t.Fatalf("a worded 404: err = %v", err)
+ }
+}
+
// Rootfs plan 6 Task 4: --interactive takes on or off and nothing else; the
// request carries the bool; the run prints the line for what the console
// stored, and says so when the console stored something else.
diff --git a/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json b/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
index 4c5f6706b..d15363d2c 100644
--- a/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
+++ b/docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
@@ -46,7 +46,7 @@
{"id": "zdd.api.retry-limited", "file": "internal/console/apiretry.go", "text": "too many requests. wait a minute and try again"},
{"id": "zdd.apps.usage-line", "file": "apps.go", "text": "usage: carlos apps <create|place|build-probe|set|show|delete|restore|ttl|keep|list> [flags] <app>"},
{"id": "zdd.apps.usage-set", "file": "apps.go", "text": " set <app> [--swap overlap|hold] [--swap-concurrency <n>] how the app's\n running instances take a new build: see carlos apps set -h."},
- {"id": "zdd.apps-set.usage", "file": "apps_swap.go", "text": "usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]\n\n --swap overlap|hold how a running instance takes a new build. overlap\n starts the new build beside the old one and switches\n once it answers its health check, so no request\n waits. hold stops the old one first, and requests\n wait until the new one is up. Use hold when two\n builds cannot share the database.\n --swap-concurrency <n> how many instances of the app may swap at once on\n one box, after the first has stayed up for ten\n seconds. 1 or more; it starts at 1.\n\nAny member of the app may change these. They reach the app's boxes with its\nconfig, within seconds."},
+ {"id": "zdd.apps-set.usage", "file": "apps_swap.go", "text": "usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--interactive on|off] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]\n\n --swap overlap|hold how a running instance takes a new build. overlap\n starts the new build beside the old one and switches\n once it answers its health check, so no request\n waits. hold stops the old one first, and requests\n wait until the new one is up. Use hold when two\n builds cannot share the database.\n --swap-concurrency <n> how many instances of the app may swap at once on\n one box, after the first has stayed up for ten\n seconds. 1 or more; it starts at 1.\n\nAny member of the app may change these. They reach the app's boxes with its\nconfig, within seconds.", "superseded_by": "RFS-6-C66", "note": "The first line was superseded by RFS-6-C66, which adds [--interactive on|off]; Paul approved it unchanged in his copy review on 2026-10-31 (docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md). It read: usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]"},
{"id": "zdd.apps-set.flag-swap", "file": "apps_swap.go", "text": "overlap or hold: how a running instance takes a new build"},
{"id": "zdd.apps-set.flag-concurrency", "file": "apps_swap.go", "text": "how many instances of the app may swap at once on one box (1 or more)"},
{"id": "zdd.apps-set.flag-app", "file": "apps_swap.go", "text": "app whose swap or instance policy to set"},
diff --git a/docs/superpowers/plans/2026-10-21-instance-policy-copy.json b/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
index ac85b4684..ea374f3bf 100644
--- a/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
+++ b/docs/superpowers/plans/2026-10-21-instance-policy-copy.json
@@ -81,7 +81,7 @@
{"id": "IP1-56", "file": "apps.go", "text": "usage: carlos apps <create|place|build-probe|set|show|delete|restore|ttl|keep|list> [flags] <app>"},
{"id": "IP1-57", "file": "apps_swap.go", "text": "apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive"},
{"id": "GAP-1", "file": "internal/updatewords/words_surfaces.go", "text": "usage: carlos instances set <host> [--app <a>] [--updates auto|manual] [--channel <c>] [--major <n>] [--pin <build>] [--size small|standard|large|xlarge|default] (an empty value clears an update setting)"},
- {"id": "GAP-2", "file": "apps_swap.go", "text": "usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]\n"},
+ {"id": "GAP-2", "file": "apps_swap.go", "text": "usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--interactive on|off] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]\n", "superseded_by": "RFS-6-C66", "note": "The first line was superseded by RFS-6-C66, which adds [--interactive on|off]; Paul approved it unchanged in his copy review on 2026-10-31 (docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md). It read: usage: carlos apps set <app> [--swap overlap|hold] [--swap-concurrency <n>] [--account <sqid|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small|standard|large|xlarge|default]"},
{"id": "GAP-3", "file": "apps_swap.go", "text": "app whose swap or instance policy to set"},
{"id": "IP3-04", "file": "status_instances.go", "text": "BOX REGION HOST LAYOUT SIZE EGRESS REASON"},
{"id": "IP3-08", "file": "status_instances.go", "text": "-"},
diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
index 87f2f2f45..c9ed4c1ab 100644
--- a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
+++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
@@ -12,6 +12,8 @@ Approved 2026-10-24 by delegation: Paul asked for a Luna copy pass instead of a
Added 2026-10-30 by the Plan 6 preflight: RFS-6-C47, revised to keep `--egress-allow` and `--size`, and RFS-6-C65, new. Paul approved both unchanged in his copy review the same day. The gate's inventory (`rootfsCopyIDs`) gained RFS-6-C65 in the same commit.
+Added 2026-10-31: RFS-6-C66 to C69, the copy gaps Plan 6 Tasks 4, 9 and 12 left. Paul approved all four unchanged in his copy review on 2026-10-31. RFS-6-C66 supersedes the first line of the approved `zdd.apps-set.usage` and `GAP-2`; those records now hold its text and say so. The gate's inventory (`rootfsCopyIDs`) and built list (`rootfsCopyBuilt`) gained all four in the same commit.
+
The rules:
- A row is `pending` until Paul approves it in the copy review. His edits are
@@ -536,6 +538,10 @@ From the plan: Every string is human text the plan introduces. Existing approved
| RFS-6-C63 | `carlos logs` (box, a run grant that did not verify) | run %s was not started on this box: its grant could not be verified | approved |
| RFS-6-C64 | `carlos logs` (box, the relay dropped mid-run) | run %s lost its connection to the console, so it was stopped | approved |
| RFS-6-C65 | run.go (parseRunArgs: `carlos run -it` or `--interactive` given with `--idempotency-key`; printed to stderr before the usage text, exit 2; added 2026-10-30 by the Plan 6 preflight, PF-11) | -it takes no --idempotency-key. a session is never repeated by a retry | approved |
+| RFS-6-C66 | apps_swap.go (a fragment: the first line of appsSetUsage, adding the --interactive flag; supersedes the approved first line of the zero-downtime record zdd.apps-set.usage and the instance-policy record GAP-2, which change with it and are marked superseded by RFS-6-C66; added 2026-10-31, the Task 4 report's concern 2) | usage: carlos apps set <app> [--swap overlap\|hold] [--swap-concurrency <n>] [--interactive on\|off] [--account <sqid\|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size small\|standard\|large\|xlarge\|default] | approved |
+| RFS-6-C67 | apps_swap.go (appsSetInteractiveNotFound: `carlos apps set <app> --interactive` when the console answers 404 with no JSON error; added 2026-10-31, the Task 4 report's concern 3) | not found: either %s is not an app in this account, or this console predates --interactive (update the console, then run this again) | approved |
+| RFS-6-C68 | internal/console/apiinstanceimport.go (handleAPIImportAbort: an import's abort while an interactive session is open, provision.ErrInteractiveOpen, HTTP 409, beside the open-run refusal; added 2026-10-31) | An interactive session is open on %s. Wait for it to end, then abort. | approved |
+| RFS-6-C69 | internal/host/interactive.go (`carlos logs` reason, sessionEndWords, interactive.EndReplaced; added 2026-10-31) | a newer session on the same instance replaced it | approved |
## Conflicts
@@ -572,5 +578,5 @@ the earlier counts had not followed Plans 1 and 4's later rows.
- Plan 3: 33 live, 2 struck, 35 rows
- Plan 4: 144 live, 2 struck, 146 rows
- Plan 5: 44 live, 0 struck, 44 rows
-- Plan 6: 65 live, 0 struck, 65 rows (RFS-6-C47 revised and RFS-6-C65 added and approved on 2026-10-30)
-- Total: 397 live, 4 struck, 401 rows
+- Plan 6: 69 live, 0 struck, 69 rows (RFS-6-C47 revised and RFS-6-C65 added and approved on 2026-10-30; RFS-6-C66 to C69 added and approved on 2026-10-31)
+- Total: 401 live, 4 struck, 405 rows
diff --git a/internal/console/apiinstanceimport.go b/internal/console/apiinstanceimport.go
index 59b33cc30..16e734a52 100644
--- a/internal/console/apiinstanceimport.go
+++ b/internal/console/apiinstanceimport.go
@@ -862,8 +862,8 @@ func (s *Server) readDeletedRecord(ctx context.Context, sqid, app, host string)
// handleAPIImportAbort abandons an import before it is committed (spec
// §5.6): a record CAS to aborted, then the box rolls it back. The
// transition is provision.SeedAbort, which allows every state before
-// committed and refuses while a run is open, in the same CAS (preflight
-// M14: one rule, in provision). The no-reason form keeps a refused
+// committed and refuses while a run or an interactive session is open, in
+// the same CAS (preflight M14: one rule, in provision). The no-reason form keeps a refused
// import's reason.
//
// It is safe to repeat. An import already aborted answers 200 aborted; one
@@ -887,6 +887,9 @@ func (s *Server) handleAPIImportAbort(w http.ResponseWriter, r *http.Request) {
case errors.Is(err, provision.ErrRunOpen):
jsonError(w, http.StatusConflict, fmt.Sprintf("carlos run is busy on %s. Wait for it to finish, then abort.", host))
return
+ case errors.Is(err, provision.ErrInteractiveOpen):
+ jsonError(w, http.StatusConflict, fmt.Sprintf("An interactive session is open on %s. Wait for it to end, then abort.", host))
+ return
case lostTransition(err):
// Another request got there first. Answer as a sequential abort
// would be answered after it; anything but this import is SD-N60.
diff --git a/internal/console/apiinstanceimport_test.go b/internal/console/apiinstanceimport_test.go
index 469af89d5..640e19e95 100644
--- a/internal/console/apiinstanceimport_test.go
+++ b/internal/console/apiinstanceimport_test.go
@@ -1644,6 +1644,36 @@ func TestImportCommitAbortRace(t *testing.T) {
}
}
+// Abort is refused while an interactive session is open, as while a run is
+// (rootfs apps Plan 6, RFS-6-C68): 409, the record untouched, nothing
+// audited or bumped. Session admission refuses an uncommitted import, so
+// the marker is written directly, as setRun writes a run.
+func TestImportAbortRefusedWhileASessionIsOpen(t *testing.T) {
+ f := newImportFixture(t)
+ body, sha := sqliteBytes(t)
+ code, out := beginImport(t, f, importHost, sha, int64(len(body)))
+ begun, _ := f.requireBegun(t, code, out, importHost)
+
+ rec, etag, err := provision.GetRecordETag(context.Background(), f.fx.rel, "bab", fromApp, importHost)
+ if err != nil {
+ t.Fatal(err)
+ }
+ rec.Interactive = &provision.InteractiveState{ID: "tty_a", By: "alice@example.com", Console: "boot_1", PickupBy: time.Now().Add(time.Minute)}
+ if err := provision.UpdateRecord(context.Background(), f.fx.rel, *rec, etag); err != nil {
+ t.Fatal(err)
+ }
+ before := serial(t, f.fx)
+ want := "An interactive session is open on " + importHost + ". Wait for it to end, then abort."
+ if code, out := postImport(t, f, importHost, "abort"); code != http.StatusConflict || str(t, out, "error") != want {
+ t.Fatalf("abort with a session open = %d %v, want 409 %q", code, out, want)
+ }
+ rec, _ = f.record(t, importHost)
+ requireImportState(t, rec, begun.Seed.ID, seeds.StateAwaitingUpload, "")
+ if serial(t, f.fx) != before || len(importAudit(t, f, "import-aborted")) != 0 {
+ t.Fatal("a refused abort bumped the serial or wrote an audit row")
+ }
+}
+
// Abort is refused while a run is open and after commit, lands from every
// state before commit, and is safe to repeat.
func TestImportAbortRefusals(t *testing.T) {
diff --git a/internal/host/interactive.go b/internal/host/interactive.go
index 2a694c0ae..8ddc80b92 100644
--- a/internal/host/interactive.go
+++ b/internal/host/interactive.go
@@ -966,7 +966,7 @@ func sessionStartedLine(id, by string) string {
}
// sessionEndedLine is how the session ended: RFS-6-C49 for an exit, C50
-// with C51 to C54 or the interruption's reason for an ending after the
+// with C51 to C54, C69 or the interruption's reason for an ending after the
// start, and C55 with C56, C57 or the run refusal's words for a session
// that did not start. An unknown reason renders as itself, as the CLI's
// does.
@@ -986,9 +986,12 @@ func sessionEndedLine(id string, e interactive.End) string {
return fmt.Sprintf("interactive session %s ended after %s: %s", id, took, sessionEndWords(e))
}
-// sessionEndWords is why a started session ended (RFS-6-C51 to C54).
+// sessionEndWords is why a started session ended (RFS-6-C51 to C54, and
+// RFS-6-C69 for a session a newer one replaced).
func sessionEndWords(e interactive.End) string {
switch e.Reason {
+ case interactive.EndReplaced:
+ return "a newer session on the same instance replaced it"
case interactive.EndIdle:
return "30 minutes passed without a keystroke"
case interactive.EndLimit:
diff --git a/internal/host/interactive_test.go b/internal/host/interactive_test.go
index c268905aa..814fd4424 100644
--- a/internal/host/interactive_test.go
+++ b/internal/host/interactive_test.go
@@ -1388,6 +1388,7 @@ func TestInteractiveSessionLines(t *testing.T) {
{ran(interactive.End{Reason: interactive.EndLimit}), "interactive session tty_a ended after 5m3s: it reached its 6 hour limit"},
{ran(interactive.End{Reason: interactive.EndHangup}), "interactive session tty_a ended after 5m3s: the person's connection closed"},
{ran(interactive.End{Reason: interactive.EndLost}), "interactive session tty_a ended after 5m3s: the box lost its connection to the console"},
+ {ran(interactive.End{Reason: interactive.EndReplaced}), "interactive session tty_a ended after 5m3s: a newer session on the same instance replaced it"},
{ran(interactive.End{Reason: interactive.EndInterrupted, Detail: activator.StopRelease}), "interactive session tty_a ended after 5m3s: the instance moved to a new release"},
{interactive.End{Reason: interactive.EndInterrupted, Detail: runs.InterruptedStartFailed, Ended: end}, "interactive session tty_a did not start: the box could not start the command"},
{interactive.End{Reason: interactive.EndRefused, Refused: interactive.RefusedOff, Ended: end}, "interactive session tty_a did not start: interactive sessions are off for this app"},
diff --git a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
index b74590a1a..6b72ce79c 100644
--- a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
+++ b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
@@ -120,10 +120,10 @@ internal/activator/cmdunit.go cmdUnit.Poll legacy accepted-legacy accepted-legac
internal/activator/rootfs_service.go Service.rootfsTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: per activator tick, lists residents (Registry.ResidentInstances through the DueStore), and for each rootfs entry kills generations whose replica reports a lost lease with no watch installed, stops an exited rootfs process (StopExited), and supervises; then drops forgotten residents and reserves proactive starts (residentJob) for resident-shaped, unheld rows within the start ceiling after the locked admission;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.10: when the tick kills a lost-lease resident's generations it also starts stopRootfsWorkersAtLoss(e) beside them; superviseRootfsLocked (a no-op in Group A) is now the worker supervision; the same 15 read sites, no read added; stops more, starts nothing new on its own;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: the no-signal fallback also covers a hibernating rootfs entry with a one-shot unit that may run (oneShotHoldsLocked); it latches ownerKilled and runs each one-shot kill func (KillOneShot to root's existing /stop) with go off a.mu, beside a resident's killResidentGens and stopRootfsWorkersAtLoss as before; new site +whole:Route is e.route.Rootfs(); stops more, starts nothing registry:Host@1842,registry:Host@2071,registry:Host@2427,whole:Route@113,whole:Route@1200,whole:Route@1795,whole:Route@1824,whole:Route@1993,whole:Route@2024,whole:Route@2106,whole:Route@2271,whole:Route@2320,whole:Route@2465,whole:Route@397,whole:Route@803,whole:Route@824 de44f5578a049a224f06a302863752c3a4ff53767478a54d08e373db018efe82
@remove internal/instancectl/cmd.go Server.handleCmdStatus
@removed internal/instancectl/cmd.go Server.handleCmdStatus H3 census-ruling-rootfs-apps-6;absent;basis=rootfs Plan 6 Task 6: moved whole to Server.oneShotStatus (role-aware; see its claim), not deleted: no check, refusal or validation is lost
-@coverage . fbc28f10f89cd03cac31bae0d798ae7f707eb7671284a6115abd8c1c214369b6
+@coverage . 766879a140477803bc6e00e07c33e36d500b4600e69596cbfb4be07427784746
@coverage internal/activator ca11a10e8d8d494376ebf3fd0a4d7aa2ea471ec696732849c8cb2afb6bbe3ac0
@coverage internal/appconfig cac8d8ef7538a456d034801c95ce6508a4983e5516b3bbbd302bec0fbafdd479
-@coverage internal/host 8225c70eaa0fb38c90fde16a9cd471ae5583183a84389b01db606ebbcb42f6e7
+@coverage internal/host 8ffe38068d3e19d4c1aa76283505ce011fc4a6a2c40d85a48123267982d65749
@coverage internal/host/units c3cc4f3b917fdb938f20d406b1704ec54e24553851c298e312056d397d10b0e1
@coverage internal/instancectl 096e845eb71478e8b68726160cff450f8ba850869dae65582dabd25f445527e9
@coverage internal/instanceexec 65f6db1c6bf469f1d19615ec989f54c20de3b73c3c03ae2d677cffbcc60470fd