Act on the review of the decoupling branch #152

Merged
branderson merged 17 commits from review-133-fixes into harness-decoupling 2026-08-19 20:28:15 -07:00
Collaborator

Summary generated by LLM agent

Acts on the review left at ~/shared/pr133-review.md. Items 1 and 3-9; item 2 is #133's own description and base, handled separately.

1. The shipper dropped the tail of every session

The review is right and this is the one that mattered. bin/dejima SIGTERMs the shipper the moment the container exits, and it had no trap - so the in-memory batch and everything written since the last poll went with it. That is typically the agent's final answer.

Worse, the comment at the kill site claimed the opposite ("the last lines a session produced are shipped rather than left in a batch this kill discards"). I asserted a property I had not tested; a comment that lies about a security-adjacent log is worse than no comment.

Fixed with a TERM trap that scans once more and flushes. Verified both ways: wrote a line, killed immediately, found it shipped - and against the pre-fix code, confirmed it is lost. Also exits when bin/dejima was SIGKILLed, rather than polling an ended session forever.

3. Nothing said when the hooks were never registered

An operator who set [core] harness without re-running ./install.sh got no briefing and no guards, on every launch, silently. Now a launch says so, in the same voice as the guard report - harness_guards_registered is a plugin hook, since where a harness records its hooks is its own business, and a harness that cannot answer is assumed wired rather than refused.

5. The section rename broke the property boundaries exist for

A state file written before the rename, compared after, sent the old ### statusline entry into the tcb range: a CRITICAL for a file nothing touched. The old boundary is now read as the new one when the new one is absent, with a test that writes a pre-rename state file and asserts a clean compare.

6. Wrapper name collision

identifier permits any bare name, so command = gosu would have had the entrypoint exec the harness as root. The manifest is trusted, so this is not a hole - it turns a bad manifest into a clean refusal instead of undefined behaviour. Existing symlinks to the wrapper are still fine, for idempotence.

4, 7, 8, 9

  • docs/security.md names the trade in host-side shipping: jq now parses session-controlled bytes outside the container as the operator. That is the cost of a log a session cannot silence, and it should not read as a free win.
  • /etc/resolv.conf and /etc/hosts join DEJIMA_CONTAINER_PATHS - the DNS pin routing the model API to the TLS terminator is as load-bearing as anything already there.
  • An empty command_path is refused at launch, beside the no_confirm_args refusal.
  • no_confirm_args and settings_args take a new args type. template promises substitution against the briefing whitelist and these never reach composition, so a {{...}} shipped literally.

One test the fixes corrected

"a harness hosting every guard says nothing about guards" asserted on the bare word guards, and the new not-registered warning contains it. That assertion was too broad - a different message about a different problem. It matches the guard report's own wording now.

Testing

static.bats 250, config.bats 127, audit.bats 158, providers.bats 70, remote.bats 104, project.bats 134, proxy.bats 30 - no failures.

