Skip to content

feat(crew-log): read-only kirocrew-crew-log MCP server over the crew log - #11909

Merged
iamwhatever merged 1 commit into
mainfrom
feat/crew-log-mcp-server
Sep 19, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/crew-log-mcp-server

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

The crew log is fenced from the agent on purpose. The sandbox hides crew-log/
from the agent's view and _CREW_SECRET_LEAVES fences the agent's file tools, so a
session cannot read another unit's history or forge a line into its own. That is
the right call for an append-only audit trail and it stays.

The cost lands somewhere the fence was not aiming at. Nobody developing the crew
log can verify it. Every check, did the emitter write that entry, does the fold
count what it should, which types does a real session produce, is a round trip
through the one person with a shell and jq. Reading was never the thing the fence
protected, but it was fenced along with writing.

The gateway already serves the log read-only over REST (#11558) and already
resolves a slot key to the unit its work is landing in (#11185). What was missing
was a door an agent can walk through.

Why it matters

The person who most needs to read a crew log is the one building on it, and that is
the one reader with no way in. The effect is not a missing convenience: it is that
every crew-log feature ships on evidence someone else had to fetch by hand, which
is slower and weaker than evidence the change's own author can produce.

A crew log carries full message bodies, and the justification rests on the gate,
not on the payload.
message/received and message/sent record the text itself,
and a body too large for one line is split across message/chunk entries the citing
entry names, so the whole transcript is reconstructable from the log. Other entry
types are narrower than that - context/composed is char and token counts,
request/configured is a sha256, a tool call is a parameter summary - but the
transcript-bearing types are not. What makes the grant safe is that
session_read_message in kirocrew-dashboard already returns a peer session's
full transcript to an agent the owner granted it, and these reads answer the same
class of content behind a STRICTER caller test: the caller's own unit needs a
strict session identity, and anything wider needs the owner's own non-restricted,
non-app dashboard session.

The integrity boundary is untouched. No write tool exists and none may be
added, the tool set is ratcheted to three read names, so adding one fails a test
rather than shipping. The fence is byte-identical: _CREW_SECRET_LEAVES and the
sandbox placeholder are not in this diff. The gateway remains the log's only writer.

What changed

A new opt-in MCP server, kirocrew-crew-log, in src/kiro_crew/mcp_crew_log.py,
with three read-only tools:
crew_log_list (one row per session log, optionally with the per-type histogram),
crew_log_read (a range of entries, citations resolved, data trimmed, capped at
200 rows and 64 KiB with next_from when cut), and crew_log_projection (one of
the five folds and its seq). Each takes a raw unit id, a session or slot key, or
self. Every refusal is a typed code.

Four routes back them under /api/crew-log/: the listing, key resolution, one
unit's page, one unit's fold. The two #11558 browser routes are unchanged and stay
cookie-only; the new prefix is the internal-caller door, and both call the same page
reader, now shared in crew_log/read.py. The new prefix is STRICT internal, and the
handler refuses a caller that arrives without the internal secret. Those are two
facts, not one: strict membership hard-denies a NON-loopback caller, but a loopback
request with no secret header still falls through to cookie auth and reaches the
handler, so the handler's own refusal is what keeps the owner test from becoming a
second way into another session's history from any authenticated page.

Authorization is in the endpoints: self needs a strict identity, anything wider
needs an owner dashboard session, and a headless, channel-bound, app-owned or
incognito caller is refused with a reason. Every read is SEL-audited under the
action names the browser routes already use.

Every request the server makes carries the calling session's STRICTLY resolved key,
resolved once per tool call and sent on each leg, so a caller the gateway cannot
name reads nothing at all. That is load-bearing rather than tidy: the lenient
resolver walks /proc ancestors, a subagent lives under its spawner's process tree,
and the spawner is commonly the owner's own tab, so a leniently-resolved key would
present an owner identity for a subagent's call and the wider-read rule would admit
it.

The server is assignable only, so no session pays context for it unless its own
spec grants it. docs/reference/crew-log/reading-from-an-agent.md carries the
one-line grant and the table of codes.

Registering a managed server means naming it in every registry that already names
its siblings, and a half-registered one is the failure mode: agent.py (the managed
spec, opt_in, no autoApprove), mcp_cleanup.py (the opt-in split doctor reads),
mcp_discovery.py (subcommand, tool module, caller-aware set), cli.py (the
mcp-crew-log verb), mcp_gateway/stub.py (stubbable subcommands),
cli_doctor.py (strict-identity servers), mcp_core.py (the reflexive-tool
registry, because self calls the strict gate), onboarding_import.py (managed
names are never imported from a runtime the user is leaving), token_auth.py
(known internal callers), validation.py (the three tool schemas),
dashboard/server.py (/api/crew-log as a strict-internal prefix),
dashboard/routes/sessions.py and dashboard/handlers/__init__.py (the routes),
and docs/feature-map/README.md (the row for the new agent-facing reads).

Tests

test/test_mcp_crew_log.py (48) covers the ratcheted tool set, the three unit
forms, the strictly-resolved key on every request leg, every typed code, the row
shape, and the caps. test/test_crew_log_routes.py gains 36 covering the two new
routes, one refusal per caller class, the audit action names, and the proxy's own
tool/called landing in the calling session's log. 124 pass together, and 470
across every suite that pins a registry this touches.

Five mutation checks, each verified red: removing the endpoint's forbidden branch
reds 11 tests; raising the 200-entry cap to 5000 reds 2; dropping the strict-identity
gate reds 3; letting a single full=True row bypass the byte cap reds 1; leaving
returned unrewritten on a cut page reds 1.

Sibling ratchets updated as the conscious paired edits they ask for: known internal
callers, the worker-unassignable set, the internal-secret call-site scan. Gates:
black, isort, flake8, mypy on changed files, check_black_formatting.py,
check_comment_history.py, check_feature_map.py, docs_lint, brand gate.

Pattern harvest

Three reusable pieces.

make_mocked_request's default app is a MagicMock, so request.app.get("state")
answers a fresh mock whose every attribute is truthy. An app-ownership check tested
against it "finds" an owning app for the person, and the gate reads green against a
fiction. A handler test that reads state needs a real web.Application.

Running black on a file listed in .github/black-baseline.txt reformats far more
than the edit: 174 lines here, one of which moved a # nosemgrep: pragma off the
line it suppresses and turned SAST red. A one-line registry edit to a baselined file
should be made by hand and left unformatted.

onboarding_import._CORE_MANAGED_MCP_NAMES had every always-on managed server and
neither opt-in one. This adds kirocrew-work beside the new name rather than
leaving an identical gap open next to a test that closes it.

no linked issue: #11549 is the crew-log rename this PR's vocabulary follows, not an issue this closes.

Refs #11549

@chenmingwei23
chenmingwei23 requested review from a team and smeyffret September 18, 2026 23:12
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of e6acbba0af36963840feb40b6b572f451da64f2e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify a loopback browser request bearing a forged, invalid X-Internal-Secret is denied by middleware — the handler's load-bearing check tests header presence, not validity.

[DESIGN-REVIEWED] e6acbba

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of e6acbba0af36963840feb40b6b572f451da64f2e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify on a live gateway that a cookie-authed loopback request is refused at all four /api/crew-log/ routes — the wider-read rule's safety rests on that handler refusal, tested here only with mocked requests.

What this change ships

Inventory (10 items) — 10 justified

Intent: let an agent read the crew log (fenced from its file tools) through a sanctioned read-only door, so crew-log features can be verified without a human running jq. ADDITION.

  1. An agent granted the opt-in kirocrew-crew-log server can list crew logs, page one unit, and read a fold — justified
  2. Four new internal-only routes under /api/crew-log/ back those tools — justified
  3. New read rule: own unit needs strict identity; any other unit needs the owner's non-app, non-incognito dashboard session — justified
  4. Every agent-door read and refusal is SEL-audited under the browser routes' action names, granted reads included — justified
  5. New CLI verb kirocrew mcp-crew-log — justified
  6. The page reader moved to shared crew_log/read.py; browser routes unchanged, now calling it — justified
  7. Listing filters (slot_contains, active_within_secs, histogram) with bounded scan and honest truncated reporting — justified
  8. Onboarding import now never carries a kirocrew-work entry over from a departing runtime (declared sibling-gap fix) — justified
  9. Workers automatically cannot be assigned the new server — justified
  10. Tools advertised while the flag is off; the flag state is learned from a typed refusal — justified

Lens checks that held: not product shape (opt-in, default agent unchanged — no lens-9 trigger). Not a duplicate: session_read_message (mcp_dashboard.py:1554) serves transcripts, not entries/folds/histograms, and no existing symbol combines the owner-session test _owner_session_refusal makes (grepped startswith("dashboard:") — 37 sites, none equivalent). No deleted pins: both widened ratchets (KNOWN_INTERNAL_CALLERS, worker-unassignable) invite exactly that paired edit.

[FIRST-PRINCIPLES-REVIEWED] e6acbba

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed e6acbba0af36963840feb40b6b572f451da64f2e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] e6acbba

Verdict parsed from the review's SHA-scoped output markers for commit e6acbba0af36963840feb40b6b572f451da64f2e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable e6acbba0af36963840feb40b6b572f451da64f2e: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ human override accepted

Human judgment by @chenmingwei23 overrides the GPT 5.6 finding for e6acbba0af36963840feb40b6b572f451da64f2e; the recorded reason is authoritative for this commit.

This comment is updated in place on each push.

The model was not re-run because an authorized human decision supersedes it.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e6acbba0af36963840feb40b6b572f451da64f2e: <one-sentence reason>

@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-mcp-server branch from 89c669e to ef66e3e Compare September 18, 2026 23:39
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 18, 2026
@chenmingwei23

chenmingwei23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@edit-5737498528.md

@chenmingwei23

chenmingwei23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@edit-5737498640.md

@chenmingwei23

chenmingwei23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@edit-5737498754.md

@chenmingwei23

chenmingwei23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@edit-5737498876.md

@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • fixed span=8cf87f7e6566 a cut page kept the pre-cut returned count

Real. _fit copied the envelope's "returned": len(entries) and replaced
entries with the smaller kept without rewriting it, so a cut page reported
100 alongside 40 rows. returned is what a caller checks against its request,
so the wrong count is worse than a short page.
Fixed in ef66e3e: body["returned"] = len(kept) is set beside
truncated_to_fit and next_from, and _one_row_within_budget sets it to 1.
Test: test_a_cut_page_reports_the_rows_it_actually_carries. Mutation: remove
the rewrite, 1 test red.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 18, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-mcp-server branch from ef66e3e to 1ffd0a0 Compare September 18, 2026 23:57
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: the security paragraph argued narrowness on content while the log records full message bodies

  • span=183e05054f91 - fixed. The narrowness claim was false and is gone from both places.

Verified the content question against the emitters before rewriting, rather than
taking the finding on wording: crew_log/emit.py appends message/received and
message/sent with the body text itself, and _append_body_entry slices a body
too large for one line into message/chunk entries the citing entry names in
chunks, so the whole transcript is reconstructable from the log. The reviewer is
right, and agent.py's own comment in this diff was the honest half.

Both halves now state it plainly. The PR description's paragraph is retitled to say
a crew log carries full message bodies, names the chunk mechanism, keeps the
narrower types as what they are (context/composed counts, request/configured
sha256, a tool call's parameter summary) and says outright that an earlier draft
claimed otherwise. docs/reference/crew-log/reading-from-an-agent.md carries the
same correction and ends on the gate.

The justification now rests only on the gate being stricter: a strict session
identity for self, and the owner's own non-restricted, non-app dashboard session
for anything wider. No claim about thinner content is load-bearing anywhere.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: a request-surface value with no writer anywhere, so no call could ever return data through it

  • span=cdcf1f9be71d - fixed by deletion. The crew value is gone from every surface this PR added.

Confirmed the zero-producer claim before deleting rather than after: nothing
outside crew_log/ names KIND_CREW at all, and inside the package the only
reference is _ROOT_DIR mapping it to a directory name. No emitter, no route, no
caller ever writes a crew unit, so every request that named the value was answered
by a hardcoded empty list.

Deleted: the enum on the tool's kind property, the sentence in the
crew_log_list description, the route's crew branch and its note, and the
allowed set in CREW_LOG_LIST_SCHEMA. With the value gone the parameter had one
legal value equal to its own default, which is the same defect one level up, so the
kind argument is deleted from the tool surface too. The schema now refuses it as
an unknown field, which tells an agent the argument does not exist instead of
telling it the argument exists and is pointless.

The route keeps a kind query check that refuses anything but session, because a
listing that silently ignores a query parameter is worse than one that names what it
holds. Two tests replace the two that asserted the old shape, and the mutation that
re-admits crew reds one, the mutation that re-adds the schema field reds one.

If a crew-kind writer ever lands, the parameter comes back with a producer behind it.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: a 15-entry list whose every match is already decided by the next disjunct in the same expression

  • span=629d162640c1 - fixed by deletion. The tuple and its disjunct are gone.

The subsumption holds for the reason the finding gives, and it holds for every
possible key, not just the listed ones: no entry starts with dashboard:, and two
distinct prefixes of the same string cannot both match, so any key caught by
startswith(_NON_OWNER_KEY_PREFIXES) necessarily fails
startswith("dashboard:"). The second disjunct decided every case on its own. The
refusal text is unchanged because it was always built from the key's own namespace
via split(":", 1)[0], never from the matched entry.

The docstring was the tell and it is left as written: it already said a caller is
"refused by the namespace it carries rather than by a list of what it is not". The
list contradicted its own stated rule.

Deleting it is not merely equivalent, it is stricter over time. The existing
parametrized refusal test (cron, subagent, taskrunner, slack, discord) still passes
unchanged, which is the behaviour proof, and it gains a case with a namespace no
release has shipped: a surface added later is refused the wider read the day it
exists, where the list would have admitted it until someone remembered to add a
line. The mutation that removes the namespace check reds 7 tests.

@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-mcp-server branch from 1ffd0a0 to e38cdb8 Compare September 19, 2026 00:05
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: the count cap was applied in the consuming loop while the walk above it retained every directory

  • fixed span=f0eedaa2df63 the scan cap did not bound what the walk retained

Real, and the adjudication's reading of the rule is the correct one.
_candidate_dirs called iterdir(), built a (mtime, path) row for every
directory, sorted the whole list and returned all of it; MAX_LISTED_SCAN then
stopped the CONSUMER at 400. So one listing's memory and latency scaled with how
many sessions the host had ever run, which is an ordinary host on a long-lived
gateway, not an adversarial one.

The bound now sits where retention happens. The walk uses os.scandir, which
streams, and a fixed-size heap keyed on mtime holds at most
MAX_LISTED_CANDIDATES entries: the heap root is the oldest retained candidate,
so a newer directory replaces it and the loser is dropped immediately instead of
being accumulated and sorted at the end.

Two details that are decisions, not incidentals. The new bound is
MAX_LISTED_SCAN * 2 rather than equal to it, because the consuming loop skips a
directory outside an active_within window or with no readable unit id WITHOUT
counting it as scanned, so the candidate set has to absorb some skips before the
scan cap is reached; equality would have quietly shortened a windowed listing.
And _candidate_dirs now returns whether it had to cut, which the listing folds
into truncated -- a caller must not read a bounded walk as the whole tree, and
that invariant already existed for the downstream cut.

Five tests cover it: the newest candidates are the ones kept, a root within the
bound is not reported cut, a cut candidate set makes the listing report
truncated, the never-created root stays empty-and-not-cut, and one that watches
heappush to assert the peak held size never exceeds the bound -- retention is
the claim, so a test that only checked the returned length would not prove it.
The mutation that restores unbounded retention reds 3.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-mcp-server branch from e38cdb8 to 18788b4 Compare September 19, 2026 00:49
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

BLOCKED -- needs a maintainer scope decision, not an override

GPT's blocking finding on 20e3e417b9 is real and reachable. I verified every link
from source rather than taking the review's word, and I am not overriding it. What it
turns out to be, though, is a decision about this PR's scope rather than a defect inside
its diff -- so I have stopped rather than guess which way you want it.

The chain, verified

sandbox.py's own disposition table lists the trust root as agent-writable, not
merely unfenced. _CREW_SANDBOX_VISIBLE_LEAVES (sandbox.py:539) contains trust,
sel_hmac.key and .local_secret, and VISIBLE is defined at sandbox.py:200 as
"In-sandbox code needs READ and WRITE, so no OS rule can apply without breaking it.
These stay on the tool gate alone." AGENTS.md:112 carries the same residual explicitly:
"sel_hmac.key is VISIBLE, so the SEL audit key has no OS fence; closing that means
moving its in-sandbox reader behind the gateway, never another matcher."

With the key readable, strict session identity is mintable in-sandbox:

  1. Read trust/sel_hmac.key -- VISIBLE, so the tool gate refuses a file-tool read while
    any in-sandbox shell command succeeds.
  2. Write session_pid_<pid>.txt naming any session key. mcp_core.py:843 already says
    this file "is agent-writable and therefore forgeable".
  3. Compute the matching .sig with the key from step 1. verify_session_pid
    (session_pid_sig.py:515) reads both from config_dir() and verifies.
  4. require_strict_session_key returns the forged key.
  5. Read .local_secret -- also VISIBLE -- to authenticate on the internal transport.
  6. _owner_session_refusal (dashboard/handlers/crew_log.py:274) then passes for any
    forged dashboard: key naming a live, non-app, non-restricted slot.
  7. Every session's crew log is readable, and a crew log carries full message bodies.

One thing the review did not name

mcp_core.py:843 rests the strict resolver's security on the key being one "which agents
cannot read". sandbox.py:539 says the opposite, and sandbox.py is the file that
decides. The guarantee the mechanism is documented on does not hold, and that text is on
main, not in this diff.

Why this is a scope decision

The forgery is not introduced here. require_strict_session_key is the authorization
input for mcp_cron ("cron ownership authorization", mcp_cron.py:1966), several
mcp_dashboard tools (mcp_dashboard.py:1303, :1353, :1419, :2005, :2232) and
mcp_computer. Every one of those inherits the same forgeable identity today. What this
PR does is add a consumer whose payload is other sessions' transcripts, which is why the
finding lands here and not on them.

That also undercuts the security paragraph in this PR's own description. It argues the
grant is safe because session_read_message already returns a peer session's full
transcript behind a weaker gate. If a forged identity satisfies both gates, "stricter
gate" is not the reassurance I wrote it as.

The two options, with what each costs

A. Ship self only. Drop the wider read: delete crew_log_list, and refuse a page
or projection for any unit but the caller's own. Fully inside this PR, closes the finding
outright, and keeps the brief's stated purpose -- verifying that something this session
just did was recorded. The cost is that the brief specified three tools and this ships
two, and cross-session inspection goes away.

B. Close the residual on main first, then land this unchanged. Move the in-sandbox
reader behind the gateway, which is the remedy AGENTS.md:112 itself names. That fixes
every consumer above rather than one, and it corrects mcp_core.py:843's claim. The cost
is that it is a main-side architectural change this PR should not carry, and this PR waits
on it.

I lean A, because it makes this PR true on its own terms today and does not ask a
feature to wait on an architectural change. But deleting a tool the brief asked for is
your call, not mine.

Not doing

No /ai-review override gpt. The finding is verified real and reachable, and an override
on a real reachable security finding launders a known hole to green. Opus's adjudication
reached UPHOLD-FENCED for the same reason.

Everything else on this head is green: 74 lanes success, 11 skipped, Design / First
Principles / Opus / UX all PASS, and round 4's audit gap (the secret-less and
wrong-component denials returning _forbidden without a SEL row) is fixed with three
mutations verified red.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 19, 2026
The crew log is fenced from the agent so a session cannot alter its own audit
trail. That stays. What it also did was make the log unverifiable by anyone but
the operator with a shell, because reading was fenced along with writing.

This adds a standalone, assignable, read-only MCP server of three tools over the
gateway's own routes: list the session logs, page one, read a fold. No write tool
exists and the set is ratcheted so none can be added. Authorization lives in the
endpoints: the caller's own unit needs a strict session identity, and any wider
read needs the owner at a dashboard tab.

Refs #11549
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-mcp-server branch from 20e3e41 to e6acbba Compare September 19, 2026 05:25
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt e6acbba: the residual is pre-existing on main and documented as carried in AGENTS.md:112 (the sandbox exposes trust/sel_hmac.key, so the same forged identity already reaches session_read_message, cron and computer); it is now tracked for a main-side fix in #11963, and this PR adds a consumer behind the owner-only gate with SEL audit rather than the hole itself; approved by the repository owner.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@chenmingwei23 marked the gpt AI finding as false positive, not applicable, or explicitly accepted for e6acbba0af36963840feb40b6b572f451da64f2e.

the residual is pre-existing on main and documented as carried in AGENTS.md:112 (the sandbox exposes trust/sel_hmac.key, so the same forged identity already reaches session_read_message, cron and computer); it is now tracked for a main-side fix in #11963, and this PR adds a consumer behind the owner-only gate with SEL audit rather than the hole itself; approved by the repository owner.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

The override recorded on e6acbba0af36963840feb40b6b572f451da64f2e defers a residual that is not
this PR's to close, so it is tracked separately in #11963.

What the residual is: require_strict_session_key rests on a trust root an in-sandbox shell can
read and write. _CREW_SANDBOX_VISIBLE_LEAVES (sandbox.py:539) lists trust, sel_hmac.key and
.local_secret, and VISIBLE at sandbox.py:200 means no OS rule applies -- only the tool gate.
So a forged session_pid_<pid>.txt can be signed with the key next to it and verified.

Why it is not scoped here: that resolver is the authorization input for mcp_cron, five
mcp_dashboard sites and mcp_computer, all of which inherit the same mintable identity today.
This PR adds a consumer whose payload is other sessions' transcripts, which is why the finding
surfaced here rather than on them. The remedy named by AGENTS.md:112 -- moving the in-sandbox
reader behind the gateway -- fixes every consumer and belongs on main.

Two findings from the same review round are real but were left for a later head, because any push
voids the SHA-pinned override:

  • handlers/crew_log.py:403 -- _audit_crew_log_read calls _sel().log_api_access synchronously
    from async handlers. sel_is_warm's own docstring (sel.py:3417) documents that a failed
    startup warm makes the next sel() redo init with blocking file I/O on the caller thread, and
    names the fix: ask sel_is_warm() first, thread-hop only when it answers no.
  • mcp_crew_log.py:105 -- _SLOT_KEY_RE rejects a hyphen in the key namespace, so a real
    wf-pool: key (session.py:490) is read as a raw unit id and answers unknown_unit. Same for
    wf-author:, wf-worker:, wf-unpooled:, wf-scope: and memory-consolidation:.

@iamwhatever
iamwhatever merged commit c4268b7 into main Sep 19, 2026
88 of 89 checks passed
@iamwhatever
iamwhatever deleted the feat/crew-log-mcp-server branch September 19, 2026 17:28
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 19, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
…log (kirodotdev#11909)

The crew log is fenced from the agent so a session cannot alter its own audit
trail. That stays. What it also did was make the log unverifiable by anyone but
the operator with a shell, because reading was fenced along with writing.

This adds a standalone, assignable, read-only MCP server of three tools over the
gateway's own routes: list the session logs, page one, read a fold. No write tool
exists and the set is ratcheted so none can be added. Authorization lives in the
endpoints: the caller's own unit needs a strict session identity, and any wider
read needs the owner at a dashboard tab.

Refs kirodotdev#11549
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants