after moving all to cipher
This commit is contained in:
@@ -64,7 +64,7 @@ import {
|
||||
INPUT_CHECKSUMS_FILENAME,
|
||||
readTaskInputChecksums,
|
||||
} from './lib/input-checksums';
|
||||
import { didRepair, manualRepairHint, normalizeTreePermissions } from './lib/tree-permissions';
|
||||
import { manualRepairHint, normalizeTreePermissions } from './lib/tree-permissions';
|
||||
import { readSessionId } from './session-id';
|
||||
|
||||
/**
|
||||
@@ -169,6 +169,27 @@ function copyTrial(trialPath: string, destName?: string) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Repair the SOURCE before reading a byte of it. A trial can leave files
|
||||
// write-only, which locks out their own owner: everything below — reading
|
||||
// reward.txt, copying agent-output — fails on them, and any that do get
|
||||
// through land in the task dir, where harbor hashes every file on every
|
||||
// later trial and one unreadable path aborts the run.
|
||||
let sourcePerms = null;
|
||||
try {
|
||||
sourcePerms = normalizeTreePermissions(trialPath);
|
||||
} catch (err) {
|
||||
console.warn(`Warning: could not normalize permissions on ${trialPath}: ${String(err)}`);
|
||||
console.warn(` If the copy below fails on permissions:`);
|
||||
console.warn(` ${manualRepairHint(trialPath)}`);
|
||||
}
|
||||
if (sourcePerms && sourcePerms.failures.length > 0) {
|
||||
console.warn(
|
||||
`Warning: could not normalize permissions on ${sourcePerms.failures.length} path(s) under ${trialPath}.`
|
||||
);
|
||||
console.warn(` If the copy below fails on permissions, run:`);
|
||||
console.warn(` ${manualRepairHint(trialPath)}`);
|
||||
}
|
||||
|
||||
const rewardPath = join(trialPath, 'verifier', 'reward.txt');
|
||||
if (!existsSync(rewardPath)) {
|
||||
console.error(`Error: No reward.txt found in ${trialPath}/verifier/`);
|
||||
@@ -366,10 +387,10 @@ function copyTrial(trialPath: string, destName?: string) {
|
||||
console.log(` reward: ${reward}`);
|
||||
console.log(` task: ${taskDir}`);
|
||||
console.log(` trial: ${trialId}`);
|
||||
if (perms && didRepair(perms)) {
|
||||
console.log(
|
||||
` perms: normalized ${perms.ownerFixed.length} owner / ${perms.modeFixed.length} mode`
|
||||
);
|
||||
const ownerFixed = (sourcePerms?.ownerFixed.length ?? 0) + (perms?.ownerFixed.length ?? 0);
|
||||
const modeFixed = (sourcePerms?.modeFixed.length ?? 0) + (perms?.modeFixed.length ?? 0);
|
||||
if (ownerFixed > 0 || modeFixed > 0) {
|
||||
console.log(` perms: normalized ${ownerFixed} owner / ${modeFixed} mode`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user