**Summary generated by LLM agent** Acts on the review left at `~/shared/pr133-review.md`. Items 1 and 3-9; item 2 is #133's own description and base, handled separately. ## 1. The shipper dropped the tail of every session The review is right and this is the one that mattered. `bin/dejima` SIGTERMs the shipper the moment the container exits, and it had **no trap** - so the in-memory batch and everything written since the last poll went with it. That is typically the agent's final answer. Worse, the comment at the kill site claimed the opposite ("the last lines a session produced are shipped rather than left in a batch this kill discards"). I asserted a property I had not tested; a comment that lies about a security-adjacent log is worse than no comment. Fixed with a TERM trap that scans once more and flushes. **Verified both ways:** wrote a line, killed immediately, found it shipped - and against the pre-fix code, confirmed it is lost. Also exits when `bin/dejima` was SIGKILLed, rather than polling an ended session forever. ## 3. Nothing said when the hooks were never registered An operator who set `[core] harness` without re-running `./install.sh` got no briefing and no guards, on every launch, silently. Now a launch says so, in the same voice as the guard report - `harness_guards_registered` is a plugin hook, since where a harness records its hooks is its own business, and a harness that cannot answer is assumed wired rather than refused. ## 5. The section rename broke the property boundaries exist for A state file written before the rename, compared after, sent the old `### statusline` entry into the tcb range: a CRITICAL for a file nothing touched. The old boundary is now read as the new one when the new one is absent, with a test that writes a pre-rename state file and asserts a clean compare. ## 6. Wrapper name collision `identifier` permits any bare name, so `command = gosu` would have had the entrypoint exec the harness **as root**. The manifest is trusted, so this is not a hole - it turns a bad manifest into a clean refusal instead of undefined behaviour. Existing symlinks to the wrapper are still fine, for idempotence. ## 4, 7, 8, 9 - `docs/security.md` names the trade in host-side shipping: `jq` now parses session-controlled bytes outside the container as the operator. That is the cost of a log a session cannot silence, and it should not read as a free win. - `/etc/resolv.conf` and `/etc/hosts` join `DEJIMA_CONTAINER_PATHS` - the DNS pin routing the model API to the TLS terminator is as load-bearing as anything already there. - An empty `command_path` is refused at launch, beside the `no_confirm_args` refusal. - `no_confirm_args` and `settings_args` take a new `args` type. `template` promises substitution against the briefing whitelist and these never reach composition, so a `{{...}}` shipped literally. ## One test the fixes corrected "a harness hosting every guard says nothing about guards" asserted on the bare word `guards`, and the new not-registered warning contains it. That assertion was too broad - a different message about a different problem. It matches the guard report's own wording now. ## Testing `static.bats` 250, `config.bats` 127, `audit.bats` 158, `providers.bats` 70, `remote.bats` 104, `project.bats` 134, `proxy.bats` 30 - no failures.
dejima-agent added 1 commit 2026-08-19 04:48:34 -07:00
Act on the review of the decoupling branch
tests / runner-env (confined) (pull_request_target) Successful in 37s
tests / confined (providers) (pull_request_target) Successful in 4m0s
tests / confined (proxy) (pull_request_target) Successful in 1m9s
tests / confined (static) (pull_request_target) Successful in 3m51s
tests / privileged (pull_request_target) Successful in 4m21s
tests / runner-env (privileged) (pull_request_target) Successful in 37s
tests / confined (remote) (pull_request_target) Successful in 5m46s
tests / confined (project) (pull_request_target) Successful in 7m34s
tests / confined (audit) (pull_request_target) Successful in 8m21s
tests / confined (config) (pull_request_target) Successful in 11m6s
f5d7e7703b
The conversation shipper dropped the tail of every session. bin/dejima
SIGTERMs it the moment the container exits and it had no trap, so both
the in-memory batch and everything written since the last poll went with
it - typically the agent's final answer. The comment at the kill site
claimed the opposite, which is worse than saying nothing. It traps TERM
now, scans once more and flushes; confirmed by writing a line, killing
immediately, and finding it shipped, against a control that loses it.
It also exits if bin/dejima was SIGKILLed rather than polling an ended
session forever.

Nothing said when the hooks were never registered. install.sh registers
them gated on [core] harness, so an operator who set that key without
re-running it got no briefing and no guards, on every launch, silently.
The launch says so now, in the same voice as the guard report.

The audit's section rename broke the one property those boundaries
exist for: a state file written before it, compared after, sent the old
statusline entry into the tcb range and produced a CRITICAL for a file
nothing touched. The old boundary is read as the new one when the new
one is absent.

The entrypoint refuses a wrapper name that already exists in
/usr/local/bin. `identifier` permits any bare name, so `command = gosu`
would have had the entrypoint exec the harness as root - the manifest is
trusted, so this turns a bad one into a clean refusal.

/etc/resolv.conf and /etc/hosts join the container paths a harness mount
may not shadow: the DNS pin that routes the model API to the TLS
terminator is as load-bearing as anything already listed.

An empty command_path is refused at launch beside the no_confirm_args
refusal, rather than as the wrapper's exit 127 inside a started
container.

no_confirm_args and settings_args take a new `args` type. `template`
promises substitution against the briefing whitelist, and these never
pass through composition, so a {{...}} in one shipped literally.

docs/security.md names the trade in moving the transform host-side: jq
now parses session-controlled bytes outside the container as the
operator, which is the cost of a log a session cannot silence.
dejima-agent added 2 commits 2026-08-19 11:53:27 -07:00
The registration check now covers every hook the harness would install,
not just the briefing, and the launch names which are missing rather
than asserting that none are in force. A hand-edited settings.json that
dropped one guard was silent before; it is named now.

The wrapper-name refusal resolves through PATH instead of checking
/usr/local/bin alone. The entrypoint invokes find, install and mkdir as
root after linking the wrapper, so a manifest naming one of those would
have shadowed it. Two resolutions stay legitimate: the real binary being
shadowed, and the wrapper itself from an earlier start.

