Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6097c9b
docs: audit tool execution defects and design M1 tool contracts
LofiSu Nov 30, 2026
2202771
Merge remote-tracking branch 'origin/main' into codex/tool-system-red…
LofiSu Dec 1, 2026
2d14235
Validate tool inputs against a shared capability catalog
LofiSu Dec 1, 2026
9245353
Merge remote-tracking branch 'origin/main' into codex/tool-system-red…
LofiSu Dec 1, 2026
dabde4d
Keep schema validation bounded without rejecting parameter names
LofiSu Dec 1, 2026
ad63548
Inspect conditional schemas before compiling tool validation
LofiSu Dec 1, 2026
d7ee061
fix(harness): reject malformed and duplicate tool call batches
LofiSu Dec 1, 2026
c96ba60
test(harness): assert strict malformed tool call rejection
LofiSu Dec 1, 2026
536c5cf
fix(harness): enforce discovered MCP tool snapshots
LofiSu Dec 1, 2026
c1f1a99
fix(harness): cancel MCP requests at the host deadline
LofiSu Dec 1, 2026
3fa61e9
fix(harness): preserve unknown outcome after MCP validation errors
LofiSu Dec 1, 2026
703b874
fix(env): bound shell output by UTF-8 bytes
LofiSu Dec 1, 2026
8c1c1c7
Trace actual tool execution outcomes and retain bounded manifests
LofiSu Dec 1, 2026
eaf75fc
Preserve uncertain execution and export outcomes in diagnostics
LofiSu Dec 1, 2026
d103e4d
feat(cli): inspect tool capabilities without starting the runtime
LofiSu Dec 1, 2026
940d4a1
fix(harness): bound and protect retained MCP artifacts
LofiSu Dec 1, 2026
3ab422d
fix(harness): enforce artifact bounds without reclaim races
LofiSu Dec 1, 2026
1ed6b84
fix(harness): enforce job ownership and cancel pending continuations
LofiSu Dec 1, 2026
15c85dd
feat(harness): execute bounded local-text child jobs with durable res…
LofiSu Dec 1, 2026
0c1ffb4
fix(harness): persist terminal team projections and redact child call…
LofiSu Dec 1, 2026
f3760b9
fix(harness): retain tool results and unknown receipts in traces
LofiSu Dec 1, 2026
51d6e0f
fix(harness): connect child contracts and artifact ownership to runtime
LofiSu Dec 1, 2026
d62d872
fix(harness): redact team inputs and recover only stale child leases
LofiSu Dec 1, 2026
e870a0c
fix(harness): bind provider-safe MCP aliases to discovered snapshots
LofiSu Dec 1, 2026
f662ad9
fix(harness): claim tool call identities before side effects
LofiSu Dec 1, 2026
3096489
fix(harness): bind model calls to atomic MCP snapshots
LofiSu Dec 1, 2026
cde5a8c
fix(jobs): recover terminal child cleanup through runtime scheduling
LofiSu Dec 1, 2026
c857e66
test(jobs): verify legacy completion warning preserves callback protocol
LofiSu Dec 2, 2026
9b097ae
fix(harness): preserve structured tool failures in native Messages
LofiSu Dec 2, 2026
9569cf5
test(harness): exercise strict tool contracts with live stores
LofiSu Dec 2, 2026
260a898
refactor(harness): separate tool handlers by domain boundary
LofiSu Dec 2, 2026
5531f02
fix(env): bound default file reads and reject special files
LofiSu Dec 2, 2026
d35646a
feat(harness): expose conservative tool execution guarantees
LofiSu Dec 2, 2026
01161d2
fix(tracing): retain current input before older history
LofiSu Dec 2, 2026
b9681c4
fix(harness): reconcile orphaned tool executions after restart
LofiSu Dec 2, 2026
5ca2b7d
Complete owner-scoped MCP artifact reads and release lifecycle
LofiSu Dec 2, 2026
94c608f
feat(harness): bound and redact host-only MCP diagnostics
LofiSu Dec 2, 2026
c9e2b08
feat(cli): show scoped tool progress in desktop status
LofiSu Dec 1, 2026
efad967
feat(harness): connect desktop progress to execution receipts
LofiSu Dec 2, 2026
815a291
feat(harness): expose scoped artifacts and bounded MCP diagnostics
LofiSu Dec 2, 2026
cf88805
Merge remote-tracking branch 'origin/main' into codex/tool-system-red…
LofiSu Dec 5, 2026
f35e5e8
docs: record tool redesign implementation plan and trace semantics
LofiSu Dec 5, 2026
ceffc9c
fix(harness): classify held replies without invented approval
LofiSu Dec 5, 2026
78d3ff8
fix(tracing): preserve blocked tool outcomes
LofiSu Dec 5, 2026
2073a95
fix(jobs): recover interrupted completion claims without replay
LofiSu Dec 5, 2026
d4568d3
docs: align implementation with reviewed tool audit
LofiSu Dec 5, 2026
8e1aba7
Isolate Feishu loop tests from repository clone size
LofiSu Dec 5, 2026
8057622
Recover orphaned child completion claims on startup
LofiSu Dec 5, 2026
fb4dfe0
Merge branch 'main' of https://github.com/LofiSu/LofiBot into codex/t…
LofiSu Dec 5, 2026
ea0adb2
Reconcile abandoned job claims before parent recovery
LofiSu Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/AGENT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,16 @@ Owner approved local Phoenix + opt-in OpenTelemetry model/tool tracing with pre-

