DeepSeek Harness

DeepSeek Harness Background Jobs vs. Terminals

· 6 min read · 中文版

DeepSeek Harness background jobs track long-running work and its output, while persistent terminals own an interactive PTY session. A terminal send can itself be managed as background work, but a job's settlement and a terminal's shell status answer different questions.

DeepSeek Harness: what does each service own?

The job runtime manages identity, access, lifecycle and an output ring for producers. Producers own their execution resources. A job may run a command or represent another long-running producer; its kind is an extensible namespace. The documented statuses are running, stopping, completed, killed and failed.

The terminal service manages owner-scoped persistent PTY sessions. A backend starts a session and detects readiness; the service publishes it after setup succeeds and manages authorization and cleanup. A session holds terminal state and bounded scrollback while its top-level shell is alive.

QuestionBackground jobPersistent terminal
Main identityJob idTerminal session id
Typical observationStatus, output, progress, settlementSend result, scrollback, top-level shell status
InputProducer-specificInteractive sends to the PTY
Output retentionBounded output ringBounded terminal scrollback
OwnershipSession-owned or explicitly unownedExact owning Agent
LifetimeUntil settlement or teardownUntil close or owner cleanup

Choose a tracked job or an interactive PTY, and interpret each result separately

DeepSeek Harness: when does a terminal send return?

A terminal permits one active send at a time. TerminalWaitReason can be stdin_read, inferred_idle, timeout or session_exit. This reason describes why the send returned control; it is independent of TerminalSessionStatus. Silence or timeout can return while the shell remains running. session_exit means the top-level shell exited, not that an arbitrary foreground child has necessarily been separately observed exiting.

The send result includes a bounded viewport, wait reason, session status and a truncated flag. A caller should examine all of them before deciding whether to send more input or read scrollback. The separate read operation pages retained output, which is bounded; output dropped from retention cannot be reconstructed merely by reading again.

DeepSeek Harness: how does a background job report progress and completion?

A producer can append output and update a live progress line. The runtime retains output in a ring, and output reads have their own limits. A settled result can include a terminal detail or a value; the producer contract says done resolves after resources are released. A rejection is converted to failed; forced teardown can record failure without proving the work stopped. Treat the status and details as the documented observation, not proof of an operating-system cleanup in every failure path.

Owned jobs publish job/registered and job/settled in the original owner session. Settlement may occur after turn/end, so a completed turn does not imply all jobs have stopped. Application teardown can prevent a final settlement from reaching storage. A missing settlement remains incomplete; do not invent a finish time.

DeepSeek Harness: how should I choose and inspect a run?

  1. Decide whether the task needs ongoing interactive input and terminal state. If it does, use an available PTY session; if it is long-running work to track and collect, use the available job interface.
  2. Retain the correct identity and owner. Job controls authorize the owner rather than relying on secret ids; terminal operations authorize the exact owning Agent, not a guessed name.
  3. For a PTY, inspect the send's wait reason, shell status and truncation separately. If a send timed out while the shell is running, decide whether to read retained output or continue interaction rather than declaring the shell finished.
  4. For a job, read output and status as the producer runs. After settlement, inspect its outcome and detail. If consuming session history, look for the settlement separately from the turn's end.
  5. Close or cancel work through the relevant service when it is no longer needed, and handle cleanup failures. A job and the terminal used by its producer may have separate lifetimes.

A terminal send operation exposes a consuming output cursor for generic background jobs. That is the bridge between the two models: managing a send as a job does not transform the PTY into a durable terminal transcript or make its wait reason equivalent to a process exit.

What should a consumer record during an investigation?

For a job, retain its id, owner, status and the output or detail actually observed. The registry's lifecycle timestamps describe commits to the registry, not precise operating-system process boundaries. producerReported records whether the producer fulfilled done with a terminal outcome; it does not independently certify that resources were released. A forced failure and a producer-reported result deserve different interpretation.

For a terminal, record the send's wait reason together with its session status. A returned viewport may be bounded, and truncated indicates dropped output from the operation or retained scrollback. The two services expose different observations even when one task uses both. An interactive command may pause for input while the top-level shell remains alive, so follow the terminal status and the available output before issuing further input.

Owner cleanup is another separate concern. The job contract describes cancellation and awaited cleanup for an owned job when its live owner is disposed; the terminal service attaches awaited cleanup to the exact owner scope. Unowned jobs are open to any caller until service disposal, according to the job contract. Choose ownership deliberately and avoid assuming that an id or display name grants access.

DeepSeek Harness: what are the limits and safety boundaries?

PTY state and raw bytes remain process-local. Model input and bounded returned output can be durable through tool call and result paths, but that is not a complete recording of all terminal activity. Output rings and scrollback can truncate; preserve any evidence your application needs through an appropriate mechanism. A job ID is not an access secret, and a terminal name is only owner-local display metadata.

Commands and terminal output can contain credentials and private paths. Review what is sent and what is exported. Neither job tracking nor a PTY provides a safety guarantee for the underlying operation; permissions and the execution environment still matter. The references describe service contracts, so actual tools and controls depend on the installed composition.

DeepSeek Harness: what do the terms mean?

  • Job: registered long-running producer with managed lifecycle and output.
  • PTY: a pseudo-terminal used for interactive terminal behavior.
  • Wait reason: why a particular terminal send returned.
  • Settlement: a job registry's terminal outcome record.
  • Scrollback: bounded retained terminal output.

Frequently asked questions

Does a terminal timeout mean the shell exited?

No. The send wait reason and top-level shell status are independent.

Does turn end mean every job settled?

No. Job settlement can follow turn end.

Is terminal scrollback complete and durable?

No. It is bounded and PTY state remains process-local.

Sources

Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.

  1. Background jobs
  2. Persistent PTY sessions

This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.

← Back to all articles