probe-research 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/probe-research.js +17 -7
- package/package.json +1 -1
package/bin/probe-research.js
CHANGED
|
@@ -741,12 +741,18 @@ const NONE_SETUP = Object.freeze({
|
|
|
741
741
|
});
|
|
742
742
|
/** Kept back from the budget for the CLI's own work once the download is in. */
|
|
743
743
|
const WAIT_RESERVE_MS = 20 * 1000;
|
|
744
|
+
/**
|
|
745
|
+
* Kept from `sign-in --wait`'s budget for its one approval read after a stop: the read's own timeout + 1 s
|
|
746
|
+
* (#4602 review). The CLI's deadline moves earlier by as much.
|
|
747
|
+
*/
|
|
748
|
+
const APPROVAL_READ_RESERVE_MS = signIn.APPROVAL_TIMEOUT_MS + 1000;
|
|
744
749
|
/**
|
|
745
750
|
* What an approved sign-in's CLI needs left once a download is in (PR39): its first start through a new
|
|
746
|
-
* service, then the exchange before its own save reserve (12 s)
|
|
747
|
-
* answer `waiting_for_approval` though the person approved,
|
|
751
|
+
* service, then the exchange before its own save reserve (12 s), margin (3 s) and the launcher's
|
|
752
|
+
* approval-read reserve. With less, it would answer `waiting_for_approval` though the person approved,
|
|
753
|
+
* so the agent runs it again instead (#4661 review: 15 s for the start and the exchange, as before).
|
|
748
754
|
*/
|
|
749
|
-
const APPROVED_RESERVE_MS = 30 * 1000;
|
|
755
|
+
const APPROVED_RESERVE_MS = 30 * 1000 + APPROVAL_READ_RESERVE_MS;
|
|
750
756
|
/** How often a running download is looked at again. */
|
|
751
757
|
const DOWNLOAD_POLL_MS = 1000;
|
|
752
758
|
/** The uninstall barrier (`probe.shared.updates.uninstall_barrier.path`). */
|
|
@@ -834,13 +840,17 @@ function sleep(ms) {
|
|
|
834
840
|
|
|
835
841
|
/** Run an agent's call (`step`) under the backstop; a call it had to stop answers `run_again` (75). */
|
|
836
842
|
async function runAgentCall(cmd, cmdArgs, startedMs, step, watch = null) {
|
|
837
|
-
|
|
843
|
+
// `sign-in --wait` keeps APPROVAL_READ_RESERVE_MS of the budget for the approval read below (#4602 review).
|
|
844
|
+
const deadlineMs = startedMs + agentRun.AGENT_BUDGET_MS - (watch ? APPROVAL_READ_RESERVE_MS : 0);
|
|
845
|
+
const ran = await agentRun.runWithBackstop(cmd, cmdArgs, { deadlineMs });
|
|
838
846
|
if (ran.stopped) {
|
|
839
847
|
// `sign-in --wait`'s (fixes-1108): a call stopped unsaved still says whether the person approved, read once
|
|
840
|
-
// after the CLI is gone, so the agent never says "still waiting" to someone who approved.
|
|
841
|
-
|
|
848
|
+
// after the CLI is gone, so the agent never says "still waiting" to someone who approved. Only while the
|
|
849
|
+
// sign-in still waits: a CLI stopped mid-save already took it, and the server still answers "approved".
|
|
850
|
+
const isWaiting = Boolean(watch && signIn.loadPending());
|
|
851
|
+
if (isWaiting) await watch.update();
|
|
842
852
|
await refuseAgent(step, agentRun.Reason.RUN_AGAIN, "Stopped at the agent's time limit: run the same command again.",
|
|
843
|
-
agentRun.EXIT_AGAIN,
|
|
853
|
+
agentRun.EXIT_AGAIN, isWaiting ? watch.getFacts() : {});
|
|
844
854
|
}
|
|
845
855
|
if (ran.error) await refuseAgent(step, agentRun.Reason.INCOMPLETE, `could not run ${cmd}: ${ran.error}`, 1);
|
|
846
856
|
if (SHIM_REASONS[ran.code]) {
|