`TMPDIR=<dedicated canonical temporary root> pnpm run test --no-file-parallelism` completed: 219 files passed, 6 skipped; 2255 tests passed, 68 skipped; no failures (576.23 seconds). The previous parallel short-timeout failures and interrupted ENOSPC run are retained as environment evidence, not counted as passes. Final lazy-loading code and conditional assignment lookup passed independent code review; security review passed 12 focused tests. Persistent Phoenix 22.1.0 retained genuine Harness success/error traces: successful `list_tasks` produced 4 OK spans, while a scope-denied tool appeared as ERROR; both kept correct parentage and redacted fixture credentials. Local service is loopback-only, telemetry/external resources/embedded assistant disabled, dedicated state owner-only. PR and remote CI are next; no merge or production upgrade is claimed.


## M1 tool-system audit and redesign checkpoint (2026-12-01)

Owner requested a detailed tool-system audit, redesign and implementation, then supplied a static audit for careful bug verification. Baseline: origin/main a91f643. Isolated branch: codex/tool-system-redesign; checkout: .worktrees/tool-system-redesign.

Audit and evidence: docs/dev-loop-runs/2026-12-01-tool-system/00-audit.md and artifacts/. Design: 01-design.md. Confirmed defects include missing input validation, duplicate OpenAI call IDs executing twice, cross-worker stop_job, queued/restored completion after cancellation, inconsistent team/job state, undiscovered MCP invocation, uncertain timeout outcomes, unredacted resource text, UTF-8 output errors and misleading trace outcomes. Follow-up Runtime validation, exact PR/fill approval binding and LocalEnv read-path protections were independently checked rather than reported as bypasses.

Evidence: 13 focused files / 89 tests passed; separate 37 boundary tests overlap that set. New contract harness is RED: 5 contracts failed as expected on the unfixed baseline. Real locked OpenTelemetry SDK and local stdio fixtures used; no live model, remote side effect or production deployment. Source remains unchanged. Independent audit review APPROVE; architecture review APPROVE after module ownership, child execution isolation and small-PR sequencing corrections. Owner design review is next. No implementation PR opened or merged; no full-suite or integration pass claimed.

Next: owner review of the concrete design, then implementation planning, failing regression tests, small scoped PRs, independent code/security review and integration verification. Existing PR274/276 are not incorporated automatically. Main session alone owns project state.
## Context Engineering evidence (2026-12-01)