The R1 comment sits above the no_confirm_args refusal it describes,
rather than above the command_path one added beneath it.
Split the harness domain list on spaces, not on ambient IFS
tests / runner-env (confined) (pull_request_target) Successful in 36s
tests / confined (proxy) (pull_request_target) Successful in 1m8s
tests / confined (providers) (pull_request_target) Successful in 3m58s
tests / confined (static) (pull_request_target) Successful in 4m2s
tests / privileged (pull_request_target) Successful in 4m21s
tests / runner-env (privileged) (pull_request_target) Successful in 36s
tests / confined (remote) (pull_request_target) Successful in 5m55s
tests / confined (project) (pull_request_target) Successful in 7m53s
tests / confined (audit) (pull_request_target) Successful in 8m7s
tests / confined (config) (pull_request_target) Successful in 11m45s
7be6bbcd75
init-firewall.sh sources docker/fixed-domains.sh with IFS=$'\n\t' set and
dns-proxy.sh with the default, so an unquoted expansion hands the two
consumers different lists from one value - the drift that shared file
exists to prevent. A harness declaring two api_domains reached the
firewall as one glued element and failed its DNS check, which is fatal:
the container refuses to start.

Latent while claude-code declares exactly one domain, and it fires for
the first harness needing two - opencode, which needs models.dev and a
provider endpoint. From the codebase audit at the tip of 152; the same
trap is already commented at init-firewall.sh's own extra-domains loop.

The existing test could not see it: it sources the file in a fresh
bash -c, so with the default IFS and the single-valued real manifest.
The new one uses two domains and reproduces init-firewall's IFS, and
fails on the old code with "firewall sees 3 entries, dns proxy sees 4".
branderson added 14 commits 2026-08-19 19:19:45 -07:00
Close the drift the audit found between code and its words
tests / runner-env (confined) (pull_request_target) Successful in 36s
tests / confined (proxy) (pull_request_target) Successful in 1m7s
tests / confined (providers) (pull_request_target) Successful in 3m59s
tests / confined (static) (pull_request_target) Successful in 4m3s
tests / privileged (pull_request_target) Successful in 4m9s
tests / runner-env (privileged) (pull_request_target) Successful in 36s
tests / confined (remote) (pull_request_target) Successful in 6m1s
tests / confined (project) (pull_request_target) Successful in 8m8s
tests / confined (audit) (pull_request_target) Successful in 8m19s
tests / confined (config) (pull_request_target) Successful in 11m53s
5c0de842c5
Five findings, all the same defect class this repo names for itself: a
comment or a doc describing a control that moved or never existed.

Debounce stamps leaked on every normal exit. The only code that removed
them is dejima-attach's prune, which needs a registry entry still
present for a container that is gone - and bin/dejima's cleanup() takes
that entry on every clean exit, so the branch could not fire. The
comment claimed the opposite. They are removed in cleanup() now, with
the rest of the per-run state; the prune keeps its copy for the exit
that runs no trap, and says so.

`ttyd_tmux_prefix = C-space` passed the schema and was then rejected by
the page, which fell back to C-b silently - the outcome refusing at
launch exists to prevent. The page matches a named key in any case now.
web/index.html is rebuilt from `npm ci` so the artifact matches the
pinned dependencies rather than whatever install resolved.

docs/security.md still named /etc/dejima-claude, renamed to
/etc/dejima-harness; docker-compose.yml kept two comment blocks
describing mounts that moved to the harness plugin, and one describing
a variable that no longer exists; docs/providers.md listed the briefing
whitelist without network_allowlist, which reads as "not available" for
something that is.

Three tests, each of which would have caught its own finding: the docs
carry no stale staging path, every whitelist entry is documented, and
both sides of the tmux prefix agree.
A launch spent 17 seconds in shell before docker was invoked, and forked
5,397 processes to do it. dejima-config-lib.sh parses the config file once
per process and answers every read from that parse; the manifest layer never
got the same treatment, so manifest_get ran a full manifest_validate and then
re-walked the file on each of a launch's ~36 calls, forking three times per
line for the trimming alone. The schema table was read through a process
substitution over a heredoc on every key lookup, and provider_dir resolved
its two readlinks per read.

Manifests are now parsed once per process into _MF_VAL/_MF_SEEN, the schema
table is loaded once per axis into _MFT_TYPE/_MFT_DEF, provider_root and
provider_dir cache their resolved paths, and the parse loop uses the existing
fork-free _config_trim_into. A launch is 0.40s and 127 forks; test/config.bats
falls from 639s to 314s.

The property the caching has to preserve is the one the config header states:
every read sees a fully validated file, and no read can succeed against a
file another read would reject. Values are staged and committed only once the
whole manifest has passed, so a manifest refused halfway leaves no half of
itself readable, and the cache is keyed on the resolved directory rather than
the provider name, so repointing DEJIMA_PROVIDER_ROOT is re-parsed rather than
answered about the previous root. Three tests in providers.bats pin all three.

