Merge remote-tracking branch 'origin/main' into pr507b

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
BaaRai
2026-11-23 15:10:58 +01:00
3 changed files with 77 additions and 0 deletions
+1
View File
@@ -13,6 +13,7 @@ All notable changes to this project are documented in this file. The format is b
### Fixed
- **Task timeout triggers fire for every task**: `on_task_timeout` used the task id as a watermark, but tasks time out in deadline order. Once a newer task timed out first, an older task that timed out later was never fired for. Fired timeouts are now kept in a persisted set, like met goals; on first start the set is seeded with the tasks already timed out, so nothing replays.
- **A named pipe in the task workspace no longer hangs the archive worker**: packing opened every non-directory entry, and opening a FIFO blocks until a writer appears, so the single archive worker stopped there and every later archive, restore and delete job waited behind it. A socket failed the archive instead, and a device was packed but refused on restore. The packer now skips every entry that is neither a directory nor a regular file, as it already did for symlinks.
- **Task form does not keep test-account secrets on screen**: after a task is created the credential rows are cleared, and the password field is masked.
- **LLM connection-test logs stay one line**: the response body written by a connection test has CR and LF replaced with spaces before it is logged, so the body cannot start a second log record.
- **Benchmark judge validation**: grading and the judge's falsification battery require one verdict per ground-truth ID, actual boolean decisions and gates, and matches to the supplied scanner findings. Invalid grading responses use the existing three-attempt budget and abort without writing scores, rather than counting duplicate IDs or truthy strings such as `"false"`.
+6
View File
@@ -639,6 +639,12 @@ func writeTaskArchivePackage(path, payloadDir string, snapshot *pgdb.TaskArchive
log.Printf("[task-archive] skipping symlink (unsupported by the archive, other files unaffected): %s", current)
return nil
}
if !entry.IsDir() && !info.Mode().IsRegular() {
// A named pipe, socket or device left by a command: opening a pipe blocks until
// a writer appears, tar refuses a socket, and the unpacker refuses the rest.
log.Printf("[task-archive] skipping a file that is not regular (unsupported by the archive): %s", current)
return nil
}
header, err := tar.FileInfoHeader(info, "")
if err != nil {
return err
+70
View File
@@ -0,0 +1,70 @@
//go:build unix
package server
import (
"net"
"os"
"path/filepath"
"syscall"
"testing"
pgdb "github.com/Autumn-27/artex/db"
)
// A named pipe or a socket left in the task workspace by a command must not
// make the archive unrestorable, nor stop the task from being archived.
func TestTaskArchiveSkipsSpecialFiles(t *testing.T) {
// A short root: a socket path is limited to about 100 bytes.
dataDir, err := os.MkdirTemp("/tmp", "arch")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { os.RemoveAll(dataDir) })
taskID := "42"
runDir := filepath.Join(dataDir, "tasks", taskID, "main")
if err := os.MkdirAll(runDir, 0o755); err != nil {
t.Fatal(err)
}
evidence := filepath.Join(runDir, "evidence.txt")
if err := os.WriteFile(evidence, []byte("task evidence"), 0o600); err != nil {
t.Fatal(err)
}
if err := syscall.Mkfifo(filepath.Join(runDir, "backpipe"), 0o600); err != nil {
t.Skipf("mkfifo: %v", err)
}
ln, err := net.Listen("unix", filepath.Join(runDir, "ctl.sock"))
if err != nil {
t.Skipf("unix socket: %v", err)
}
ln.(*net.UnixListener).SetUnlinkOnClose(false)
ln.Close()
stage, err := stageTaskArchiveFiles(dataDir, 1, taskID, 7)
if err != nil {
t.Fatal(err)
}
archivePath := taskArchivePath(dataDir, 1, taskID)
snapshot := &pgdb.TaskArchiveSnapshot{FormatVersion: pgdb.TaskArchiveFormatVersion, TaskID: 42, ExplorationID: 7}
_, _, checksum, err := writeTaskArchivePackage(archivePath, stage.payload, snapshot)
if err != nil {
t.Fatalf("the task could not be archived: %v", err)
}
if err := stage.commit(); err != nil {
t.Fatal(err)
}
extracted := filepath.Join(dataDir, "restore")
if err := extractTaskArchivePackage(archivePath, checksum, extracted); err != nil {
t.Fatalf("the archive of the task cannot be restored: %v", err)
}
installed, err := installTaskArchiveFiles(dataDir, extracted, taskID, 1, ExecPrivilege{})
if err != nil {
t.Fatal(err)
}
if err := installed.commit(); err != nil {
t.Fatal(err)
}
if got, err := os.ReadFile(evidence); err != nil || string(got) != "task evidence" {
t.Fatalf("restored %s = %q, %v", evidence, got, err)
}
}