Original user specification drove audit before implementation. Worktrees were isolated and file ownership disjoint. Cursor regression71passed; invocation regression106passed; scoped context/metrics63passed; previously failing desktop/runtime/routine acceptance133passed; Phoenix/context75passed. Independent review reproduced split-anchor loss, dangling tool replay, image-call-ID reuse, synthetic-evidence promotion, legacy provenance grants, unbounded repeated evidence, phantom JSONL checkpoints and MCP startup during manual compaction. All were fixed with focused regressions. Final full gate on1494e40 remains running; no production/live model result or merge claimed.
Expand Down
10 changes: 10 additions & 0 deletions docs/AGENT_REGISTRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ Owner approved local Phoenix + opt-in OpenTelemetry model/tool tracing with pre-

`TMPDIR=<dedicated canonical temporary root> pnpm run test --no-file-parallelism` completed: 219 files passed, 6 skipped; 2255 tests passed, 68 skipped; no failures (576.23 seconds). The previous parallel short-timeout failures and interrupted ENOSPC run are retained as environment evidence, not counted as passes. Final lazy-loading code and conditional assignment lookup passed independent code review; security review passed 12 focused tests. Persistent Phoenix 22.1.0 retained genuine Harness success/error traces: successful `list_tasks` produced 4 OK spans, while a scope-denied tool appeared as ERROR; both kept correct parentage and redacted fixture credentials. Local service is loopback-only, telemetry/external resources/embedded assistant disabled, dedicated state owner-only. PR and remote CI are next; no merge or production upgrade is claimed.


## M1 tool-system audit and redesign checkpoint (2026-12-01)

Owner requested a detailed tool-system audit, redesign and implementation, then supplied a static audit for careful bug verification. Baseline: origin/main a91f643. Isolated branch: codex/tool-system-redesign; checkout: .worktrees/tool-system-redesign.

Audit and evidence: docs/dev-loop-runs/2026-12-01-tool-system/00-audit.md and artifacts/. Design: 01-design.md. Confirmed defects include missing input validation, duplicate OpenAI call IDs executing twice, cross-worker stop_job, queued/restored completion after cancellation, inconsistent team/job state, undiscovered MCP invocation, uncertain timeout outcomes, unredacted resource text, UTF-8 output errors and misleading trace outcomes. Follow-up Runtime validation, exact PR/fill approval binding and LocalEnv read-path protections were independently checked rather than reported as bypasses.

Evidence: 13 focused files / 89 tests passed; separate 37 boundary tests overlap that set. New contract harness is RED: 5 contracts failed as expected on the unfixed baseline. Real locked OpenTelemetry SDK and local stdio fixtures used; no live model, remote side effect or production deployment. Source remains unchanged. Independent audit review APPROVE; architecture review APPROVE after module ownership, child execution isolation and small-PR sequencing corrections. Owner design review is next. No implementation PR opened or merged; no full-suite or integration pass claimed.

Next: owner review of the concrete design, then implementation planning, failing regression tests, small scoped PRs, independent code/security review and integration verification. Existing PR274/276 are not incorporated automatically. Main session alone owns project state.
## Context Engineering assignments (2026-12-01)

- journal_cursors: isolated cursor prerequisite1489761 and invocation gates526308c; integrated by parent. Cursor71test regression, invocation106test regression passed.
Expand Down
71 changes: 71 additions & 0 deletions docs/CHILD_JOBS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Bounded local-text child jobs (M1 / M2 / M9)

`start_job` runs a real, bounded model task in a distinct host-generated child
session. It is not a timer that marks work successful. Its arguments are
`{name, task, inputs?: string[]}`. `spawn_team` accepts an array of
`{name, task, role?, inputs?}` members; role is a label, never a permission.