Verified invisible: the 57 docker arguments a launch produces are identical
before and after, and all seven host-side suites pass.
Make a forge's install list the gate on what ships into the image
tests / runner-env (confined) (pull_request_target) Successful in 35s
tests / confined (proxy) (pull_request_target) Successful in 1m7s
tests / confined (providers) (pull_request_target) Successful in 1m49s
tests / confined (static) (pull_request_target) Successful in 2m28s
tests / confined (remote) (pull_request_target) Successful in 3m9s
tests / confined (project) (pull_request_target) Successful in 3m57s
tests / privileged (pull_request_target) Successful in 4m12s
tests / runner-env (privileged) (pull_request_target) Successful in 32s
tests / confined (config) (pull_request_target) Successful in 5m38s
tests / confined (audit) (pull_request_target) Successful in 7m25s
52aa687d7e
docs/providers.md called `install` "the only manifest key naming something
that actually gets copied and executed" and said the list "is what the
Dockerfile copies into the image". Neither was true: nothing under bin/ or
install.sh read the key, and the Dockerfile ran a find over the directory
layout, so `install =` empty in forges/github/forge.conf described a gate
that did not exist.

That drift fails open, and it got worse when #133 put the provider
directories in the audit's TCB. An operator reading a forge manifest is
entitled to conclude that a forge declaring nothing puts nothing executable
in the image; under the find, any file added under any forges/*/bin/ shipped
into /usr/local/bin of every image with no declaration to review and no
unknown-key error to notice.

docker/install-forge-bins.sh installs exactly the declared files and fails
the build in both directions: a declared file that is missing, and a file
under a forge's bin/ that no manifest declares. It parses rather than sources
the manifest, for the reason dejima-provider-lib.sh does - forges/ can be the
mounted workspace when dejima sandboxes its own checkout - and re-checks each
element against the relpath shape, since the schema validator does not run
where this does.

Three static tests, so the gate is checked in the fast tier rather than only
where Docker runs: the installed set equals the set present under a bin/, an
undeclared file fails, and a declared-but-absent file fails. Both doc claims
now describe the enforcement that is there.
Cut the archaeology out of comments and docs, per .dejima.md's own rule
tests / confined (proxy) (pull_request_target) Successful in 1m8s
tests / confined (providers) (pull_request_target) Successful in 1m53s
tests / runner-env (confined) (pull_request_target) Successful in 35s
tests / confined (project) (pull_request_target) Successful in 4m9s
tests / confined (config) (pull_request_target) Successful in 5m48s
tests / confined (static) (pull_request_target) Successful in 2m48s
tests / confined (remote) (pull_request_target) Successful in 3m32s
tests / confined (audit) (pull_request_target) Successful in 7m25s
tests / privileged (pull_request_target) Successful in 4m21s
tests / runner-env (privileged) (pull_request_target) Successful in 37s
77b44ccede
An external voice audit swept the repo against "Cut what the code replaced"
and found 24 files carrying history that stopped being checked. Two of them
had rotted into statements that are now false, which is the rule's whole
argument:

bin/dejima said ALLOW_GITHUB_PUSH is read by nothing. docker/init-firewall.sh
reads it at three sites - the port-22 grant and both halves of the startup
self-check - and docker-compose.yml passes it. The comment meant that the
push guard no longer reads it, and said "nothing".

bin/dejima-project-lib.sh's remote-access header said the switch is a
non-empty base_url. It is [remote-access] enabled, an explicit boolean, which
the comment block directly beneath it states and remote_enabled() implements.
The header was a fossil of an intermediate design.

The rest is the same defect in a milder form: comments that narrate what
moved rather than state what is there. The #50 masking story was retold at
three code sites, none of them the canonical record; docs/security.md is,
and each site now carries the current fact and a pointer to it. Four
"no longer" phrasings in bin/dejima, two "moved here from" notes in
dejima-config-lib.sh, two justifications resting on a remote.conf validator
that is gone, and a dozen more, all restated as properties of the code that
is there.

Docs the same: security.md's cross-project paragraph, statusline.sh's :ro
mount (kept as a present-tense counterfactual, with the confirmed-against-a-
live-container fact intact), remote-access.md's five "exactly as it did
before this feature existed" guarantees, and the "in this phase" parenthetical
in providers.md, which refers to a delivery plan no reader has.

Kept deliberately, per the rule's own exception: every migration and
compat path, the regression-pin comments in tests, and security.md's
"found the hard way three times" (#47/#48/#50) - the canonical incident
record every code pointer now resolves to.

Two tests were coupled to the old wording and are updated in the same
change: static.bats grepped security.md for "no longer a CROSS-PROJECT
finding", and two test names carried archaeology of their own. Two
"Finding 1" labels cited a review document not in the repo, and named
different findings in each file; the failure-mode prose around both stays,
the labels are gone. All seven host-side suites pass.
Break the OSC 52 paste chain, and stop the prune racing a live session
tests / runner-env (confined) (pull_request_target) Successful in 33s
tests / confined (proxy) (pull_request_target) Successful in 1m6s
tests / confined (providers) (pull_request_target) Successful in 1m56s
tests / confined (static) (pull_request_target) Successful in 2m44s
tests / confined (remote) (pull_request_target) Successful in 3m29s
tests / privileged (pull_request_target) Successful in 4m2s
tests / confined (project) (pull_request_target) Successful in 4m25s
tests / runner-env (privileged) (pull_request_target) Successful in 35s
tests / confined (config) (pull_request_target) Successful in 5m59s
tests / confined (audit) (pull_request_target) Successful in 7m29s
968c3566b0
Two P1 findings from the codebase audit.

P1.3 - the web terminal honours OSC 52 unconditionally, so a session can
rewrite the operator's clipboard. The chain the audit describes ends at
PASTE: switch to a plain shell one tmux prefix key away, tap PASTE,
bracketedPaste() is false there, and toolbar.js sends the raw text including
its trailing newline, which runs it.

The execution step is where this is cut. With bracketed paste on, the text
arrives as data and nothing runs, unchanged. Without it, trailing newlines
are stripped: the paste still lands, and the operator presses Enter
themselves. Line breaks in the middle still arrive as Enter, which is true of
pasting into any terminal without bracketed paste and cannot be fixed without
refusing legitimate pastes, so PASTE says so rather than leaving it assumed.
The transformation is a pure function so it can be tested without a DOM.

Two bounds on the write itself: every OSC 52 write raises a toast naming how
much was written, because a clipboard that changes silently is one you paste
from believing you know what is on it, and a payload over 100KB is refused
before it is decoded, since a yank is a selection rather than a stream.
Copying out of a session (docker/sandbox-clipboard.lua, tmux set-clipboard)
is untouched.

The docs claimed "a native terminal over the SSH front door behaves
identically". It does not: xterm gates OSC 52 writes behind allowWindowOps,
off by default, kitty prompts, Alacritty needs configuring. That comparison
now says which way the difference runs, and what bounds it.

P1.4 - dejima-attach's prune could delete a live session's marker directory.
STARTUP_GRACE=900 was a guess about build duration; a cold first run can
exceed it, and then opening the front door mid-build unregistered the session
and rm -rf'd the bind source of a mount the imminent compose run declares.
Docker recreates it root-owned, dejima-notify.sh fails on every Notification
and Stop for the rest of the run, and nothing rewrites the registry entry, so
the session is invisible to both front doors permanently.

The marker directory's lifetime belongs to bin/dejima's EXIT trap, so the
prune no longer touches it at all: a second owner can only race the first,
and losing that race breaks a session rather than tidying a host. The guess
is gone too. bin/dejima records its own pid in the registry entry, and the
prune asks whether that process is still running, which is observable where a
build's duration is not. A recycled pid reads as alive and leaves an entry
listed too long, which is the harmless direction. An entry with no pid can
only be a session that outlived an upgrade, and keeps the old window; the
constant is renamed to say that is all it is for.

pid reaches kill, which takes a job spec and a negative pgid as well as a
process, so it is validated as digits in read_entry beside started= and for
the same reason.

Seven new tests: four on the paste transformation, three on the OSC 52 cap,
and four in remote.bats covering a pruned entry leaving the marker directory
alone, a launch still building however long it has taken, and a pid that is
not a plain number being refused rather than signalled. write_entry still
writes the pre-pid shape by default, so the existing suite keeps covering the
upgrade fallback. web/index.html is rebuilt from npm ci.

All seven host-side suites and the 48 web tests pass.
Add shellcheck and real tests for the shipper, and close the staleness gap
tests / confined (proxy) (pull_request_target) Successful in 1m7s
tests / runner-env (confined) (pull_request_target) Successful in 33s
tests / confined (providers) (pull_request_target) Successful in 1m49s
tests / confined (static) (pull_request_target) Successful in 2m31s
tests / confined (remote) (pull_request_target) Successful in 3m15s
tests / privileged (pull_request_target) Successful in 3m59s
tests / confined (project) (pull_request_target) Successful in 4m5s
tests / runner-env (privileged) (pull_request_target) Successful in 33s
tests / confined (config) (pull_request_target) Successful in 5m44s
tests / confined (audit) (pull_request_target) Successful in 7m16s
299febef02
P4.17, P4.15, P4.16 and P3.14 from the codebase audit.

shellcheck now runs over all 29 shell scripts in the repo as its own CI job,
at -S warning. test/shellcheck.sh holds the file list, discovered by shebang
rather than enumerated, so a script added under bin/, hooks/, docker/ or a
forge's bin/ is covered the day it lands; the job and the static test that
pins its coverage call the same script.

It found a real bug on the first run. _provider_keys_cached did

    local axis="$1" name="$2" cache_key="$axis:$name"

and bash does not apply the earlier assignments before evaluating the later
one in a single `local`, so cache_key was built from whatever axis and name
meant in the CALLER's scope. The cache was keyed on ":" for every provider,
and the only reason nothing broke is that both call sites wrap it in $( ) -
so the cache was populated in a throwaway subshell, read back never, and its
comment described a win that could not happen. It is removed rather than
fixed: a per-command-substitution cache with one lookup per subshell is dead
code, and dead code with a latent collision in it is worse than none.

Six `export X="$(cmd)"` in bin/dejima are split into an assignment and an
export. export always succeeds, so the combined form hides a failing
substitution from set -e; split, a config_get that fails stops the launch.

The rest of what shellcheck flagged is intentional, and says so at the site:
one-row tables that read as loops, literal tildes in prose, a trap body baked
in on purpose, and mkdir -p -m whose leaf-only mode is the reason for the
verify-and-chmod block beneath it. Two classes are disabled repo-wide in
.shellcheckrc, both about variables crossing a boundary shellcheck cannot
see: a library defining what its consumers read, and status=$? inside a
single-quoted trap. Verified clean under 0.11.0 and under the 0.9.0 CI will
install.

test/conversation.bats replaces grep-based assertions about
bin/dejima-conversation-ship with eight behavioural ones: the shipper runs
against a real transcript and a real HTTP endpoint standing in for Loki, and
what arrives is what is asserted on. Mutation-tested both ways - removing the
TERM trap fails the two loss-path tests, and a final_flush that flushes the
batch without rescanning fails only the tail test, which is the distinction a
grep cannot make. The superseded grep test is removed.

The web/index.html staleness test compared the manifest against the tree and
nothing against the page, so a commit staging web/src and web/sources.sha256
while leaving index.html behind passed and shipped the stale page - the exact
failure its own comment claimed to prevent. build.mjs already stamps the page
with sha256sum of the manifest it wrote; the test now checks that too.
Verified by reproducing the stale-page commit, which fails, and the correct
one, which passes. build.mjs pointed at test/static.bats for this; the test
is in test/remote.bats.

One static test hardcoded "exactly 2 checkouts pin the head sha", which the
new job broke. It asserts the property now - every checkout is pinned except
the two runner-env jobs - since a count breaks when a job is added, which is
when nobody is thinking about which ref it reads.

All eight host-side suites pass, and shellcheck is clean.
Three findings from the codebase audit, all in forges/gitea/bin.

gitea-actions could report "all N jobs succeeded" for a run in which a job
failed. fetch_jobs read one page of 100 commit statuses and filtered by run
number afterwards; a job writes at least two statuses and a re-run stacks
another set on the same commit, so on a re-run of a workflow with a dozen
jobs the requested run's own statuses fall off page one. The zero-jobs case
already errored loudly. Partial visibility did not, and the output goes to an
agent that acts on it.

The same shape in gitea-pr: create's duplicate check read one page of open
PRs, so past the server's page size it missed the existing PR for the branch
and filed a second one, and comments truncated issue comments and reviews at
the same boundary - dropping the feedback whoever is addressing the review is
waiting on, in a loop the docs recommend by name. All four list reads now
follow pages until one comes back short, bounded so a server that ignores
`page` cannot spin. Duplicated between the two CLIs rather than shared, for
the reason gitea-issue's header gives: they are self-contained files copied
into the image, and a library would be a third thing to keep in step.

A run with a skipped job read as in_progress forever, because the rollup
treated anything-but-success as unfinished. `skipped` is a finished job and
now counts as one; every other unrecognised status still reads in_progress,
which is the safe direction for one this does not know.

gitea-pr's `comments` and `merge` took the PR number as given while `edit`
required a number. curl normalises dot-segments, so a value like
`../../../other/repo/pulls/7` reaches a different repo's endpoint with this
token on it. No privilege boundary is crossed - the agent holds the token and
could curl directly - but the defence was already there and applied
inconsistently. Both go through require_number now, with an empty argument
still getting the usage line rather than a complaint about the empty string.

Three tests. Every PR-number subcommand refuses a path, an absent argument
gets usage, and comments reads all 105 comments a paginating stub serves
across three pages - mutation-tested by restoring the unpaginated read, which
fails it on the second page. The existing curl stub matched whole URLs, so it
stopped matching once the reads carried a query string; it matches on the
path now, which is what those tests were always about.
Move the last Claude Code paths out of core, and cap what a session can send
tests / confined (static) (pull_request_target) Successful in 2m51s
tests / confined (remote) (pull_request_target) Successful in 3m28s
tests / confined (audit) (pull_request_target) Successful in 7m31s
tests / confined (conversation) (pull_request_target) Successful in 54s
tests / confined (providers) (pull_request_target) Successful in 1m55s
tests / confined (proxy) (pull_request_target) Successful in 1m10s
tests / confined (shellcheck) (pull_request_target) Successful in 46s
tests / runner-env (confined) (pull_request_target) Successful in 35s
tests / confined (config) (pull_request_target) Successful in 5m55s
tests / privileged (pull_request_target) Successful in 4m8s
tests / runner-env (privileged) (pull_request_target) Successful in 34s
tests / confined (project) (pull_request_target) Successful in 9m27s
977777f566
P2.8 and the P5 items from the codebase audit.

docs/development.md's decoupling inventory listed "Settings layering" and
"Staged config" as resolved while bin/dejima still pre-created
~/.claude/settings.json and ~/.claude/CLAUDE.md by name, parsed settings.json
with Claude-Code-specific reasoning, and generated the override layer as
{sandbox: {enabled: false}} - Claude Code's settings schema, not a neutral
one. The pre-creation was a duplication as well as a coupling, since
harness_staged_config already declares exactly those two paths.

All three are one plugin hook now, harness_prepare_config, which core calls
with the path to write the override to. The plugin decides which config files
must exist, what makes one unusable, and what the override says; core keeps
what was always its own - that the override is a throwaway the session cannot
reach, that it is mounted at a container-local path and never over the
harness's own settings file (#47), and that a plugin refusing there stops the
launch. A settings schema is a parser's grammar rather than a value, which is
why this is a plugin hook and not a manifest key.

statusline.sh is deliberately not among the files created if absent: it is
staged executable and named by settings.json's statusLine.command, so an
empty one would be a status line that runs and does nothing in place of the
harness having none. The inventory now describes what is there, with a second
row for the config preconditions.

The credential proxy read a request body of any size into host RAM, from a
client that is the sandboxed session. Every other session-controlled size in
the repo is bounded, several with explicit reasoning about $TMPDIR being
tmpfs. Capped at 32MiB and refused with a 413 rather than truncated, since
half a request forwarded upstream is worse than a rejected one. The refusal
raises its own exception type: _read_body also raises ValueError for a
genuinely malformed request, and a test pins that such a fault still surfaces
as a traceback - catching ValueError here would have swallowed it, which is
the trade the suppression elsewhere in that file exists to avoid.

dejima-epitaph was silent when no harness is selected, exiting 0 having saved
nothing - indistinguishable from a session that never compacted. It says so
now, in the same voice dejima-audit uses for the identical condition.

dejima-attach's picker exited 1 with no message when there was no controlling
terminal (ssh -T, or an SSH app that requests no pty), which reads as a
broken front door. `read -r choice || exit 0`, matching what attach() already
reasons about explicitly.

Six new tests: the override disables the harness's own sandboxing, carries
none of the operator's other settings, refuses an unparseable settings.json,
creates both config files but not statusline.sh, leaves an existing file
alone, and core names no harness config file of its own. Two more in
proxy.bats for the body cap in both directions. A launch's 57 docker
arguments are identical before and after.

All nine host-side suites pass, and shellcheck is clean.
Merge pull request 'Move the last Claude Code paths out of core, and cap what a session can send' (#158) from audit-p28-p5 into audit-forge
tests / confined (conversation) (pull_request_target) Successful in 55s
tests / confined (proxy) (pull_request_target) Successful in 1m12s
tests / confined (providers) (pull_request_target) Successful in 1m58s
tests / confined (shellcheck) (pull_request_target) Successful in 46s
tests / runner-env (confined) (pull_request_target) Successful in 34s
tests / confined (project) (pull_request_target) Successful in 4m11s
tests / confined (static) (pull_request_target) Successful in 2m44s
tests / confined (remote) (pull_request_target) Successful in 3m21s
tests / privileged (pull_request_target) Successful in 3m58s
tests / confined (audit) (pull_request_target) Successful in 7m16s
tests / runner-env (privileged) (pull_request_target) Successful in 32s
tests / confined (config) (pull_request_target) Successful in 11m21s
a83f84561d
Reviewed-on: #158
Reviewed-by: branderson <brad@branderson.io>
Merge pull request 'Forge pagination and PR-number validation, plus the last of the audit' (#160) from audit-forge into audit-tooling
tests / confined (proxy) (pull_request_target) Successful in 1m10s
tests / confined (providers) (pull_request_target) Successful in 1m50s
tests / runner-env (confined) (pull_request_target) Successful in 34s
tests / confined (remote) (pull_request_target) Successful in 3m23s
tests / confined (project) (pull_request_target) Successful in 4m14s
tests / confined (static) (pull_request_target) Successful in 2m51s
tests / confined (config) (pull_request_target) Successful in 6m5s
tests / privileged (pull_request_target) Successful in 4m31s
tests / confined (audit) (pull_request_target) Successful in 7m36s
tests / runner-env (privileged) (pull_request_target) Successful in 35s
465c75bf7a
Reviewed-on: #160
Reviewed-by: branderson <brad@branderson.io>
Merge pull request 'Add shellcheck and real tests for the shipper, and close the staleness gap' (#159) from audit-tooling into audit-p13-p14
tests / runner-env (confined) (pull_request_target) Successful in 34s
tests / confined (proxy) (pull_request_target) Successful in 1m10s
tests / confined (providers) (pull_request_target) Successful in 1m59s
tests / confined (static) (pull_request_target) Successful in 2m57s
tests / confined (remote) (pull_request_target) Successful in 3m37s
tests / privileged (pull_request_target) Successful in 4m7s
tests / confined (project) (pull_request_target) Successful in 4m30s
tests / runner-env (privileged) (pull_request_target) Successful in 35s
tests / confined (config) (pull_request_target) Successful in 6m20s
tests / confined (audit) (pull_request_target) Successful in 7m50s
db27d7717b
Reviewed-on: #159
Reviewed-by: branderson <brad@branderson.io>
Merge pull request 'Break the OSC 52 paste chain, and stop the prune racing a live session' (#155) from audit-p13-p14 into voice-audit
tests / runner-env (confined) (pull_request_target) Successful in 36s
tests / confined (proxy) (pull_request_target) Successful in 1m10s
tests / confined (providers) (pull_request_target) Successful in 2m1s
tests / confined (static) (pull_request_target) Successful in 2m54s
tests / confined (remote) (pull_request_target) Successful in 3m36s
tests / privileged (pull_request_target) Successful in 4m6s
tests / confined (project) (pull_request_target) Successful in 4m20s
tests / runner-env (privileged) (pull_request_target) Successful in 34s
tests / confined (config) (pull_request_target) Successful in 5m59s
tests / confined (audit) (pull_request_target) Successful in 7m30s
8f93f6a484
Reviewed-on: #155
Reviewed-by: branderson <brad@branderson.io>
Merge pull request 'Cut the archaeology out of comments and docs' (#154) from voice-audit into audit-drift-fixes
tests / confined (proxy) (pull_request_target) Successful in 1m7s
tests / confined (providers) (pull_request_target) Successful in 1m49s
tests / runner-env (confined) (pull_request_target) Successful in 33s
tests / runner-env (privileged) (pull_request_target) Canceled after 0s
tests / confined (project) (pull_request_target) Canceled after 3m40s
tests / confined (static) (pull_request_target) Canceled after 2m30s
tests / confined (remote) (pull_request_target) Canceled after 2m50s
tests / confined (audit) (pull_request_target) Canceled after 3m44s
tests / confined (config) (pull_request_target) Canceled after 3m42s
tests / privileged (pull_request_target) Canceled after 2m31s
b94a68fb82
Reviewed-on: #154
Reviewed-by: branderson <brad@branderson.io>
Merge pull request 'Close the drift the audit found between code and its words' (#153) from audit-drift-fixes into review-133-fixes
tests / confined (audit) (pull_request_target) Successful in 7m53s
tests / confined (config) (pull_request_target) Successful in 6m21s
tests / confined (project) (pull_request_target) Successful in 4m33s
tests / confined (providers) (pull_request_target) Successful in 2m3s
tests / confined (proxy) (pull_request_target) Successful in 1m11s
tests / confined (remote) (pull_request_target) Successful in 3m36s
tests / confined (static) (pull_request_target) Successful in 2m59s
tests / runner-env (confined) (pull_request_target) Successful in 35s
tests / runner-env (privileged) (pull_request_target) Successful in 35s
tests / privileged (pull_request_target) Successful in 4m29s
d4fad60b53
Reviewed-on: #153
Reviewed-by: branderson <brad@branderson.io>
branderson approved these changes 2026-08-19 19:20:17 -07:00
branderson merged commit 9df06e8a94 into harness-decoupling 2026-08-19 20:28:15 -07:00
Sign in to join this conversation.