The child has exactly two tools: `read_file` and `write_file` inside a private
scratch workspace. It has no shell, network, MCP, credentials, persistent-memory
lookup, parent reporting, approval, publishing, subscriptions or delegation.
The empty scratch directory is not seeded with the parent's repository or HOME.
This is a deliberately narrower capability surface, not a claim of generic
OS/process isolation for arbitrary code.

Only an active, canonical, non-speculative parent Worker may create tasks.
Inputs are explicit relative text-file paths read through the parent's EnvPort;
conventional credential/runtime paths, traversal and `.git` are rejected.
The manifest accepts at most 16 paths and 64 KiB total. The optional M9
`maxReadBytes` limit checks size and bounds reads from the same validated file
descriptor, including growth after the initial size check. Text is redacted
before copying it into the scratch workspace.

A child has at most six model steps and 60 seconds. Calls in a response must
have unique IDs; IDs cannot repeat during that child task. At most eight child
jobs per ticket and 32 globally may be active; a ticket may create at most 32
child executions over its lifetime. These bounds do not promise external model
providers will honor cancellation of a request already sent.

The child must finish its model loop with a non-empty summary. Model/tool
errors, forbidden tools, malformed calls and step/time exhaustion are failures,
not success. Successful writes become up to 16 owned text artifacts, capped at
128 KiB total. The parent's `read_job_result({jobId})` checks session and ticket
ownership and returns the actual execution state, summary and text artifacts.
Artifacts include opaque content-bound IDs, relative display paths and byte
lengths; no arbitrary child absolute path is returned as a capability. The
parent must explicitly read/apply the proposal; the child never promotes files
into the parent workspace. Scratch files are discarded after execution; bounded
artifact content remains in the private SQLite state.

M2 stores a version-1 `job_execution` document beside the existing job row. It
contains host-owned session/lease binding, task, input manifest, state, delivery
state and artifacts. Execution state and completion delivery are separate:
stopping a pending notification never rewrites work already completed as if it
had not happened. The existing SQL schema is unchanged; this is a versioned
document protocol, not a new SQL migration.

`stop_job` rejects absent jobs and foreign session/ticket ownership. It revokes
the execution lease and pending completion before cancellation is propagated.
Queued completions recheck cancellation on dequeue and before parent tools.
Parent termination and Runtime shutdown revoke child work; a late model reply
cannot run tools after revocation. A resumed parent may receive a retained
pending completion. A failed or stopped member remains failed/stopped in Team
aggregation; `complete_team` cannot manufacture success for running members.

Recovery never replays an interrupted running child attempt. A live or unknown
owner process is left untouched; only a definite missing process permits an
atomic lease-bound transition to `unknown` with `INTERRUPTED_EXECUTION`. Its
session is settled idle and its private scratch workspace is removed. Cleanup
failures retain `cleanupState: pending` for a later verified retry. Harness scheduling
and Runtime startup discover these obligations even after the parent ticket ends
or delivery is cancelled; cleanup retries never invoke the model or notify the parent. No successful
cleanup is claimed until removal returns. A successful durable receipt can deliver
its pending result without reexecuting the child. Historical timer-only running
rows have no task or executor evidence and become failed with
`LEGACY_EXECUTION_UNAVAILABLE`. Existing historical terminal rows are retained;
their success alone is not proof a real child task ran.

Known secrets are filtered, but arbitrary undiscovered secrets in owner-supplied
text cannot be identified perfectly. Parent input grants, artifact ACLs,
cancellation windows and recovery need independent regression/security review;
interfaces alone are not proof of these guarantees.
10 changes: 10 additions & 0 deletions docs/DEVELOPMENT_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ Owner approved local Phoenix + opt-in OpenTelemetry model/tool tracing with pre-

`TMPDIR=<dedicated canonical temporary root> pnpm run test --no-file-parallelism` completed: 219 files passed, 6 skipped; 2255 tests passed, 68 skipped; no failures (576.23 seconds). The previous parallel short-timeout failures and interrupted ENOSPC run are retained as environment evidence, not counted as passes. Final lazy-loading code and conditional assignment lookup passed independent code review; security review passed 12 focused tests. Persistent Phoenix 22.1.0 retained genuine Harness success/error traces: successful `list_tasks` produced 4 OK spans, while a scope-denied tool appeared as ERROR; both kept correct parentage and redacted fixture credentials. Local service is loopback-only, telemetry/external resources/embedded assistant disabled, dedicated state owner-only. PR and remote CI are next; no merge or production upgrade is claimed.


## M1 tool-system audit and redesign checkpoint (2026-12-01)

Owner requested a detailed tool-system audit, redesign and implementation, then supplied a static audit for careful bug verification. Baseline: origin/main a91f643. Isolated branch: codex/tool-system-redesign; checkout: .worktrees/tool-system-redesign.

Audit and evidence: docs/dev-loop-runs/2026-12-01-tool-system/00-audit.md and artifacts/. Design: 01-design.md. Confirmed defects include missing input validation, duplicate OpenAI call IDs executing twice, cross-worker stop_job, queued/restored completion after cancellation, inconsistent team/job state, undiscovered MCP invocation, uncertain timeout outcomes, unredacted resource text, UTF-8 output errors and misleading trace outcomes. Follow-up Runtime validation, exact PR/fill approval binding and LocalEnv read-path protections were independently checked rather than reported as bypasses.

Evidence: 13 focused files / 89 tests passed; separate 37 boundary tests overlap that set. New contract harness is RED: 5 contracts failed as expected on the unfixed baseline. Real locked OpenTelemetry SDK and local stdio fixtures used; no live model, remote side effect or production deployment. Source remains unchanged. Independent audit review APPROVE; architecture review APPROVE after module ownership, child execution isolation and small-PR sequencing corrections. Owner design review is next. No implementation PR opened or merged; no full-suite or integration pass claimed.

Next: owner review of the concrete design, then implementation planning, failing regression tests, small scoped PRs, independent code/security review and integration verification. Existing PR274/276 are not incorporated automatically. Main session alone owns project state.
## Context Engineering checkpoint (2026-12-01)

Branch codex/context-engineering, managed worktree context-engineering/deepseek-super-agent, code head1494e40. Persistent per-worktree state is .super-agent/state.json; unrelated root-workspace objectives are preserved. Source audit, stable cursors, budget gates, incremental compaction/rebuild, scoped Memory/Journal/Spill retrieval and deterministic 500-step acceptance are implemented. Current main36663f6 Phoenix tracing was integrated. Focused canonical-task/Runtime/collaboration/Phoenix gate passed35tests; final full gate is running. No live model is configured; no live summary-quality claim, production rollout or merge is recorded. Next: finish full offline gate, independently reviewed PR, requiredCI, owner approval for high-risk merge.
Expand Down
10 changes: 10 additions & 0 deletions docs/MASTER_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,16 @@ Owner approved local Phoenix + opt-in OpenTelemetry model/tool tracing with pre-

`TMPDIR=<dedicated canonical temporary root> pnpm run test --no-file-parallelism` completed: 219 files passed, 6 skipped; 2255 tests passed, 68 skipped; no failures (576.23 seconds). The previous parallel short-timeout failures and interrupted ENOSPC run are retained as environment evidence, not counted as passes. Final lazy-loading code and conditional assignment lookup passed independent code review; security review passed 12 focused tests. Persistent Phoenix 22.1.0 retained genuine Harness success/error traces: successful `list_tasks` produced 4 OK spans, while a scope-denied tool appeared as ERROR; both kept correct parentage and redacted fixture credentials. Local service is loopback-only, telemetry/external resources/embedded assistant disabled, dedicated state owner-only. PR and remote CI are next; no merge or production upgrade is claimed.


## M1 tool-system audit and redesign checkpoint (2026-12-01)

Owner requested a detailed tool-system audit, redesign and implementation, then supplied a static audit for careful bug verification. Baseline: origin/main a91f643. Isolated branch: codex/tool-system-redesign; checkout: .worktrees/tool-system-redesign.

Audit and evidence: docs/dev-loop-runs/2026-12-01-tool-system/00-audit.md and artifacts/. Design: 01-design.md. Confirmed defects include missing input validation, duplicate OpenAI call IDs executing twice, cross-worker stop_job, queued/restored completion after cancellation, inconsistent team/job state, undiscovered MCP invocation, uncertain timeout outcomes, unredacted resource text, UTF-8 output errors and misleading trace outcomes. Follow-up Runtime validation, exact PR/fill approval binding and LocalEnv read-path protections were independently checked rather than reported as bypasses.

Evidence: 13 focused files / 89 tests passed; separate 37 boundary tests overlap that set. New contract harness is RED: 5 contracts failed as expected on the unfixed baseline. Real locked OpenTelemetry SDK and local stdio fixtures used; no live model, remote side effect or production deployment. Source remains unchanged. Independent audit review APPROVE; architecture review APPROVE after module ownership, child execution isolation and small-PR sequencing corrections. Owner design review is next. No implementation PR opened or merged; no full-suite or integration pass claimed.

Next: owner review of the concrete design, then implementation planning, failing regression tests, small scoped PRs, independent code/security review and integration verification. Existing PR274/276 are not incorporated automatically. Main session alone owns project state.
## Context Engineering System (2026-12-01)

Owner-authorized context lifecycle work is implemented on codex/context-engineering, based on main 36663f6 plus current context commits. See CONTEXT_ENGINEERING_IMPLEMENTATION.md for audit, decisions, interfaces, test contracts and limitations. Context Builder/Budget/Compaction remain M1 services; Memory/Dreaming stay M6. Final frozen offline gate and PR integration remain outstanding at this checkpoint. Branch summaries and real-model quality evaluation are explicitly separate.
Expand Down
23 changes: 22 additions & 1 deletion docs/PHOENIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Open <http://127.0.0.1:6006>, select project **lofibot**, and inspect a trace:
```text
agent.turn (CHAIN, session.id, lofibot.ticket_id, lofibot.assignment_id, role)
├─ model.complete (LLM, model name, input messages/tool definitions, output)
├─ tool.invoke (TOOL, tool name/call ID, arguments, result)
├─ tool.bash (TOOL, registered tool name/call ID, arguments, result, outcome)
└─ model.complete
```

Expand All @@ -73,6 +73,27 @@ string properties have their descriptors read, with accessors omitted. The model
receives the original request and tools retain their original results; these
limits apply only to tracing.

The executor records host-driven invocations as well as model-driven ones.
Tool and model spans carry the originating turn and step identifiers when
available. `lofibot.outcome` distinguishes `model_failed`, `execution_failed`,
`unknown`, `approval_wait`, `paused`, `budget_exhausted` and normal completion.
A completed model turn is not evidence that the domain Ticket succeeded.
Nonzero shell exit codes are execution failures even when the handler returned
normally. A receipt failure after an action returns is `OUTCOME_UNKNOWN`;
verify the action before retrying it.

Each model span has a separate bounded tool manifest, count and omitted count,
so a long message history does not consume the manifest budget. Its
`capturedSchemaDigest` hashes the redacted schema preview, not the full schema;
it is diagnostic information, not a catalog authorization/version token.
The tool result wrapper preserves text while binary and secret filtering
continues to apply. Large manifests explicitly report omitted entries.

Tracing initialization reports controlled states/reasons through Runtime logs.
An unavailable exporter does not prevent execution; initialized does not prove
that a collector received or persisted a span. Export timeout/failure is
reported separately. Raw exception messages and stacks remain omitted.

## When traces do not appear

- Enable tracing on the process actually running the task and restart that
Expand Down
Loading
Loading